built-ins/JSON/*: make all indentation consistent (depth & character) (#1440)

This commit is contained in:
Rick Waldron 2018-02-15 15:25:45 -05:00 committed by Leo Balter
parent ff4f13099c
commit 7c66f39f41
72 changed files with 1046 additions and 861 deletions

View File

@ -10,6 +10,6 @@ es5id: 15.12-0-1
description: JSON must be a built-in object
---*/
var o = JSON;
var o = JSON;
assert.sameValue(typeof(o), "object", 'typeof(o)');

View File

@ -10,7 +10,7 @@ es5id: 15.12-0-2
description: JSON must not support the [[Construct]] method
---*/
var o = JSON;
var o = JSON;
assert.throws(TypeError, function() {
var j = new JSON();
var j = new JSON();
});

View File

@ -10,7 +10,7 @@ es5id: 15.12-0-3
description: JSON must not support the [[Call]] method
---*/
var o = JSON;
var o = JSON;
assert.throws(TypeError, function() {
var j = JSON();
var j = JSON();
});

View File

@ -12,11 +12,11 @@ es5id: 15.12-0-4
description: JSON object's properties must be non enumerable
---*/
var o = JSON;
var i = 0;
for (var p in o) {
i++;
}
var o = JSON;
var i = 0;
for (var p in o) {
i++;
}
assert.sameValue(i, 0, 'i');

View File

@ -7,5 +7,5 @@ description: The JSON lexical grammar treats whitespace as a token seperator
---*/
assert.throws(SyntaxError, function() {
JSON.parse('12\t\r\n 34'); // should produce a syntax error as whitespace results in two tokens
JSON.parse('12\t\r\n 34'); // should produce a syntax error as whitespace results in two tokens
});

View File

@ -9,5 +9,5 @@ description: >
---*/
assert.throws(SyntaxError, function() {
JSON.parse('\u000b1234'); // should produce a syntax error
JSON.parse('\u000b1234'); // should produce a syntax error
});

View File

@ -9,5 +9,5 @@ description: >
---*/
assert.throws(SyntaxError, function() {
JSON.parse('\u000c1234'); // should produce a syntax error
JSON.parse('\u000c1234'); // should produce a syntax error
});

View File

@ -9,5 +9,5 @@ description: >
---*/
assert.throws(SyntaxError, function() {
JSON.parse('\u00a01234'); // should produce a syntax error
JSON.parse('\u00a01234'); // should produce a syntax error
});

View File

@ -9,5 +9,5 @@ description: >
---*/
assert.throws(SyntaxError, function() {
JSON.parse('\u200b1234'); // should produce a syntax error
JSON.parse('\u200b1234'); // should produce a syntax error
});

View File

@ -9,5 +9,5 @@ description: >
---*/
assert.throws(SyntaxError, function() {
JSON.parse('\ufeff1234'); // should produce a syntax error a
JSON.parse('\ufeff1234'); // should produce a syntax error a
});

View File

@ -9,5 +9,5 @@ description: >
---*/
assert.throws(SyntaxError, function() {
JSON.parse('\u2028\u20291234'); // should produce a syntax error
JSON.parse('\u2028\u20291234'); // should produce a syntax error
});

View File

@ -6,8 +6,8 @@ es5id: 15.12.1.1-0-9
description: Whitespace characters can appear before/after any JSONtoken
---*/
JSON.parse('\t\r \n{\t\r \n'+
'"property"\t\r \n:\t\r \n{\t\r \n}\t\r \n,\t\r \n' +
'"prop2"\t\r \n:\t\r \n'+
'[\t\r \ntrue\t\r \n,\t\r \nnull\t\r \n,123.456\t\r \n]'+
'\t\r \n}\t\r \n'); // should JOSN parse without error
JSON.parse('\t\r \n{\t\r \n' +
'"property"\t\r \n:\t\r \n{\t\r \n}\t\r \n,\t\r \n' +
'"prop2"\t\r \n:\t\r \n' +
'[\t\r \ntrue\t\r \n,\t\r \nnull\t\r \n,123.456\t\r \n]' +
'\t\r \n}\t\r \n'); // should JOSN parse without error

View File

@ -17,6 +17,6 @@ es5id: 15.12.2-0-1
description: JSON.parse must exist as a function
---*/
var f = JSON.parse;
var f = JSON.parse;
assert.sameValue(typeof(f), "function", 'typeof(f)');

View File

