diff options
Diffstat (limited to 'tests/test_std.js')
-rw-r--r-- | tests/test_std.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test_std.js b/tests/test_std.js index df02f92..3debe40 100644 --- a/tests/test_std.js +++ b/tests/test_std.js @@ -6,7 +6,7 @@ function assert(actual, expected, message) { if (arguments.length == 1) expected = true; - if (actual === expected) + if (Object.is(actual, expected)) return; if (actual !== null && expected !== null @@ -129,15 +129,27 @@ function test_popen() function test_ext_json() { var expected, input, obj; - expected = '{"x":false,"y":true,"z2":null,"a":[1,8,160],"s":"str"}'; + expected = '{"x":false,"y":true,"z2":null,"a":[1,8,160],"b":"abc\\u000bd","s":"str"}'; input = `{ "x":false, /*comments are allowed */ "y":true, // also a comment z2:null, // unquoted property names "a":[+1,0o10,0xa0,], // plus prefix, octal, hexadecimal + "b": "ab\ +c\\vd", // multi-line strings, '\v' escape "s":'str',} // trailing comma in objects and arrays, single quoted string `; obj = std.parseExtJSON(input); assert(JSON.stringify(obj), expected); + + obj = std.parseExtJSON('[Infinity, +Infinity, -Infinity, NaN, +NaN, -NaN, .1, -.2]'); + assert(obj[0], Infinity); + assert(obj[1], Infinity); + assert(obj[2], -Infinity); + assert(obj[3], NaN); + assert(obj[4], NaN); + assert(obj[5], NaN); + assert(obj[6], 0.1); + assert(obj[7], -0.2); } function test_os() |