test the current behavior of duplicate keys set to object, then primitive, then object

This commit is contained in:
Havoc Pennington 2011-11-16 21:25:29 -05:00
parent 4676023f1c
commit e1329e54bf

View File

@ -188,6 +188,23 @@ class ConfParserTest extends TestUtils {
assertEquals(100, obj.getInt("a.b.c.z"))
}
@Test
def duplicateKeyObjectNullObject() {
// null is supposed to "reset" the object at key "a"
val obj = parseObject("""{ a : { b : 1 }, a : null, a : { c : 2 } }""")
assertEquals(1, obj.size())
assertEquals(1, obj.getObject("a").size())
assertEquals(2, obj.getInt("a.c"))
}
@Test
def duplicateKeyObjectNumberObject() {
val obj = parseObject("""{ a : { b : 1 }, a : 42, a : { c : 2 } }""")
assertEquals(1, obj.size())
assertEquals(1, obj.getObject("a").size())
assertEquals(2, obj.getInt("a.c"))
}
@Test
def impliedCommaHandling() {
val valids = Seq(