@ -17,7 +17,7 @@ es5id: 15.12.2-0-2
description: JSON.parse must exist as a function taking 2 parameters
---*/
var f = JSON.parse;
var f = JSON.parse;
assert.sameValue(typeof(f), "function", 'typeof(f)');
assert.sameValue(f.length, 2, 'f.length');

View File

@ -10,7 +10,7 @@ es5id: 15.12.2-0-3
description: JSON.parse must be deletable (configurable)
---*/
var o = JSON;
var desc = Object.getOwnPropertyDescriptor(o, "parse");
var o = JSON;
var desc = Object.getOwnPropertyDescriptor(o, "parse");
assert.sameValue(desc.configurable, true, 'desc.configurable');

View File

@ -8,42 +8,42 @@ description: >
character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + nullChars[index] + ' : "John" } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + nullChars[index] + ' : "John" } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + "Jo" + nullChars[index] + "hn" + ' } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + "Jo" + nullChars[index] + "hn" + ' } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + nullChars[index] + "name" + ' : "John" } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + nullChars[index] + "name" + ' : "John" } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{' + "name" + nullChars[index] + ' : "John" } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{' + "name" + nullChars[index] + ' : "John" } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
with a null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{' + nullChars[index] + "name" + nullChars[index] + ' : "John" } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{' + nullChars[index] + "name" + nullChars[index] + ' : "John" } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + "na" + nullChars[index] + "me" + ' : "John" } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + "na" + nullChars[index] + "me" + ' : "John" } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + ' } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + ' } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + ' } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + ' } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + "John" + nullChars[index] + ' } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + "John" + nullChars[index] + ' } ');
});
}

View File

@ -8,42 +8,42 @@ description: >
ends with a null character
---*/
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
nullChars[2] = '\"\u0002\"';
nullChars[3] = '\"\u0003\"';
nullChars[4] = '\"\u0004\"';
nullChars[5] = '\"\u0005\"';
nullChars[6] = '\"\u0006\"';
nullChars[7] = '\"\u0007\"';
nullChars[8] = '\"\u0008\"';
nullChars[9] = '\"\u0009\"';
nullChars[10] = '\"\u000A\"';
nullChars[11] = '\"\u000B\"';
nullChars[12] = '\"\u000C\"';
nullChars[13] = '\"\u000D\"';
nullChars[14] = '\"\u000E\"';
nullChars[15] = '\"\u000F\"';
nullChars[16] = '\"\u0010\"';
nullChars[17] = '\"\u0011\"';
nullChars[18] = '\"\u0012\"';
nullChars[19] = '\"\u0013\"';
nullChars[20] = '\"\u0014\"';
nullChars[21] = '\"\u0015\"';
nullChars[22] = '\"\u0016\"';
nullChars[23] = '\"\u0017\"';
nullChars[24] = '\"\u0018\"';
nullChars[25] = '\"\u0019\"';
nullChars[26] = '\"\u001A\"';
nullChars[27] = '\"\u001B\"';
nullChars[28] = '\"\u001C\"';
nullChars[29] = '\"\u001D\"';
nullChars[30] = '\"\u001E\"';
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + nullChars[index] + ' } ');
});
}
for (var index in nullChars) {
assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + nullChars[index] + ' } ');
});
}

View File

@ -35,7 +35,10 @@ info: |
features: [Proxy]
---*/
var objectProxy = new Proxy({ length: 0, other: 0 }, {});
var objectProxy = new Proxy({
length: 0,
other: 0
}, {});
var arrayProxy = new Proxy([], {});
var arrayProxyProxy = new Proxy(arrayProxy, {});
var visitedOther, injectProxy;

View File

