summaryrefslogtreecommitdiff
path: root/test/built-ins/JSON
diff options
context:
space:
mode:
authorAndré Bargull <andre.bargull@gmail.com>2015-08-13 17:56:55 +0200
committerAndré Bargull <andre.bargull@gmail.com>2015-08-13 17:57:23 +0200
commit4ec97779fdea46207c589dbe36f41785343a61a8 (patch)
tree031e2fc65c79fd3755cf4e61f0abee44e035ac3f /test/built-ins/JSON
parent1b14708467b4cab8055effad884071123637e475 (diff)
downloadqtdeclarative-testsuites-4ec97779fdea46207c589dbe36f41785343a61a8.tar.gz
Replace runTestCase with assert helpers, rest [test/built-ins]
Diffstat (limited to 'test/built-ins/JSON')
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-1.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-2.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-3.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-4.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-5.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-6.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-7.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-0-8.js12
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g1-1.js16
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g1-2.js16
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g1-3.js16
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g1-4.js16
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g2-2.js13
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g2-3.js13
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g2-4.js13
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g4-1.js11
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g4-2.js11
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g4-3.js11
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g4-4.js11
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g5-2.js11
-rw-r--r--test/built-ins/JSON/parse/15.12.1.1-g5-3.js11
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-1.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-10.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-2.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-3.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-4.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-5.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-6.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-7.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-8.js15
-rw-r--r--test/built-ins/JSON/parse/15.12.2-2-9.js15
-rw-r--r--test/built-ins/JSON/stringify/15.12.3-6-b-1.js10
-rw-r--r--test/built-ins/JSON/stringify/15.12.3-6-b-2.js10
-rw-r--r--test/built-ins/JSON/stringify/15.12.3-6-b-3.js10
-rw-r--r--test/built-ins/JSON/stringify/15.12.3_4-1-1.js11
-rw-r--r--test/built-ins/JSON/stringify/15.12.3_4-1-2.js11
-rw-r--r--test/built-ins/JSON/stringify/15.12.3_4-1-3.js11
37 files changed, 98 insertions, 380 deletions
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-1.js b/test/built-ins/JSON/parse/15.12.1.1-0-1.js
index 003fcf02f..d1bb9eecd 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-1.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-1.js
@@ -4,16 +4,8 @@
/*---
es5id: 15.12.1.1-0-1
description: The JSON lexical grammar treats whitespace as a token seperator
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('12\t\r\n 34'); // should produce a syntax error as whitespace results in two tokens
- }
- catch (e) {
- if (e.name === 'SyntaxError') return true;
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-2.js b/test/built-ins/JSON/parse/15.12.1.1-0-2.js
index 76e5cd179..8254a4d62 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-2.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-2.js
@@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-2
description: >
<VT> is not valid JSON whitespace as specified by the production
JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('\u000b1234'); // should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-3.js b/test/built-ins/JSON/parse/15.12.1.1-0-3.js
index 38c7b6947..fb213cb00 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-3.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-3.js
@@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-3
description: >
<FF> is not valid JSON whitespace as specified by the production
JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('\u000c1234'); // should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-4.js b/test/built-ins/JSON/parse/15.12.1.1-0-4.js
index 6a7d75a21..34b31816c 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-4.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-4.js
@@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-4
description: >
<NBSP> is not valid JSON whitespace as specified by the production
JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('\u00a01234'); // should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-5.js b/test/built-ins/JSON/parse/15.12.1.1-0-5.js
index 0655622a1..e18222fd2 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-5.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-5.js
@@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-5
description: >
<ZWSPP> is not valid JSON whitespace as specified by the
production JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('\u200b1234'); // should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-6.js b/test/built-ins/JSON/parse/15.12.1.1-0-6.js
index eb0a10a95..cfaf7d050 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-6.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-6.js
@@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-6
description: >
<BOM> is not valid JSON whitespace as specified by the production
JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('\ufeff1234'); // should produce a syntax error a
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-7.js b/test/built-ins/JSON/parse/15.12.1.1-0-7.js
index 25aee06eb..25e408786 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-7.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-7.js
@@ -6,17 +6,9 @@ es5id: 15.12.1.1-0-7
description: >
other category z spaces are not valid JSON whitespace as specified
by the production JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
// the following should produce a syntax error
JSON.parse('\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u30001234');
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-8.js b/test/built-ins/JSON/parse/15.12.1.1-0-8.js
index 6b1d7360f..fa7bb87b3 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-0-8.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-0-8.js
@@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-8
description: >
U+2028 and U+2029 are not valid JSON whitespace as specified by
the production JSONWhitespace.
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('\u2028\u20291234'); // should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-1.js b/test/built-ins/JSON/parse/15.12.1.1-g1-1.js
index 9cc442b58..4325a2899 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g1-1.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g1-1.js
@@ -4,16 +4,10 @@
/*---
es5id: 15.12.1.1-g1-1
description: The JSON lexical grammar treats <TAB> as a whitespace character
-includes: [runTestCase.js]
---*/
-function testcase() {
- if (JSON.parse('\t1234')!==1234) return false; // <TAB> should be ignored
- try {
- JSON.parse('12\t34'); // <TAB> should produce a syntax error as whitespace results in two tokens
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+assert.sameValue(JSON.parse('\t1234'), 1234, '<TAB> should be ignored');
+
+assert.throws(SyntaxError, function() {
+ JSON.parse('12\t34');
+}, '<TAB> should produce a syntax error as whitespace results in two tokens');
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-2.js b/test/built-ins/JSON/parse/15.12.1.1-g1-2.js
index aa1f04d21..4c71c01a7 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g1-2.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g1-2.js
@@ -4,16 +4,10 @@
/*---
es5id: 15.12.1.1-g1-2
description: The JSON lexical grammar treats <CR> as a whitespace character
-includes: [runTestCase.js]
---*/
-function testcase() {
- if (JSON.parse('\r1234')!==1234) return false; // <cr> should be ignored
- try {
- JSON.parse('12\r34'); // <CR> should produce a syntax error as whitespace results in two tokens
- }
- catch (e) {
- if (e.name === 'SyntaxError') return true;
- }
- }
-runTestCase(testcase);
+assert.sameValue(JSON.parse('\r1234'), 1234, '<cr> should be ignored');
+
+assert.throws(SyntaxError, function() {
+ JSON.parse('12\r34');
+}, '<CR> should produce a syntax error as whitespace results in two tokens');
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-3.js b/test/built-ins/JSON/parse/15.12.1.1-g1-3.js
index 8e30dac0a..80e533c41 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g1-3.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g1-3.js
@@ -4,16 +4,10 @@
/*---
es5id: 15.12.1.1-g1-3
description: The JSON lexical grammar treats <LF> as a whitespace character
-includes: [runTestCase.js]
---*/
-function testcase() {
- if (JSON.parse('\n1234')!==1234) return false; // <LF> should be ignored
- try {
- JSON.parse('12\n34'); // <LF> should produce a syntax error as whitespace results in two tokens
- }
- catch (e) {
- if (e.name === 'SyntaxError') return true;
- }
- }
-runTestCase(testcase);
+assert.sameValue(JSON.parse('\n1234'), 1234, '<LF> should be ignored');
+
+assert.throws(SyntaxError, function() {
+ JSON.parse('12\n34');
+}, '<LF> should produce a syntax error as whitespace results in two tokens');
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-4.js b/test/built-ins/JSON/parse/15.12.1.1-g1-4.js
index 3b1494c0e..b00e82b55 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g1-4.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g1-4.js
@@ -4,16 +4,10 @@
/*---
es5id: 15.12.1.1-g1-4
description: The JSON lexical grammar treats <SP> as a whitespace character
-includes: [runTestCase.js]
---*/
-function testcase() {
- if (JSON.parse(' 1234')!=1234) return false; // <SP> should be ignored
- try {
- JSON.parse('12 34'); // <SP> should produce a syntax error as whitespace results in two tokens
- }
- catch (e) {
- if (e.name === 'SyntaxError') return true;
- }
- }
-runTestCase(testcase);
+assert.sameValue(JSON.parse(' 1234'), 1234, '<SP> should be ignored');
+
+assert.throws(SyntaxError, function() {
+ JSON.parse('12 34');
+}, '<SP> should produce a syntax error as whitespace results in two tokens');
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g2-2.js b/test/built-ins/JSON/parse/15.12.1.1-g2-2.js
index 4e5be737a..dcef87ac5 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g2-2.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g2-2.js
@@ -4,15 +4,8 @@
/*---
es5id: 15.12.1.1-g2-2
description: A JSONString may not be delimited by single quotes
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
- if (JSON.parse("'abc'") ==='abc') return false;
- }
- catch (e) {
- return true;
- }
- }
-runTestCase(testcase);
+assert.throws(SyntaxError, function() {
+ JSON.parse("'abc'");
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g2-3.js b/test/built-ins/JSON/parse/15.12.1.1-g2-3.js
index 93c6de5a3..4809d4225 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g2-3.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g2-3.js
@@ -4,15 +4,8 @@
/*---
es5id: 15.12.1.1-g2-3
description: A JSONString may not be delimited by Uncode escaped quotes
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
- if (JSON.parse("\\u0022abc\\u0022") ==='abc') return false;
- }
- catch (e) {
- return true;
- }
- }
-runTestCase(testcase);
+assert.throws(SyntaxError, function() {
+ JSON.parse("\\u0022abc\\u0022");
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g2-4.js b/test/built-ins/JSON/parse/15.12.1.1-g2-4.js
index 54492523d..cf4a5d47f 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g2-4.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g2-4.js
@@ -4,15 +4,8 @@
/*---
es5id: 15.12.1.1-g2-4
description: A JSONString must both begin and end with double quotes
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
- if (JSON.parse('"ab'+"c'") ==='abc') return false;
- }
- catch (e) {
- return true;
- }
- }
-runTestCase(testcase);
+assert.throws(SyntaxError, function() {
+ JSON.parse('"ab'+"c'");
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-1.js b/test/built-ins/JSON/parse/15.12.1.1-g4-1.js
index 2bcfc01e8..d7b8a4584 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g4-1.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g4-1.js
@@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-1
description: >
The JSON lexical grammar does not allow a JSONStringCharacter to
be any of the Unicode characters U+0000 thru U+0007
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007"'); // invalid string characters should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-2.js b/test/built-ins/JSON/parse/15.12.1.1-g4-2.js
index 44ae7812f..5022dcbca 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g4-2.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g4-2.js
@@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-2
description: >
The JSON lexical grammar does not allow a JSONStringCharacter to
be any of the Unicode characters U+0008 thru U+000F
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('"\u0008\u0009\u000a\u000b\u000c\u000d\u000e\u000f"'); // invalid string characters should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-3.js b/test/built-ins/JSON/parse/15.12.1.1-g4-3.js
index fa298dce2..9d13dbb69 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g4-3.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g4-3.js
@@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-3
description: >
The JSON lexical grammar does not allow a JSONStringCharacter to
be any of the Unicode characters U+0010 thru U+0017
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"'); // invalid string characters should produce a syntax error
- }
- catch (e) {
- return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-4.js b/test/built-ins/JSON/parse/15.12.1.1-g4-4.js
index 0370960f4..e222184eb 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g4-4.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g4-4.js
@@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-4
description: >
The JSON lexical grammar does not allow a JSONStringCharacter to
be any of the Unicode characters U+0018 thru U+001F
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('"\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"'); // invalid string characters should produce a syntax error
- }
- catch (e) {
- if (e.name === 'SyntaxError') return true;
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g5-2.js b/test/built-ins/JSON/parse/15.12.1.1-g5-2.js
index 8d0a1c053..d03a29920 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g5-2.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g5-2.js
@@ -6,15 +6,8 @@ es5id: 15.12.1.1-g5-2
description: >
A JSONStringCharacter UnicodeEscape may not have fewer than 4 hex
characters
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('"\\u005"')
- }
- catch (e) {
- return e.name==='SyntaxError'
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.1.1-g5-3.js b/test/built-ins/JSON/parse/15.12.1.1-g5-3.js
index 7ed0b8e89..e577bd6f6 100644
--- a/test/built-ins/JSON/parse/15.12.1.1-g5-3.js
+++ b/test/built-ins/JSON/parse/15.12.1.1-g5-3.js
@@ -6,15 +6,8 @@ es5id: 15.12.1.1-g5-3
description: >
A JSONStringCharacter UnicodeEscape may not include any non=hex
characters
-includes: [runTestCase.js]
---*/
-function testcase() {
- try {
+assert.throws(SyntaxError, function() {
JSON.parse('"\\u0X50"')
- }
- catch (e) {
- return e.name==='SyntaxError'
- }
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/parse/15.12.2-2-1.js b/test/built-ins/JSON/parse/15.12.2-2-1.js
index c2b3a5731..a2a42946f 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-1.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-1.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-1
description: >
JSON.parse - parsing an object where property name is a null
character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + nullChars[index] + ' : "John" } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-10.js b/test/built-ins/JSON/parse/15.12.2-2-10.js
index ef0291f48..0f3c73ac1 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-10.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-10.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-10
description: >
JSON.parse - parsing an object where property value middles with a
null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + "Jo" + nullChars[index] + "hn" + ' } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-2.js b/test/built-ins/JSON/parse/15.12.2-2-2.js
index 9be1f9711..d577d5b76 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-2.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-2.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-2
description: >
JSON.parse - parsing an object where property name starts with a
null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + nullChars[index] + "name" + ' : "John" } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-3.js b/test/built-ins/JSON/parse/15.12.2-2-3.js
index 524b8badd..20f19e1b2 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-3.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-3.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-3
description: >
JSON.parse - parsing an object where property name ends with a
null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{' + "name" + nullChars[index] + ' : "John" } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-4.js b/test/built-ins/JSON/parse/15.12.2-2-4.js
index dc1d6654e..755f4578f 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-4.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-4.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-4
description: >
JSON.parse - parsing an object where property name starts and ends
with a null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{' + nullChars[index] + "name" + nullChars[index] + ' : "John" } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-5.js b/test/built-ins/JSON/parse/15.12.2-2-5.js
index f2149cbd8..1b0a6240b 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-5.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-5.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-5
description: >
JSON.parse - parsing an object where property name middles with a
null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ ' + "na" + nullChars[index] + "me" + ' : "John" } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-6.js b/test/built-ins/JSON/parse/15.12.2-2-6.js
index dd2e2e7a0..c4fb8b863 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-6.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-6.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-6
description: >
JSON.parse - parsing an object where property value is a null
character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + ' } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-7.js b/test/built-ins/JSON/parse/15.12.2-2-7.js
index 6612ec016..2cb912b1f 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-7.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-7.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-7
description: >
JSON.parse - parsing an object where property value starts with a
null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + ' } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-8.js b/test/built-ins/JSON/parse/15.12.2-2-8.js
index 2d4feb42c..ab571c59f 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-8.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-8.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-8
description: >
JSON.parse - parsing an object where property value ends with a
null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + "John" + nullChars[index] + ' } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/parse/15.12.2-2-9.js b/test/built-ins/JSON/parse/15.12.2-2-9.js
index cbd697bf6..ab7ca39cc 100644
--- a/test/built-ins/JSON/parse/15.12.2-2-9.js
+++ b/test/built-ins/JSON/parse/15.12.2-2-9.js
@@ -6,13 +6,8 @@ es5id: 15.12.2-2-9
description: >
JSON.parse - parsing an object where property value starts and
ends with a null character
-includes: [runTestCase.js]
---*/
-function testcase() {
-
- var result = true;
-
var nullChars = new Array();
nullChars[0] = '\"\u0000\"';
nullChars[1] = '\"\u0001\"';
@@ -48,13 +43,7 @@ function testcase() {
nullChars[31] = '\"\u001F\"';
for (var index in nullChars) {
- try {
+ assert.throws(SyntaxError, function() {
var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + nullChars[index] + ' } ');
- result = (result && false);
- } catch (e) {
- result = (result && (e instanceof SyntaxError));
- }
+ });
}
- return result;
- }
-runTestCase(testcase);
diff --git a/test/built-ins/JSON/stringify/15.12.3-6-b-1.js b/test/built-ins/JSON/stringify/15.12.3-6-b-1.js
index d6d96ff33..d5eea1024 100644
--- a/test/built-ins/JSON/stringify/15.12.3-6-b-1.js
+++ b/test/built-ins/JSON/stringify/15.12.3-6-b-1.js
@@ -5,12 +5,10 @@
es5id: 15.12.3-6-b-1
description: >
JSON.stringify treats numeric space arguments less than 1
- (0.999999)the same as emptry string space argument.
-includes: [runTestCase.js]
+ (0.999999)the same as empty string space argument.
---*/
-function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
- return JSON.stringify(obj,null, 0.999999)=== JSON.stringify(obj); /* emptry string should be same as no space arg */
- }
-runTestCase(testcase);
+
+/* empty string should be same as no space arg */
+assert.sameValue(JSON.stringify(obj,null, 0.999999), JSON.stringify(obj));
diff --git a/test/built-ins/JSON/stringify/15.12.3-6-b-2.js b/test/built-ins/JSON/stringify/15.12.3-6-b-2.js
index 925f41bc3..d1bf8401b 100644
--- a/test/built-ins/JSON/stringify/15.12.3-6-b-2.js
+++ b/test/built-ins/JSON/stringify/15.12.3-6-b-2.js
@@ -5,12 +5,10 @@
es5id: 15.12.3-6-b-2
description: >
JSON.stringify treats numeric space arguments less than 1 (0)the
- same as emptry string space argument.
-includes: [runTestCase.js]
+ same as empty string space argument.
---*/
-function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
- return JSON.stringify(obj,null, 0)=== JSON.stringify(obj); /* emptry string should be same as no space arg */
- }
-runTestCase(testcase);
+
+/* empty string should be same as no space arg */
+assert.sameValue(JSON.stringify(obj,null, 0), JSON.stringify(obj));
diff --git a/test/built-ins/JSON/stringify/15.12.3-6-b-3.js b/test/built-ins/JSON/stringify/15.12.3-6-b-3.js
index 97a087a43..9310f9470 100644
--- a/test/built-ins/JSON/stringify/15.12.3-6-b-3.js
+++ b/test/built-ins/JSON/stringify/15.12.3-6-b-3.js
@@ -5,12 +5,10 @@
es5id: 15.12.3-6-b-3
description: >
JSON.stringify treats numeric space arguments less than 1 (-5) the
- same as emptry string space argument.
-includes: [runTestCase.js]
+ same as empty string space argument.
---*/
-function testcase() {
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
- return JSON.stringify(obj,null, -5)=== JSON.stringify(obj); /* emptry string should be same as no space arg */
- }
-runTestCase(testcase);
+
+ /* empty string should be same as no space arg */
+ assert.sameValue(JSON.stringify(obj,null, -5), JSON.stringify(obj));
diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-1.js b/test/built-ins/JSON/stringify/15.12.3_4-1-1.js
index fc6dd799c..f9b5f68ab 100644
--- a/test/built-ins/JSON/stringify/15.12.3_4-1-1.js
+++ b/test/built-ins/JSON/stringify/15.12.3_4-1-1.js
@@ -4,16 +4,11 @@
/*---
es5id: 15.12.3_4-1-1
description: JSON.stringify a circular object throws a error
-includes: [runTestCase.js]
---*/
-function testcase() {
var obj = {};
obj.prop = obj;
- try {
+
+assert.throws(TypeError, function() {
JSON.stringify(obj);
- return false; // should not reach here
- }
- catch (e) {return true}
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-2.js b/test/built-ins/JSON/stringify/15.12.3_4-1-2.js
index 9a960b007..a79907bd0 100644
--- a/test/built-ins/JSON/stringify/15.12.3_4-1-2.js
+++ b/test/built-ins/JSON/stringify/15.12.3_4-1-2.js
@@ -4,16 +4,11 @@
/*---
es5id: 15.12.3_4-1-2
description: JSON.stringify a circular object throws a TypeError
-includes: [runTestCase.js]
---*/
-function testcase() {
var obj = {};
obj.prop = obj;
- try {
+
+assert.throws(TypeError, function() {
JSON.stringify(obj);
- return false; // should not reach here
- }
- catch (e) {return e.name==='TypeError'}
- }
-runTestCase(testcase);
+});
diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-3.js b/test/built-ins/JSON/stringify/15.12.3_4-1-3.js
index e772cddfd..30d0a4339 100644
--- a/test/built-ins/JSON/stringify/15.12.3_4-1-3.js
+++ b/test/built-ins/JSON/stringify/15.12.3_4-1-3.js
@@ -4,16 +4,11 @@
/*---
es5id: 15.12.3_4-1-3
description: JSON.stringify a indirectly circular object throws a error
-includes: [runTestCase.js]
---*/
-function testcase() {
var obj = {p1: {p2: {}}};
obj.p1.p2.prop = obj;
- try {
+
+assert.throws(TypeError, function() {
JSON.stringify(obj);
- return false; // should not reach here
- }
- catch (e) {return true}
- }
-runTestCase(testcase);
+});