@@ -80,6 +80,9 @@ assert_eq(json.decode('"\\u0123"'), 'ģ')
80
80
assert_eq (json .decode ('\t [\t 1,\r 2,\n 3]\n ' ), [1 , 2 , 3 ]) # whitespace other than ' '
81
81
assert_eq (json .decode ('\n {\t "a":\r 1\t }\n ' ), {'a' : 1 }) # same, with dict
82
82
assert_eq (json .decode (r'"\\\/\"\n\r\t"' ), "\\ /\" \n \r \t " ) # TODO(adonovan): test \b\f when Starlark/Java supports them
83
+ assert_eq (json .decode ('{"x": 1, "x": 2}' ), {"x" : 2 })
84
+ assert_eq (json .decode ('{"x": {"y": 1, "y": 2}}' ), {"x" : {"y" : 2 }})
85
+ assert_eq (json .decode ('{"x": {"y": 1, "z": 1}, "x": {"y": 2}}' ), {"x" : {"y" : 2 }})
83
86
84
87
# We accept UTF-16 strings that have been arbitrarily truncated,
85
88
# as many Java and JavaScript programs emit them.
@@ -123,7 +126,6 @@ assert_fails(lambda: json.decode('[1, 2}'), "got \"}\", want ',' or ']'")
123
126
assert_fails (lambda : json .decode ('{"one": 1' ), "unexpected end of file" )
124
127
assert_fails (lambda : json .decode ('{"one" 1' ), 'after object key, got "1", want \' :\' ' )
125
128
assert_fails (lambda : json .decode ('{"one": 1 "two": 2' ), "in object, got ..\" ., want ',' or '}'" )
126
- assert_fails (lambda : json .decode ('{"x": 1, "x": 2}' ), 'object has duplicate key: "x"' )
127
129
assert_fails (lambda : json .decode ('{1:2}' ), "got int for object key, want string" )
128
130
assert_fails (lambda : json .decode ('{"one": 1,' ), "unexpected end of file" )
129
131
assert_fails (lambda : json .decode ('{"one": 1, }' ), 'unexpected character "}"' )
0 commit comments