Remove print calls in sm/JSON

This commit is contained in:
André Bargull 2025-04-30 14:16:02 +02:00 committed by Philip Chimento
parent a421452df2
commit 3de16a5e94
30 changed files with 29 additions and 377 deletions

View File

@ -8,18 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.stringify shouldn't use context-wide cycle detection
esid: pending esid: pending
---*/ ---*/
//-----------------------------------------------------------------------------
var BUGNUMBER = 1197097;
var summary = "JSON.stringify shouldn't use context-wide cycle detection";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var arr; var arr;
@ -40,7 +31,3 @@ arr = [{
} }
}]; }];
assert.sameValue(arr.join(), "[{}]"); assert.sameValue(arr.join(), "[{}]");
/******************************************************************************/
print("Tests complete");

View File

@ -8,20 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Properly detect cycles in JSON.stringify (throw TypeError, check for cycles rather than imprecisely rely on recursion limits)
esid: pending esid: pending
---*/ ---*/
//-----------------------------------------------------------------------------
var BUGNUMBER = 578273;
var summary =
"ES5: Properly detect cycles in JSON.stringify (throw TypeError, check for " +
"cycles rather than imprecisely rely on recursion limits)";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
// objects // objects
@ -101,7 +90,3 @@ catch (e)
assert.sameValue(count, 2, assert.sameValue(count, 2,
"cyclic data structures not detected immediately"); "cyclic data structures not detected immediately");
} }
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.parse handling of omitted arguments
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'parse-arguments.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 653847;
var summary = "JSON.parse handling of omitted arguments";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
try try
{ {
@ -31,7 +21,3 @@ catch (e)
{ {
assert.sameValue(e instanceof SyntaxError, true, "expected syntax error, got: " + e); assert.sameValue(e instanceof SyntaxError, true, "expected syntax error, got: " + e);
} }
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
var str = var str =
'[\n' + '[\n' +
' "JSON Test Pattern pass1",\n' + ' "JSON Test Pattern pass1",\n' +
@ -123,7 +124,3 @@ assert.sameValue(x[16], 1e00);
assert.sameValue(x[17], 2e+00); assert.sameValue(x[17], 2e+00);
assert.sameValue(x[18], 2e-00); assert.sameValue(x[18], 2e-00);
assert.sameValue(x[19], "rosebud"); assert.sameValue(x[19], "rosebud");
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.parse should parse arrays of essentially unlimited size
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'parse-mega-huge-array.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 667527;
var summary = "JSON.parse should parse arrays of essentially unlimited size";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var body = "0,"; var body = "0,";
for (var i = 0; i < 21; i++) for (var i = 0; i < 21; i++)
@ -29,7 +19,3 @@ var str = '[' + body + '0]';
var arr = JSON.parse(str); var arr = JSON.parse(str);
assert.sameValue(arr.length, Math.pow(2, 21) + 1); assert.sameValue(arr.length, Math.pow(2, 21) + 1);
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
var x; var x;
// check an empty object, just for sanity // check an empty object, just for sanity
@ -64,7 +65,3 @@ assert.sameValue(x, "\uabcd");
x = JSON.parse('"\\f"'); x = JSON.parse('"\\f"');
assert.sameValue(x, "\f"); assert.sameValue(x, "\f");
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.parse with a reviver which elides array elements
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'parse-reviver-array-delete.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 999999;
var summary = "JSON.parse with a reviver which elides array elements";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
/* /*
* The reviver deletes all properties from the to-be-returned array. Thus * The reviver deletes all properties from the to-be-returned array. Thus
@ -89,8 +79,3 @@ assert.sameValue(JSON.parse(str,
return undefined; return undefined;
}) + "", }) + "",
expected2); expected2);
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
function doubler(k, v) function doubler(k, v)
{ {
assert.sameValue(typeof k, "string"); assert.sameValue(typeof k, "string");
@ -47,7 +48,3 @@ catch (e)
assert.sameValue(e instanceof SyntaxError, true, "wrong exception: " + e); assert.sameValue(e instanceof SyntaxError, true, "wrong exception: " + e);
} }
assert.sameValue(called, false); assert.sameValue(called, false);
/******************************************************************************/
print("Tests complete");

View File

@ -177,7 +177,3 @@ assert.sameValue(props[1], "The outermost value");
assert.sameValue(x["JSON Test Pattern pass3"]["The outermost value"], assert.sameValue(x["JSON Test Pattern pass3"]["The outermost value"],
"must be an object or array."); "must be an object or array.");
assert.sameValue(x["JSON Test Pattern pass3"]["In this test"], "It is an object."); assert.sameValue(x["JSON Test Pattern pass3"]["In this test"], "It is an object.");
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Stringification of Boolean/String/Number objects
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-boxed-primitives.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary = "Stringification of Boolean/String/Number objects";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
function redefine(obj, prop, fun) function redefine(obj, prop, fun)
{ {
@ -128,7 +118,3 @@ catch (e)
assert.sameValue(e instanceof TypeError, true, assert.sameValue(e instanceof TypeError, true,
"ToString failure, should throw TypeError"); "ToString failure, should throw TypeError");
} }
/******************************************************************************/
print("All tests passed!");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Call replacer function exactly once per value
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-call-replacer-once.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary = "Call replacer function exactly once per value";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var factor = 1; var factor = 1;
function replacer(k, v) function replacer(k, v)
@ -35,7 +25,3 @@ var obj = { a: 1, b: 2, c: 3 };
assert.sameValue(JSON.stringify(obj, replacer), '{"a":2,"b":6,"c":12}'); assert.sameValue(JSON.stringify(obj, replacer), '{"a":2,"b":6,"c":12}');
assert.sameValue(factor, 4); assert.sameValue(factor, 4);
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Stringification of Boolean/String/Number objects
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-call-toJSON-once.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary = "Stringification of Boolean/String/Number objects";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var obj = var obj =
{ {
@ -33,7 +23,3 @@ var obj =
}; };
assert.sameValue(JSON.stringify(obj), '{"p":{}}'); assert.sameValue(JSON.stringify(obj), '{"p":{}}');
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
assert.sameValue(JSON.stringify({foo: 123}), assert.sameValue(JSON.stringify({foo: 123}),
'{"foo":123}'); '{"foo":123}');
assert.sameValue(JSON.stringify({foo: 123, bar: function () {}}), assert.sameValue(JSON.stringify({foo: 123, bar: function () {}}),
@ -22,7 +23,3 @@ assert.sameValue(JSON.stringify([123, function () {}]),
'[123,null]'); '[123,null]');
assert.sameValue(JSON.stringify([123, function () {}, 456]), assert.sameValue(JSON.stringify([123, function () {}, 456]),
'[123,null,456]'); '[123,null,456]');
/******************************************************************************/
print("Tests complete");

View File

@ -8,20 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.stringify(_1, _2, numberGreaterThanOne) produces wrong output
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-gap.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary =
"JSON.stringify(_1, _2, numberGreaterThanOne) produces wrong output";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var LF = "\n"; var LF = "\n";
var GAP = " "; var GAP = " ";
@ -62,7 +51,3 @@ assert.sameValue(JSON.stringify(obj, null, new String(" ")), "[\n--1,\n--2,\n--
Number.prototype.valueOf = function() { return 0; }; Number.prototype.valueOf = function() { return 0; };
assert.sameValue(JSON.stringify(obj, null, new Number(3)), "[1,2,3]"); assert.sameValue(JSON.stringify(obj, null, new Number(3)), "[1,2,3]");
/******************************************************************************/
print("All tests passed!");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending If the toJSON property isn't callable, don't try to call it
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-ignore-noncallable-toJSON.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary = "If the toJSON property isn't callable, don't try to call it";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var obj = var obj =
{ {
@ -29,7 +19,3 @@ var obj =
}; };
assert.sameValue(JSON.stringify(obj), '{"p":{"toJSON":null},"m":{"toJSON":{}}}'); assert.sameValue(JSON.stringify(obj), '{"p":{"toJSON":null},"m":{"toJSON":{}}}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,26 +8,12 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.stringify with a large replacer array
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-large-replacer-array.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 816033;
var summary = "JSON.stringify with a large replacer array";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var replacer = []; var replacer = [];
for (var i = 0; i < 4096; i++) for (var i = 0; i < 4096; i++)
replacer.push(i); replacer.push(i);
assert.sameValue(JSON.stringify({ "foopy": "FAIL", "4093": 17 }, replacer), '{"4093":17}'); assert.sameValue(JSON.stringify({ "foopy": "FAIL", "4093": 17 }, replacer), '{"4093":17}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,22 +8,8 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.stringify with no arguments
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-missing-arguments.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 648471;
var summary = "JSON.stringify with no arguments";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
assert.sameValue(JSON.stringify(), undefined); assert.sameValue(JSON.stringify(), undefined);
/******************************************************************************/
print("All tests passed!");

View File

@ -8,20 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Treat non-array, non-callable replacers as if none had been specified
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-nonarray-noncallable-replacer.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 653782;
var summary =
"Treat non-array, non-callable replacers as if none had been specified";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var obj = { p: 2 }; var obj = { p: 2 };
var str = '{"p":2}'; var str = '{"p":2}';
@ -42,7 +31,3 @@ assert.sameValue(JSON.stringify(obj, /abcd/), str);
assert.sameValue(JSON.stringify(obj, new Boolean(true)), str); assert.sameValue(JSON.stringify(obj, new Boolean(true)), str);
assert.sameValue(JSON.stringify(obj, new Number(42)), str); assert.sameValue(JSON.stringify(obj, new Number(42)), str);
assert.sameValue(JSON.stringify(obj, new String("aequorin")), str); assert.sameValue(JSON.stringify(obj, new String("aequorin")), str);
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
// sanity // sanity
var x = JSON.stringify({}); var x = JSON.stringify({});
assert.sameValue(x, "{}"); assert.sameValue(x, "{}");
@ -41,7 +42,3 @@ assert.sameValue(x, '"asdf"');
assert.sameValue(JSON.stringify(undefined), undefined); assert.sameValue(JSON.stringify(undefined), undefined);
assert.sameValue(JSON.stringify(function(){}), undefined); assert.sameValue(JSON.stringify(function(){}), undefined);
assert.sameValue(JSON.stringify(JSON.stringify), undefined); assert.sameValue(JSON.stringify(JSON.stringify), undefined);
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Boxed-string/number objects in replacer arrays
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-replacer-array-boxed-elements.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 648471;
var summary = "Boxed-string/number objects in replacer arrays";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var S = new String(3); var S = new String(3);
var N = new Number(4); var N = new Number(4);
@ -61,7 +51,3 @@ assert.sameValue(JSON.stringify({ 4: 4, 17: 17 }, [N]),
String.prototype.valueOf = function() { return 42; }; String.prototype.valueOf = function() { return 42; };
assert.sameValue(JSON.stringify({ 3: 3, 42: 42 }, [S]), assert.sameValue(JSON.stringify({ 3: 3, 42: 42 }, [S]),
'{"42":42}'); '{"42":42}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,21 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Better/more correct handling for replacer arrays with getter array index properties
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-replacer-array-hijinks.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 648471;
var summary =
"Better/more correct handling for replacer arrays with getter array index " +
"properties";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var bigOdd = Math.pow(2, 50) + 1; var bigOdd = Math.pow(2, 50) + 1;
@ -70,7 +58,3 @@ assert.sameValue(JSON.stringify({ 1: 1 }, [new String(1), new Number(1)]), '{"1"
assert.sameValue(JSON.stringify({ 1: 1 }, [new Number(1), new String(1)]), '{"1":1}'); assert.sameValue(JSON.stringify({ 1: 1 }, [new Number(1), new String(1)]), '{"1":1}');
assert.sameValue(JSON.stringify({ 1: 1 }, [new Number(1), new Number(1)]), '{"1":1}'); assert.sameValue(JSON.stringify({ 1: 1 }, [new Number(1), new Number(1)]), '{"1":1}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,21 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Better/more correct handling for replacer arrays with getter array index properties
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-replacer-array-edgecase-jsid-elements.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 648471;
var summary =
"Better/more correct handling for replacer arrays with getter array index " +
"properties";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
/* JSID_INT_MIN/MAX copied from jsapi.h. */ /* JSID_INT_MIN/MAX copied from jsapi.h. */
@ -78,7 +66,3 @@ assert.sameValue(JSON.stringify({ "-0": 17, 0: 42 }, ["-0", -0]),
assert.sameValue(JSON.stringify({ "-0": 17, 0: 42 }, [-0, "-0"]), assert.sameValue(JSON.stringify({ "-0": 17, 0: 42 }, [-0, "-0"]),
'{"0":42,"-0":17}', '{"0":42,"-0":17}',
"Failed to stringify number then string properties (-0, '-0) correctly"); "Failed to stringify number then string properties (-0, '-0) correctly");
/******************************************************************************/
print("Tests complete");

View File

@ -8,21 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Better/more correct handling for replacer arrays with getter array index properties
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-replacer-array-hijinks.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 648471;
var summary =
"Better/more correct handling for replacer arrays with getter array index " +
"properties";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var replacer = [0, 1, 2, 3]; var replacer = [0, 1, 2, 3];
Object.prototype[3] = 3; Object.prototype[3] = 3;
@ -60,7 +48,3 @@ Object.defineProperty(replacer, 0, {
// used to determine property names which will be included in the final string. // used to determine property names which will be included in the final string.
assert.sameValue(JSON.stringify({ 0: 0, 1: 1, 2: 2, 3: 3 }, replacer), assert.sameValue(JSON.stringify({ 0: 0, 1: 1, 2: 2, 3: 3 }, replacer),
'{"3":3}'); '{"3":3}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,21 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Better/more correct handling for replacer arrays with getter array index properties
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-replacer-array-skipped-element.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 648471;
var summary =
"Better/more correct handling for replacer arrays with getter array index " +
"properties";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
assert.sameValue(JSON.stringify({ 3: 3, 4: 4 }, assert.sameValue(JSON.stringify({ 3: 3, 4: 4 },
["3", { toString: function() { return "4" } }]), ["3", { toString: function() { return "4" } }]),
@ -63,7 +51,3 @@ assert.sameValue(JSON.stringify({ 3: 3, null: 4 }, ["3", "null", null]),
assert.sameValue(JSON.stringify({ 3: 3, null: 4 }, ["3", null, "null"]), assert.sameValue(JSON.stringify({ 3: 3, null: 4 }, ["3", null, "null"]),
'{"3":3,"null":4}'); '{"3":3,"null":4}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,21 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Better/more correct handling for replacer arrays with trailing holes through which inherited elements might appear
esid: pending esid: pending
---*/ ---*/
var gTestfile = "stringify-replacer-array-trailing-holes.js";
//-----------------------------------------------------------------------------
var BUGNUMBER = 1217069;
var summary =
"Better/more correct handling for replacer arrays with trailing holes " +
"through which inherited elements might appear";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var obj = { 0: "hi", 1: "n-nao", 2: "run away!", 3: "bye" }; var obj = { 0: "hi", 1: "n-nao", 2: "run away!", 3: "bye" };
@ -50,7 +38,3 @@ Object.prototype[3] = 3;
assert.sameValue(JSON.stringify(obj, replacer), assert.sameValue(JSON.stringify(obj, replacer),
'{"0":"hi","1":"n-nao","2":"run away!","3":"bye"}'); '{"0":"hi","1":"n-nao","2":"run away!","3":"bye"}');
/******************************************************************************/
print("Tests complete");

View File

@ -8,20 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Call the replacer function for array elements with stringified indexes
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-replacer-with-array-indexes.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary =
"Call the replacer function for array elements with stringified indexes";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var arr = [0, 1, 2, 3, 4]; var arr = [0, 1, 2, 3, 4];
@ -57,7 +46,3 @@ function replacer()
} }
assert.sameValue(JSON.stringify(arr, replacer), '[0,1,2,3,4]'); assert.sameValue(JSON.stringify(arr, replacer), '[0,1,2,3,4]');
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
/** /**
* These return* functions are used by the * These return* functions are used by the
* replacer tests taken from bug 512447 * replacer tests taken from bug 512447
@ -157,7 +158,3 @@ catch (e)
{ {
assert.sameValue(e instanceof TypeError, true, "no TypeError thrown: " + e); assert.sameValue(e instanceof TypeError, true, "no TypeError thrown: " + e);
} }
/******************************************************************************/
print("Tests complete");

View File

@ -8,20 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending JSON.stringify of \\b\\f\\n\\r\\t should use one-character escapes, not hex
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-special-escapes.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 512266;
var summary =
"JSON.stringify of \\b\\f\\n\\r\\t should use one-character escapes, not hex";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
assert.sameValue(JSON.stringify("\u0000"), '"\\u0000"'); assert.sameValue(JSON.stringify("\u0000"), '"\\u0000"');
assert.sameValue(JSON.stringify("\u0001"), '"\\u0001"'); assert.sameValue(JSON.stringify("\u0001"), '"\\u0001"');
@ -278,7 +267,3 @@ assert.sameValue(JSON.stringify("\udddd\udc00"), '"\\udddd\\udc00"');
assert.sameValue(JSON.stringify("\udeaf\udc00"), '"\\udeaf\\udc00"'); assert.sameValue(JSON.stringify("\udeaf\udc00"), '"\\udeaf\\udc00"');
assert.sameValue(JSON.stringify("\udfff\udc00"), '"\\udfff\\udc00"'); assert.sameValue(JSON.stringify("\udfff\udc00"), '"\\udfff\\udc00"');
assert.sameValue(JSON.stringify("\ue000\udc00"), '"\ue000\\udc00"'); assert.sameValue(JSON.stringify("\ue000\udc00"), '"\ue000\\udc00"');
/******************************************************************************/
print("Tests complete");

View File

@ -8,19 +8,9 @@ includes: [sm/non262.js, sm/non262-shell.js]
flags: flags:
- noStrict - noStrict
description: | description: |
pending Arguments when an object's toJSON method is called
esid: pending esid: pending
---*/ ---*/
var gTestfile = 'stringify-toJSON-arguments.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 584909;
var summary = "Arguments when an object's toJSON method is called";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var obj = var obj =
{ {
@ -35,7 +25,3 @@ var obj =
}; };
assert.sameValue(JSON.stringify(obj), '{"p":17}'); assert.sameValue(JSON.stringify(obj), '{"p":17}');
/******************************************************************************/
print("Tests complete");

View File

@ -9,6 +9,7 @@ description: |
pending pending
esid: pending esid: pending
---*/ ---*/
function assertStringify(v, expect) function assertStringify(v, expect)
{ {
assert.sameValue(JSON.stringify(v), expect); assert.sameValue(JSON.stringify(v), expect);
@ -89,7 +90,3 @@ assertStringify(x, '[1]');
var X = function() { this.a = "b" }; var X = function() { this.a = "b" };
X.prototype = { c: "d" }; X.prototype = { c: "d" };
assertStringify(new X(), '{"a":"b"}'); assertStringify(new X(), '{"a":"b"}');
/******************************************************************************/
print("Tests complete");