@ -30,7 +30,9 @@ info: |
features: [Proxy]
---*/
var badDefine = new Proxy({ 0: null }, {
var badDefine = new Proxy({
0: null
}, {
defineProperty: function() {
throw new Test262Error();
}

View File

@ -28,7 +28,9 @@ info: |
features: [Proxy]
---*/
var badDelete = new Proxy({ a: 1 }, {
var badDelete = new Proxy({
a: 1
}, {
deleteProperty: function() {
throw new Test262Error();
}

View File

@ -17,6 +17,6 @@ es5id: 15.12.3-0-1
description: JSON.stringify must exist as be a function
---*/
var f = JSON.stringify;
var f = JSON.stringify;
assert.sameValue(typeof(f), "function", 'typeof(f)');

View File

@ -17,7 +17,7 @@ es5id: 15.12.3-0-2
description: JSON.stringify must exist as be a function taking 3 parameters
---*/
var f = JSON.stringify;
var f = JSON.stringify;
assert.sameValue(typeof(f), "function", 'typeof(f)');
assert.sameValue(f.length, 3, 'f.length');

View File

@ -10,7 +10,7 @@ es5id: 15.12.3-0-3
description: JSON.stringify must be deletable (configurable)
---*/
var o = JSON;
var desc = Object.getOwnPropertyDescriptor(o, "stringify");
var o = JSON;
var desc = Object.getOwnPropertyDescriptor(o, "stringify");
assert.sameValue(desc.configurable, true, 'desc.configurable');

View File

@ -8,4 +8,6 @@ description: >
value can return undefined.
---*/
assert.sameValue(JSON.stringify(42, function(k, v) { return undefined }), undefined, 'JSON.stringify(42, function(k, v) { return undefined })');
assert.sameValue(JSON.stringify(42, function(k, v) {
return undefined
}), undefined, 'JSON.stringify(42, function(k, v) { return undefined })');

View File

@ -8,4 +8,8 @@ description: >
can return undefined.
---*/
assert.sameValue(JSON.stringify({prop:1}, function(k, v) { return undefined }), undefined, 'JSON.stringify({prop:1}, function(k, v) { return undefined })');
assert.sameValue(JSON.stringify({
prop: 1
}, function(k, v) {
return undefined
}), undefined, 'JSON.stringify({prop:1}, function(k, v) { return undefined })');

View File

@ -8,4 +8,6 @@ description: >
can return an Array.
---*/
assert.sameValue(JSON.stringify(42, function(k, v) { return v==42 ?[4,2]:v }), '[4,2]', 'JSON.stringify(42, function(k, v) { return v==42 ?[4,2]:v })');
assert.sameValue(JSON.stringify(42, function(k, v) {
return v == 42 ? [4, 2] : v
}), '[4,2]', 'JSON.stringify(42, function(k, v) { return v==42 ?[4,2]:v })');

View File

@ -8,4 +8,8 @@ description: >
can return an Object.
---*/
assert.sameValue(JSON.stringify(42, function(k, v) { return v==42 ? {forty:2}: v}), '{"forty":2}', 'JSON.stringify(42, function(k, v) { return v==42 ? {forty:2}: v})');
assert.sameValue(JSON.stringify(42, function(k, v) {
return v == 42 ? {
forty: 2
} : v
}), '{"forty":2}', 'JSON.stringify(42, function(k, v) { return v==42 ? {forty:2}: v})');

View File

@ -8,4 +8,6 @@ description: >
returns the replacer value.
---*/
assert.sameValue(JSON.stringify(function() {}, function(k,v) {return 99}), '99', 'JSON.stringify(function() {}, function(k,v) {return 99})');
assert.sameValue(JSON.stringify(function() {}, function(k, v) {
return 99
}), '99', 'JSON.stringify(function() {}, function(k,v) {return 99})');

View File

@ -9,46 +9,48 @@ description: >
step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fname": "John" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fname": "John"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "name\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"name\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
operation Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fname\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fname\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -8,4 +8,6 @@ description: >
undefined value.
---*/
assert.sameValue(JSON.stringify(undefined, function(k, v) { return "replacement" }), '"replacement"', 'JSON.stringify(undefined, function(k, v) { return "replacement" })');
assert.sameValue(JSON.stringify(undefined, function(k, v) {
return "replacement"
}), '"replacement"', 'JSON.stringify(undefined, function(k, v) { return "replacement" })');

View File

@ -9,46 +9,48 @@ description: >
operation Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "na\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fme": "John" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"na\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fme": "John"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
operation Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001FJohn" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001FJohn"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "name": "John\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"name": "John\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
operation Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001FJohn\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001FJohn\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -9,46 +9,48 @@ description: >
operation Quote(value) step 2.c)
---*/
var result = true;
var result = true;
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f";
for (var index in expectedNullChars) {
for (var index in expectedNullChars) {
var str = JSON.stringify({ "name": "Jo\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fhn" });
result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1);
}
var str = JSON.stringify({
"name": "Jo\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fhn"
});
result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1);
}
assert(result, 'result !== true');

View File

@ -8,11 +8,11 @@ description: >
abstract operation JA(value) step 10.b.iii)
---*/
var arrObj = [];
arrObj[0] = "a";
arrObj[1] = "b";
arrObj[2] = "c";
var arrObj = [];
arrObj[0] = "a";
arrObj[1] = "b";
arrObj[2] = "c";
var jsonText = JSON.stringify(arrObj, undefined, "").toString();
var jsonText = JSON.stringify(arrObj, undefined, "").toString();
assert.sameValue(jsonText.charAt(jsonText.length - 1), "]", 'jsonText.charAt(jsonText.length - 1)');

View File

@ -8,4 +8,4 @@ description: >
or arrays..
---*/
assert.sameValue(JSON.stringify([42],{}), '[42]', 'JSON.stringify([42],{})');
assert.sameValue(JSON.stringify([42], {}), '[42]', 'JSON.stringify([42],{})');

View File

@ -8,6 +8,15 @@ description: >
Number values
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj,null, new Number(5)), JSON.stringify(obj,null, 5), 'JSON.stringify(obj,null, new Number(5))');
assert.sameValue(JSON.stringify(obj, null, new Number(5)), JSON.stringify(obj, null, 5), 'JSON.stringify(obj,null, new Number(5))');

View File

@ -8,6 +8,15 @@ description: >
String values
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj,null, new String('xxx')), JSON.stringify(obj,null, 'xxx'), 'JSON.stringify(obj,null, new String("xxx"))');
assert.sameValue(JSON.stringify(obj, null, new String('xxx')), JSON.stringify(obj, null, 'xxx'), 'JSON.stringify(obj,null, new String("xxx"))');

