1
Fork 0

Fix json test.

This commit is contained in:
Graydon Hoare 2012-08-30 16:27:15 -07:00
parent 54a8d69c4f
commit 11871b8baa

View file

@ -703,20 +703,18 @@ mod tests {
assert to_str(mk_dict(~[])) == ~"{}"; assert to_str(mk_dict(~[])) == ~"{}";
assert to_str(mk_dict(~[(~"a", Boolean(true))])) assert to_str(mk_dict(~[(~"a", Boolean(true))]))
== ~"{ \"a\": true }"; == ~"{ \"a\": true }";
assert to_str(mk_dict(~[ let a = mk_dict(~[
(~"a", Boolean(true)), (~"a", Boolean(true)),
(~"b", List(@~[ (~"b", List(@~[
mk_dict(~[(~"c", String(@~"\x0c\r"))]), mk_dict(~[(~"c", String(@~"\x0c\r"))]),
mk_dict(~[(~"d", String(@~""))]) mk_dict(~[(~"d", String(@~""))])
])) ]))
])) == ]);
~"{ " + let astr = to_str(a);
~"\"a\": true, " + let b = result::get(from_str(astr));
~"\"b\": [" + let bstr = to_str(b);
~"{ \"c\": \"\\f\\r\" }, " + assert astr == bstr;
~"{ \"d\": \"\" }" + assert a == b;
~"]" +
~" }";
} }
#[test] #[test]