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 description: JSON must be a built-in object
---*/ ---*/
var o = JSON; var o = JSON;
assert.sameValue(typeof(o), "object", 'typeof(o)'); 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 description: JSON must not support the [[Construct]] method
---*/ ---*/
var o = JSON; var o = JSON;
assert.throws(TypeError, function() { 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 description: JSON must not support the [[Call]] method
---*/ ---*/
var o = JSON; var o = JSON;
assert.throws(TypeError, function() { 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 description: JSON object's properties must be non enumerable
---*/ ---*/
var o = JSON; var o = JSON;
var i = 0; var i = 0;
for (var p in o) { for (var p in o) {
i++; i++;
} }
assert.sameValue(i, 0, '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() { 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() { 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() { 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() { 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() { 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() { 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() { 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 description: Whitespace characters can appear before/after any JSONtoken
---*/ ---*/
JSON.parse('\t\r \n{\t\r \n'+ JSON.parse('\t\r \n{\t\r \n' +
'"property"\t\r \n:\t\r \n{\t\r \n}\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'+ '"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 \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 '\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 description: JSON.parse must exist as a function
---*/ ---*/
var f = JSON.parse; var f = JSON.parse;
assert.sameValue(typeof(f), "function", 'typeof(f)'); 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 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(typeof(f), "function", 'typeof(f)');
assert.sameValue(f.length, 2, 'f.length'); 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) description: JSON.parse must be deletable (configurable)
---*/ ---*/
var o = JSON; var o = JSON;
var desc = Object.getOwnPropertyDescriptor(o, "parse"); var desc = Object.getOwnPropertyDescriptor(o, "parse");
assert.sameValue(desc.configurable, true, 'desc.configurable'); assert.sameValue(desc.configurable, true, 'desc.configurable');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,6 +17,6 @@ es5id: 15.12.3-0-1
description: JSON.stringify must exist as be a function description: JSON.stringify must exist as be a function
---*/ ---*/
var f = JSON.stringify; var f = JSON.stringify;
assert.sameValue(typeof(f), "function", 'typeof(f)'); 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 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(typeof(f), "function", 'typeof(f)');
assert.sameValue(f.length, 3, 'f.length'); 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) description: JSON.stringify must be deletable (configurable)
---*/ ---*/
var o = JSON; var o = JSON;
var desc = Object.getOwnPropertyDescriptor(o, "stringify"); var desc = Object.getOwnPropertyDescriptor(o, "stringify");
assert.sameValue(desc.configurable, true, 'desc.configurable'); assert.sameValue(desc.configurable, true, 'desc.configurable');

View File

@ -8,4 +8,6 @@ description: >
value can return undefined. 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. 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. 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. 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. 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) step 2.c)
---*/ ---*/
var result = true; var result = true;
var expectedNullChars = new Array(); var expectedNullChars = new Array();
expectedNullChars[0] = "\\u0000"; expectedNullChars[0] = "\\u0000";
expectedNullChars[1] = "\\u0001"; expectedNullChars[1] = "\\u0001";
expectedNullChars[2] = "\\u0002"; expectedNullChars[2] = "\\u0002";
expectedNullChars[3] = "\\u0003"; expectedNullChars[3] = "\\u0003";
expectedNullChars[4] = "\\u0004"; expectedNullChars[4] = "\\u0004";
expectedNullChars[5] = "\\u0005"; expectedNullChars[5] = "\\u0005";
expectedNullChars[6] = "\\u0006"; expectedNullChars[6] = "\\u0006";
expectedNullChars[7] = "\\u0007"; expectedNullChars[7] = "\\u0007";
expectedNullChars[8] = "\\b"; expectedNullChars[8] = "\\b";
expectedNullChars[9] = "\\t"; expectedNullChars[9] = "\\t";
expectedNullChars[10] = "\\n"; expectedNullChars[10] = "\\n";
expectedNullChars[11] = "\\u000b"; expectedNullChars[11] = "\\u000b";
expectedNullChars[12] = "\\f"; expectedNullChars[12] = "\\f";
expectedNullChars[13] = "\\r"; expectedNullChars[13] = "\\r";
expectedNullChars[14] = "\\u000e"; expectedNullChars[14] = "\\u000e";
expectedNullChars[15] = "\\u000f"; expectedNullChars[15] = "\\u000f";
expectedNullChars[16] = "\\u0010"; expectedNullChars[16] = "\\u0010";
expectedNullChars[17] = "\\u0011"; expectedNullChars[17] = "\\u0011";
expectedNullChars[18] = "\\u0012"; expectedNullChars[18] = "\\u0012";
expectedNullChars[19] = "\\u0013"; expectedNullChars[19] = "\\u0013";
expectedNullChars[20] = "\\u0014"; expectedNullChars[20] = "\\u0014";
expectedNullChars[21] = "\\u0015"; expectedNullChars[21] = "\\u0015";
expectedNullChars[22] = "\\u0016"; expectedNullChars[22] = "\\u0016";
expectedNullChars[23] = "\\u0017"; expectedNullChars[23] = "\\u0017";
expectedNullChars[24] = "\\u0018"; expectedNullChars[24] = "\\u0018";
expectedNullChars[25] = "\\u0019"; expectedNullChars[25] = "\\u0019";
expectedNullChars[26] = "\\u001a"; expectedNullChars[26] = "\\u001a";
expectedNullChars[27] = "\\u001b"; expectedNullChars[27] = "\\u001b";
expectedNullChars[28] = "\\u001c"; expectedNullChars[28] = "\\u001c";
expectedNullChars[29] = "\\u001d"; expectedNullChars[29] = "\\u001d";
expectedNullChars[30] = "\\u001e"; expectedNullChars[30] = "\\u001e";
expectedNullChars[31] = "\\u001f"; 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" }); var str = JSON.stringify({
result = (result && str.indexOf(expectedNullChars[index]) !== -1); "\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'); assert(result, 'result !== true');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,4 +8,4 @@ description: >
or arrays.. 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 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 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. 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. 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. (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 */ /* 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. 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 */ /* 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. 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 */ /* empty string should be same as no space arg */
assert.sameValue(JSON.stringify(obj,null, -5), JSON.stringify(obj)); 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. 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 obj = {
var fiveSpaces = ' '; a1: {
// '12345' 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. 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. 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. 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. 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. 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. 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. toJSON call to literal strings.
---*/ ---*/
var obj = { var obj = {
prop:42, prop: 42,
toJSON: function () {return 'fortytwo objects'} toJSON: function() {
}; return 'fortytwo objects'
}
};
assert.sameValue(JSON.stringify([obj]), '["fortytwo objects"]', 'JSON.stringify([obj])'); assert.sameValue(JSON.stringify([obj]), '["fortytwo objects"]', 'JSON.stringify([obj])');

View File

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

View File

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

View File

@ -8,4 +8,6 @@ description: >
replacer functions to literal strings. 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. 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. 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 description: JSON.stringify a circular object throws a error
---*/ ---*/
var obj = {}; var obj = {};
obj.prop = obj; obj.prop = obj;
assert.throws(TypeError, function() { 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 description: JSON.stringify a circular object throws a TypeError
---*/ ---*/
var obj = {}; var obj = {};
obj.prop = obj; obj.prop = obj;
assert.throws(TypeError, function() { 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 description: JSON.stringify a indirectly circular object throws a error
---*/ ---*/
var obj = {p1: {p2: {}}}; var obj = {
obj.p1.p2.prop = obj; p1: {
p2: {}
}
};
obj.p1.p2.prop = obj;
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
JSON.stringify(obj); JSON.stringify(obj);
}); });