@@ -8,8 +8,10 @@ import org.junit._
88import com .typesafe .config .ConfigValue
99import com .typesafe .config .ConfigException
1010import com .typesafe .config .ConfigResolveOptions
11+ import com .typesafe .config .ConfigRenderOptions
1112import com .typesafe .config .Config
1213import com .typesafe .config .ConfigFactory
14+ import com .typesafe .config .ConfigParseOptions
1315import scala .collection .JavaConverters ._
1416
1517class ConcatenationTest extends TestUtils {
@@ -488,6 +490,32 @@ class ConcatenationTest extends TestUtils {
488490 assertEquals(List (1 , 2 ), conf.getIntList(" x" ).asScala)
489491 }
490492
493+ // https://github.com/lightbend/config/issues/829
494+ @ Test
495+ def renderArrayConcatenationRoundTrip () {
496+ val renderOptions = ConfigRenderOptions .defaults
497+ .setJson(false )
498+ .setOriginComments(false )
499+ .setComments(true )
500+ .setFormatted(true )
501+ val parseOptions = ConfigParseOptions .defaults.setAllowMissing(true )
502+
503+ val original = """ ex1 = [1, 2]
504+ |except = ${ex1} ${ex1}
505+ |""" .stripMargin
506+ val rendered = ConfigFactory
507+ .parseString(original, parseOptions)
508+ .root
509+ .render(renderOptions)
510+
511+ // the rendered config should be parseable and resolvable
512+ val resolved = ConfigFactory
513+ .parseString(rendered, parseOptions.setAllowMissing(false ))
514+ .resolve()
515+
516+ assertEquals(List (1 , 2 , 1 , 2 ), resolved.getIntList(" except" ).asScala.toList)
517+ }
518+
491519 // but quoted whitespace should be an error
492520 @ Test
493521 def concatSubstitutionsThatAreObjectsWithQuotedSpace () {
0 commit comments