mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
Merge pull request #180 from tea-dragon/master
Fix 'allow unresolved' for at least two list cases
This commit is contained in:
commit
51d94fc357
@ -98,7 +98,11 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
|
||||
}
|
||||
|
||||
if (changed != null) {
|
||||
return new SimpleConfigList(origin(), changed, newResolveStatus);
|
||||
if (newResolveStatus != null) {
|
||||
return new SimpleConfigList(origin(), changed, newResolveStatus);
|
||||
} else {
|
||||
return new SimpleConfigList(origin(), changed);
|
||||
}
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
@ -122,7 +126,7 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
|
||||
return context.resolve(v);
|
||||
}
|
||||
|
||||
}, ResolveStatus.RESOLVED);
|
||||
}, null /* don't force resolve status -- could be allowing unresolved */);
|
||||
} catch (NotPossibleToResolve e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
|
@ -1120,6 +1120,15 @@ 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}")
|
||||
|
Loading…
Reference in New Issue
Block a user