public void OptionalSubstitutionCycleShouldBeIgnored() { var source = "foo : ${?foo}"; JsonPlusRoot root = null; var ex = Record.Exception(() => root = JsonPlusParser.Parse(source)); Assert.Null(ex); // should not create a field Assert.False(root.HasPath("foo")); }
public void MergedSubstitutionShouldAlwaysResolveToOlderValue() { var source = @" foo : { a : { c : 1 } } foo : ${foo.a} foo : { a : 2 }"; JsonPlusRoot root = null; var ex = Record.Exception(() => root = JsonPlusParser.Parse(source)); Assert.Null(ex); Assert.Equal(2, root.GetInt32("foo.a")); Assert.Equal(1, root.GetInt32("foo.c")); Assert.False(root.HasPath("foo.a.c")); }