View File

@ -8,6 +8,15 @@ description: >
same as a space argument of 10.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj,null, 10), JSON.stringify(obj,null, 100), 'JSON.stringify(obj,null, 10)');
assert.sameValue(JSON.stringify(obj, null, 10), JSON.stringify(obj, null, 100), 'JSON.stringify(obj,null, 10)');

View File

@ -8,6 +8,15 @@ description: >
their integer part.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj,null, 5.99999), JSON.stringify(obj,null, 5), 'JSON.stringify(obj,null, 5.99999)');
assert.sameValue(JSON.stringify(obj, null, 5.99999), JSON.stringify(obj, null, 5), 'JSON.stringify(obj,null, 5.99999)');

View File

@ -8,7 +8,16 @@ description: >
(0.999999)the same as empty string space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
/* empty string should be same as no space arg */
assert.sameValue(JSON.stringify(obj,null, 0.999999), JSON.stringify(obj));
assert.sameValue(JSON.stringify(obj, null, 0.999999), JSON.stringify(obj));

View File

@ -8,7 +8,16 @@ description: >
same as empty string space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
/* empty string should be same as no space arg */
assert.sameValue(JSON.stringify(obj,null, 0), JSON.stringify(obj));
assert.sameValue(JSON.stringify(obj, null, 0), JSON.stringify(obj));

View File

@ -8,7 +8,16 @@ description: >
same as empty string space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
/* empty string should be same as no space arg */
assert.sameValue(JSON.stringify(obj,null, -5), JSON.stringify(obj));
/* empty string should be same as no space arg */
assert.sameValue(JSON.stringify(obj, null, -5), JSON.stringify(obj));

View File

@ -8,8 +8,17 @@ description: >
is equivalent to a string of spaces of that length.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var fiveSpaces = ' ';
// '12345'
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
var fiveSpaces = ' ';
// '12345'
assert.sameValue(JSON.stringify(obj,null, 5), JSON.stringify(obj, null, fiveSpaces), 'JSON.stringify(obj,null, 5)');
assert.sameValue(JSON.stringify(obj, null, 5), JSON.stringify(obj, null, fiveSpaces), 'JSON.stringify(obj,null, 5)');

View File

@ -8,6 +8,15 @@ description: >
arguments.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj,null, '0123456789xxxxxxxxx'), JSON.stringify(obj,null, '0123456789'), 'JSON.stringify(obj,null, "0123456789xxxxxxxxx")');
assert.sameValue(JSON.stringify(obj, null, '0123456789xxxxxxxxx'), JSON.stringify(obj, null, '0123456789'), 'JSON.stringify(obj,null, "0123456789xxxxxxxxx")');

View File

@ -8,6 +8,15 @@ description: >
missing space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, ''), 'JSON.stringify(obj)');
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj, null, ''), 'JSON.stringify(obj)');

View File

@ -8,6 +8,15 @@ description: >
missing space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, true), 'JSON.stringify(obj)');
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj, null, true), 'JSON.stringify(obj)');

View File

