mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 393206: fix JSON tests, patch by Simon Bünzli <zeniko@gmail.com>, r=me
This commit is contained in:
parent
66213acd3d
commit
c17bc2363b
@ -45,24 +45,20 @@ function run_test() {
|
||||
|
||||
// ensures that an object can't be converted to a JSON string
|
||||
function isInvalidType(a) {
|
||||
// FIXME: bug 393206
|
||||
return true;
|
||||
try {
|
||||
JSON.toString(a);
|
||||
return false;
|
||||
} catch (ex) {
|
||||
return ex instanceof TypeError;
|
||||
return ex.name == "TypeError";
|
||||
}
|
||||
}
|
||||
// ensures that a string can't be converted back to a JavaScript object
|
||||
function isInvalidSyntax(a) {
|
||||
// FIXME: bug 393206
|
||||
return true;
|
||||
try {
|
||||
JSON.fromString(a);
|
||||
return false;
|
||||
} catch (ex) {
|
||||
return ex instanceof SyntaxError;
|
||||
return ex.name == "SyntaxError";
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,9 +76,9 @@ function run_test() {
|
||||
do_check_true(isInvalidType(Infinity));
|
||||
do_check_true(isInvalidType(NaN));
|
||||
|
||||
// FIXME: bug 393206
|
||||
//do_check_eq(toJSONString("Foo-Bar \b\t\n\f\r\"\\ \x01€"),
|
||||
// '"Foo-Bar \\b\\t\\n\\f\\r\\"\\\\ \\u0001\\u20ac"');
|
||||
//XXXzeniko: using € instead of \u20ac fails because of encoding issues
|
||||
do_check_eq(toJSONString("Foo-Bar \b\t\n\f\r\"\\ \x01\u20ac"),
|
||||
'"Foo-Bar \\b\\t\\n\\f\\r\\"\\\\ \\u0001\\u20ac"');
|
||||
|
||||
do_check_eq(toJSONString(null), "null");
|
||||
do_check_true(isInvalidType(undefined));
|
||||
@ -107,9 +103,8 @@ function run_test() {
|
||||
do_check_eq(JSON.fromString("1.23e-45"), 1.23e-45);
|
||||
do_check_true(isInvalidSyntax("NaN"));
|
||||
|
||||
// FIXME: bug 393206
|
||||
//do_check_eq(JSON.fromString('"Foo-Bar \\b\\t\\n\\f\\r\\"\\\\ \\u0001\\u20ac"'),
|
||||
// "Foo-Bar \b\t\n\f\r\"\\ \x01€");
|
||||
do_check_eq(JSON.fromString('"Foo-Bar \\b\\t\\n\\f\\r\\"\\\\ \\u0001\\u20ac"'),
|
||||
"Foo-Bar \b\t\n\f\r\"\\ \x01\u20ac");
|
||||
do_check_true(isInvalidSyntax('"multi\nline"'));
|
||||
do_check_eq(JSON.fromString("null"), null);
|
||||
do_check_true(isInvalidSyntax("."));
|
||||
|
Loading…
Reference in New Issue
Block a user