Skip to content
Snippets Groups Projects
Commit 8ea6a7e3 authored by André Bargull's avatar André Bargull
Browse files

Replace runTestCase with assert helpers [test/built-ins/JSON]

parent bec87829
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 70 deletions
......@@ -6,11 +6,8 @@ es5id: 15.12.3-5-a-i-1
description: >
JSON.stringify converts Number wrapper object space aruguments to
Number values
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj,null, new Number(5))=== JSON.stringify(obj,null, 5);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj,null, new Number(5)), JSON.stringify(obj,null, 5), 'JSON.stringify(obj,null, new Number(5))');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-5-b-i-1
description: >
JSON.stringify converts String wrapper object space aruguments to
String values
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj,null, new String('xxx'))=== JSON.stringify(obj,null, 'xxx');
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj,null, new String('xxx')), JSON.stringify(obj,null, 'xxx'), 'JSON.stringify(obj,null, new String("xxx"))');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-6-a-1
description: >
JSON.stringify treats numeric space arguments greater than 10 the
same as a space argument of 10.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj,null, 10)=== JSON.stringify(obj,null, 100);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj,null, 10), JSON.stringify(obj,null, 100), 'JSON.stringify(obj,null, 10)');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-6-a-2
description: >
JSON.stringify truccates non-integer numeric space arguments to
their integer part.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj,null, 5.99999)=== JSON.stringify(obj,null, 5);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj,null, 5.99999), JSON.stringify(obj,null, 5), 'JSON.stringify(obj,null, 5.99999)');
......@@ -6,13 +6,10 @@ es5id: 15.12.3-6-b-4
description: >
JSON.stringify treats numeric space arguments (in the range 1..10)
is equivalent to a string of spaces of that length.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
var fiveSpaces = ' ';
// '12345'
return JSON.stringify(obj,null, 5)=== JSON.stringify(obj, null, fiveSpaces);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj,null, 5), JSON.stringify(obj, null, fiveSpaces), 'JSON.stringify(obj,null, 5)');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-7-a-1
description: >
JSON.stringify only uses the first 10 characters of a string space
arguments.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj,null, '0123456789xxxxxxxxx')=== JSON.stringify(obj,null, '0123456789');
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj,null, '0123456789xxxxxxxxx'), JSON.stringify(obj,null, '0123456789'), 'JSON.stringify(obj,null, "0123456789xxxxxxxxx")');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-8-a-1
description: >
JSON.stringify treats an empty string space argument the same as a
missing space argument.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj)=== JSON.stringify(obj,null, '');
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, ''), 'JSON.stringify(obj)');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-8-a-2
description: >
JSON.stringify treats an Boolean space argument the same as a
missing space argument.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj)=== JSON.stringify(obj,null, true);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, true), 'JSON.stringify(obj)');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-8-a-3
description: >
JSON.stringify treats an null space argument the same as a missing
space argument.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj)=== JSON.stringify(obj,null, null);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, null), 'JSON.stringify(obj)');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-8-a-4
description: >
JSON.stringify treats an Boolean wrapper space argument the same
as a missing space argument.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj)=== JSON.stringify(obj,null, new Boolean(true));
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, new Boolean(true)), 'JSON.stringify(obj)');
......@@ -6,11 +6,8 @@ es5id: 15.12.3-8-a-5
description: >
JSON.stringify treats non-Number or String object space arguments
the same as a missing space argument.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
return JSON.stringify(obj)=== JSON.stringify(obj,null, obj);
}
runTestCase(testcase);
assert.sameValue(JSON.stringify(obj), JSON.stringify(obj,null, obj), 'JSON.stringify(obj)');
......@@ -6,14 +6,11 @@ es5id: 15.12.3_2-2-b-i-1
description: >
JSON.stringify converts string wrapper objects returned from a
toJSON call to literal strings.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {
prop:42,
toJSON: function () {return 'fortytwo objects'}
};
return JSON.stringify([obj]) === '["fortytwo objects"]';
}
runTestCase(testcase);
assert.sameValue(JSON.stringify([obj]), '["fortytwo objects"]', 'JSON.stringify([obj])');
......@@ -6,14 +6,11 @@ es5id: 15.12.3_2-2-b-i-2
description: >
JSON.stringify converts Number wrapper objects returned from a
toJSON call to literal Number.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {
prop:42,
toJSON: function () {return new Number(42)}
};
return JSON.stringify([obj]) === '[42]';
}
runTestCase(testcase);
assert.sameValue(JSON.stringify([obj]), '[42]', 'JSON.stringify([obj])');
......@@ -6,14 +6,11 @@ es5id: 15.12.3_2-2-b-i-3
description: >
JSON.stringify converts Boolean wrapper objects returned from a
toJSON call to literal Boolean values.
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {
prop:42,
toJSON: function () {return new Boolean(true)}
};
return JSON.stringify([obj]) === '[true]';
}
runTestCase(testcase);
assert.sameValue(JSON.stringify([obj]), '[true]', 'JSON.stringify([obj])');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment