mirror of
https://github.com/lightbend/config.git
synced 2025-01-28 21:20:07 +08:00
isolate test for allowing unresolved list elements
This commit is contained in:
parent
3c6488fbc2
commit
ed19f4c09e
@ -1118,12 +1118,20 @@ class ConfigTest extends TestUtils {
|
||||
assertTrue("after resolution, config is now resolved", resolved2.isResolved)
|
||||
}
|
||||
|
||||
@Test
|
||||
def allowUnresolvedDoesAllowUnresolvedArrayElements() {
|
||||
val values = ConfigFactory.parseString("unknown = [someVal], known = 42")
|
||||
val unresolved = ConfigFactory.parseString("concat = [${unknown}[]], sibling = [${unknown}, ${known}]")
|
||||
unresolved.resolve(ConfigResolveOptions.defaults().setAllowUnresolved(true))
|
||||
unresolved.withFallback(values).resolve()
|
||||
unresolved.resolveWith(values)
|
||||
}
|
||||
|
||||
@Test
|
||||
def allowUnresolvedDoesAllowUnresolved() {
|
||||
val values = ConfigFactory.parseString("{ foo = 1, bar = 2, m = 3, n = 4, unknown = [someVal]}")
|
||||
val values = ConfigFactory.parseString("{ foo = 1, bar = 2, m = 3, n = 4}")
|
||||
assertTrue("config with no substitutions starts as resolved", values.isResolved)
|
||||
val unresolved = ConfigFactory.parseString(
|
||||
"l = [${unknown}[]], l2 = [${unknown}, ${alwaysValue}], a = ${foo}, b = ${bar}, c { x = ${m}, y = ${n}, z = foo${m}bar }, alwaysResolveable=${alwaysValue}, alwaysValue=42")
|
||||
val unresolved = ConfigFactory.parseString("a = ${foo}, b = ${bar}, c { x = ${m}, y = ${n}, z = foo${m}bar }, alwaysResolveable=${alwaysValue}, alwaysValue=42")
|
||||
assertFalse("config with substitutions starts as not resolved", unresolved.isResolved)
|
||||
|
||||
// resolve() by default throws with unresolveable substs
|
||||
|
Loading…
Reference in New Issue
Block a user