New test
This commit is contained in:
parent
d5cbe90235
commit
02e0eae396
|
@ -138,6 +138,7 @@ class Decoder {
|
|||
|
||||
mapFromArray(vs) {
|
||||
return Map().withMutations((m) => {
|
||||
if (vs.length % 2) throw new DecodeError("Missing dictionary value");
|
||||
for (let i = 0; i < vs.length; i += 2) {
|
||||
m.set(vs[i], vs[i+1]);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,10 @@ class ImmutableDict(dict):
|
|||
try:
|
||||
while True:
|
||||
k = next(i)
|
||||
v = next(i)
|
||||
try:
|
||||
v = next(i)
|
||||
except StopIteration:
|
||||
raise DecodeError("Missing dictionary value")
|
||||
result_proxy.__setitem__(k, v)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
|
Binary file not shown.
|
@ -36,6 +36,7 @@
|
|||
dict2a: @"Missing close brace" <ParseShort "{">
|
||||
dict3: @"Duplicate key" <ParseError "{ a: 1, a: 2 }">
|
||||
dict4: @"Unexpected close brace" <ParseError "}">
|
||||
dict5: @"Missing value" <DecodeError #hex{b3 31 32 33}>
|
||||
double1: <Test #hex{033ff0000000000000} 1.0>
|
||||
double2: <Test #hex{03fe3cb7b759bf0426} -1.202e300>
|
||||
float1: <Test #hex{023f800000} 1.0f>
|
||||
|
|
Loading…
Reference in New Issue