@ -8,6 +8,15 @@ description: >
space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, null), 'JSON.stringify(obj)');
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj, null, null), 'JSON.stringify(obj)');

View File

@ -8,6 +8,15 @@ description: >
as a missing space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, new Boolean(true)), 'JSON.stringify(obj)');
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj, null, new Boolean(true)), 'JSON.stringify(obj)');

View File

@ -8,6 +8,15 @@ description: >
the same as a missing space argument.
---*/
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var obj = {
a1: {
b1: [1, 2, 3, 4],
b2: {
c1: 1,
c2: 2
}
},
a2: 'a2'
};
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, obj), 'JSON.stringify(obj)');
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj, null, obj), 'JSON.stringify(obj)');

View File

@ -8,9 +8,11 @@ description: >
toJSON call to literal strings.
---*/
var obj = {
prop:42,
toJSON: function () {return 'fortytwo objects'}
};
var obj = {
prop: 42,
toJSON: function() {
return 'fortytwo objects'
}
};
assert.sameValue(JSON.stringify([obj]), '["fortytwo objects"]', 'JSON.stringify([obj])');

View File

@ -8,9 +8,11 @@ description: >
toJSON call to literal Number.
---*/
var obj = {
prop:42,
toJSON: function () {return new Number(42)}
};
var obj = {
prop: 42,
toJSON: function() {
return new Number(42)
}
};
assert.sameValue(JSON.stringify([obj]), '[42]', 'JSON.stringify([obj])');

View File

@ -8,9 +8,11 @@ description: >
toJSON call to literal Boolean values.
---*/
var obj = {
prop:42,
toJSON: function () {return new Boolean(true)}
};
var obj = {
prop: 42,
toJSON: function() {
return new Boolean(true)
}
};
assert.sameValue(JSON.stringify([obj]), '[true]', 'JSON.stringify([obj])');

View File

@ -8,4 +8,6 @@ description: >
replacer functions to literal strings.
---*/
assert.sameValue(JSON.stringify([42], function(k,v) {return v===42? new String('fortytwo'):v}), '["fortytwo"]', 'JSON.stringify([42], function(k,v) {return v===42? new String("fortytwo"):v})');
assert.sameValue(JSON.stringify([42], function(k, v) {
return v === 42 ? new String('fortytwo') : v
}), '["fortytwo"]', 'JSON.stringify([42], function(k,v) {return v===42? new String("fortytwo"):v})');

View File

@ -8,4 +8,6 @@ description: >
replacer functions to literal numbers.
---*/
assert.sameValue(JSON.stringify([42], function(k,v) {return v===42? new Number(84):v}), '[84]', 'JSON.stringify([42], function(k,v) {return v===42? new Number(84):v})');
assert.sameValue(JSON.stringify([42], function(k, v) {
return v === 42 ? new Number(84) : v
}), '[84]', 'JSON.stringify([42], function(k,v) {return v===42? new Number(84):v})');

View File

@ -8,4 +8,6 @@ description: >
replacer functions to literal numbers.
---*/
assert.sameValue(JSON.stringify([42], function(k,v) {return v===42? new Boolean(false):v}), '[false]', 'JSON.stringify([42], function(k,v) {return v===42? new Boolean(false):v})');
assert.sameValue(JSON.stringify([42], function(k, v) {
return v === 42 ? new Boolean(false) : v
}), '[false]', 'JSON.stringify([42], function(k,v) {return v===42? new Boolean(false):v})');

View File

@ -6,9 +6,9 @@ es5id: 15.12.3_4-1-1
description: JSON.stringify a circular object throws a error
---*/
var obj = {};
obj.prop = obj;
var obj = {};
obj.prop = obj;
assert.throws(TypeError, function() {
JSON.stringify(obj);
JSON.stringify(obj);
});

View File

@ -6,9 +6,9 @@ es5id: 15.12.3_4-1-2
description: JSON.stringify a circular object throws a TypeError
---*/
var obj = {};
obj.prop = obj;
var obj = {};
obj.prop = obj;
assert.throws(TypeError, function() {
JSON.stringify(obj);
JSON.stringify(obj);
});

View File

@ -6,9 +6,13 @@ es5id: 15.12.3_4-1-3
description: JSON.stringify a indirectly circular object throws a error
---*/
var obj = {p1: {p2: {}}};
obj.p1.p2.prop = obj;
var obj = {
p1: {
p2: {}
}
};
obj.p1.p2.prop = obj;
assert.throws(TypeError, function() {
JSON.stringify(obj);
JSON.stringify(obj);
});