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(~[(~"a", Boolean(true))]))
== ~"{ \"a\": true }";
assert to_str(mk_dict(~[
let a = mk_dict(~[
(~"a", Boolean(true)),
(~"b", List(@~[
mk_dict(~[(~"c", String(@~"\x0c\r"))]),
mk_dict(~[(~"d", String(@~""))])
]))
])) ==
~"{ " +
~"\"a\": true, " +
~"\"b\": [" +
~"{ \"c\": \"\\f\\r\" }, " +
~"{ \"d\": \"\" }" +
~"]" +
~" }";
]);
let astr = to_str(a);
let b = result::get(from_str(astr));
let bstr = to_str(b);
assert astr == bstr;
assert a == b;
}
#[test]