From 2dcd6532727e3c495f23ffc06beed8f423a84040 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Wed, 28 Jul 2021 16:44:19 -0400 Subject: [PATCH] chore: migrate $ERROR -> throw new Test262Error in test/language/t* (#3106) --- test/language/types/boolean/S8.3_A1_T1.js | 12 ++++++------ test/language/types/boolean/S8.3_A1_T2.js | 16 ++++++++-------- test/language/types/boolean/S8.3_A3.js | 8 ++++---- test/language/types/list/S8.8_A2_T1.js | 2 +- test/language/types/list/S8.8_A2_T2.js | 2 +- test/language/types/list/S8.8_A2_T3.js | 2 +- test/language/types/null/S8.2_A3.js | 2 +- test/language/types/number/8.5.1.js | 16 ++++++++-------- test/language/types/number/S8.5_A1.js | 2 +- test/language/types/number/S8.5_A11_T1.js | 2 +- test/language/types/number/S8.5_A11_T2.js | 10 +++++----- test/language/types/number/S8.5_A12.1.js | 8 ++++---- test/language/types/number/S8.5_A12.2.js | 4 ++-- test/language/types/number/S8.5_A13_T2.js | 12 ++++++------ test/language/types/number/S8.5_A14_T1.js | 8 ++++---- test/language/types/number/S8.5_A14_T2.js | 8 ++++---- test/language/types/number/S8.5_A2.1.js | 2 +- test/language/types/number/S8.5_A2.2.js | 2 +- test/language/types/number/S8.5_A3.js | 4 ++-- test/language/types/number/S8.5_A5.js | 8 ++++---- test/language/types/number/S8.5_A6.js | 4 ++-- test/language/types/number/S8.5_A7.js | 4 ++-- test/language/types/number/S8.5_A8.js | 4 ++-- test/language/types/number/S8.5_A9.js | 2 +- test/language/types/object/S8.6.1_A1.js | 2 +- test/language/types/object/S8.6.1_A2.js | 2 +- test/language/types/object/S8.6.1_A3.js | 4 ++-- test/language/types/object/S8.6.2_A1.js | 18 +++++++++--------- test/language/types/object/S8.6.2_A2.js | 4 ++-- test/language/types/object/S8.6.2_A3.js | 2 +- test/language/types/object/S8.6.2_A4.js | 10 +++++----- test/language/types/object/S8.6.2_A5_T1.js | 4 ++-- test/language/types/object/S8.6.2_A5_T2.js | 4 ++-- test/language/types/object/S8.6.2_A5_T3.js | 4 ++-- test/language/types/object/S8.6.2_A5_T4.js | 4 ++-- test/language/types/object/S8.6.2_A6.js | 4 ++-- test/language/types/object/S8.6.2_A8.js | 2 +- test/language/types/object/S8.6_A2_T2.js | 2 +- test/language/types/object/S8.6_A3_T2.js | 2 +- test/language/types/object/S8.6_A4_T1.js | 6 +++--- test/language/types/reference/S8.7.1_A1.js | 4 ++-- test/language/types/reference/S8.7.1_A2.js | 4 ++-- test/language/types/reference/S8.7.2_A2.js | 4 ++-- test/language/types/reference/S8.7.2_A3.js | 4 ++-- test/language/types/reference/S8.7_A1.js | 2 +- test/language/types/reference/S8.7_A2.js | 4 ++-- test/language/types/reference/S8.7_A3.js | 2 +- test/language/types/reference/S8.7_A4.js | 2 +- test/language/types/reference/S8.7_A5_T1.js | 14 +++++++------- test/language/types/reference/S8.7_A5_T2.js | 14 +++++++------- test/language/types/reference/S8.7_A6.js | 2 +- test/language/types/reference/S8.7_A7.js | 4 ++-- test/language/types/string/S8.4_A1.js | 8 ++++---- test/language/types/string/S8.4_A10.js | 6 +++--- test/language/types/string/S8.4_A12.js | 2 +- test/language/types/string/S8.4_A2.js | 4 ++-- test/language/types/string/S8.4_A3.js | 2 +- test/language/types/string/S8.4_A4.js | 2 +- test/language/types/string/S8.4_A5.js | 4 ++-- test/language/types/string/S8.4_A6.1.js | 2 +- test/language/types/string/S8.4_A6.2.js | 2 +- test/language/types/string/S8.4_A8.js | 8 ++++---- test/language/types/string/S8.4_A9_T1.js | 6 +++--- test/language/types/string/S8.4_A9_T2.js | 12 ++++++------ test/language/types/string/S8.4_A9_T3.js | 8 ++++---- test/language/types/undefined/S8.1_A2_T1.js | 6 +++--- test/language/types/undefined/S8.1_A2_T2.js | 6 +++--- test/language/types/undefined/S8.1_A4.js | 4 ++-- test/language/types/undefined/S8.1_A5.js | 2 +- 69 files changed, 181 insertions(+), 181 deletions(-) diff --git a/test/language/types/boolean/S8.3_A1_T1.js b/test/language/types/boolean/S8.3_A1_T1.js index c5f14672f8..ed2b81f79b 100644 --- a/test/language/types/boolean/S8.3_A1_T1.js +++ b/test/language/types/boolean/S8.3_A1_T1.js @@ -8,8 +8,8 @@ description: Assign true and false to variables ---*/ if (x !== undefined) { - $ERROR("#0 x !== undefined, but actual is "+ x); -} + throw new Test262Error("#0 x !== undefined, but actual is "+ x); +} //////////////////////////////////////////////////////////////////////// // CHECK#1 @@ -17,12 +17,12 @@ var x = true; var y = false; if (x !== true) { - $ERROR("#1.1 x !== true, but actual is "+ x); -} + throw new Test262Error("#1.1 x !== true, but actual is "+ x); +} if (y !== false) { - $ERROR("#1.1 y !== false, but actual is "+ y); -} + throw new Test262Error("#1.1 y !== false, but actual is "+ y); +} // //////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/boolean/S8.3_A1_T2.js b/test/language/types/boolean/S8.3_A1_T2.js index e4fc9b7788..87ec0111ec 100644 --- a/test/language/types/boolean/S8.3_A1_T2.js +++ b/test/language/types/boolean/S8.3_A1_T2.js @@ -10,7 +10,7 @@ description: Check type of true/false and its equality ////////////////////////////////////////////////////////////////////// // CHECK#1 if (typeof(true) !== "boolean") { - $ERROR('#1: typeof(true) === "boolean"'); + throw new Test262Error('#1: typeof(true) === "boolean"'); } // ////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ if (typeof(true) !== "boolean") { ////////////////////////////////////////////////////////////////////// // CHECK#2 if (typeof(true) != "boolean") { - $ERROR('#2: typeof(true) == "boolean"'); + throw new Test262Error('#2: typeof(true) == "boolean"'); } // ////////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ if (typeof(true) != "boolean") { ////////////////////////////////////////////////////////////////////// // CHECK#3 if (typeof(false) !== "boolean") { - $ERROR('#3: typeof(false) === "boolean"'); + throw new Test262Error('#3: typeof(false) === "boolean"'); } // ////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ if (typeof(false) !== "boolean") { ////////////////////////////////////////////////////////////////////// // CHECK#4 if (typeof(false) != "boolean") { - $ERROR('#4: typeof(false) == "boolean"'); + throw new Test262Error('#4: typeof(false) == "boolean"'); } // ////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ if (typeof(false) != "boolean") { ////////////////////////////////////////////////////////////////////// // CHECK#5 if (true === false) { - $ERROR('#5: true !== false'); + throw new Test262Error('#5: true !== false'); } // ////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ if (true === false) { ////////////////////////////////////////////////////////////////////// // CHECK#6 if (true == false) { - $ERROR('#6: true != false'); + throw new Test262Error('#6: true != false'); } // ////////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ if (true == false) { ////////////////////////////////////////////////////////////////////// // CHECK#7 if (false === true) { - $ERROR('#7: false !== true'); + throw new Test262Error('#7: false !== true'); } // ////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ if (false === true) { ////////////////////////////////////////////////////////////////////// // CHECK#8 if (false == true) { - $ERROR('#8: false != true'); + throw new Test262Error('#8: false != true'); } // ////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/boolean/S8.3_A3.js b/test/language/types/boolean/S8.3_A3.js index 5d06b23565..8b7098a3ac 100644 --- a/test/language/types/boolean/S8.3_A3.js +++ b/test/language/types/boolean/S8.3_A3.js @@ -10,7 +10,7 @@ description: Check not false equals true, not true equals false ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (!false !== true){ - $ERROR('#1: !false === true'); + throw new Test262Error('#1: !false === true'); } // ////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ if (!false !== true){ ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (!false != true){ - $ERROR('#2: !false == true'); + throw new Test262Error('#2: !false == true'); } // ////////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ if (!false != true){ ////////////////////////////////////////////////////////////////////////////// //CHECK#3 if (!true !== false){ - $ERROR('#3: !true === false'); + throw new Test262Error('#3: !true === false'); } // ////////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ if (!true !== false){ ////////////////////////////////////////////////////////////////////////////// //CHECK#4 if (!true != false){ - $ERROR('#4: !true == false'); + throw new Test262Error('#4: !true == false'); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/list/S8.8_A2_T1.js b/test/language/types/list/S8.8_A2_T1.js index 8907cabd42..7dce70ca02 100644 --- a/test/language/types/list/S8.8_A2_T1.js +++ b/test/language/types/list/S8.8_A2_T1.js @@ -11,7 +11,7 @@ function __mFunc(){return arguments.length;}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__mFunc(1,2,3) !== 3){ - $ERROR('#1: function __mFunc(){return arguments.length;}; __mFunc(1,2,3) === 3. Actual: ' + (__mFunc(1,2,3))); + throw new Test262Error('#1: function __mFunc(){return arguments.length;}; __mFunc(1,2,3) === 3. Actual: ' + (__mFunc(1,2,3))); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/list/S8.8_A2_T2.js b/test/language/types/list/S8.8_A2_T2.js index f670586e05..867bba172b 100644 --- a/test/language/types/list/S8.8_A2_T2.js +++ b/test/language/types/list/S8.8_A2_T2.js @@ -11,7 +11,7 @@ function __mFunc(){return arguments.length;}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__mFunc([,,]) !== 1){ - $ERROR('#1: function __mFunc(){return arguments.length;}; __mFunc([,,]) === 1. Actual: ' + (__mFunc([,,]))); + throw new Test262Error('#1: function __mFunc(){return arguments.length;}; __mFunc([,,]) === 1. Actual: ' + (__mFunc([,,]))); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/list/S8.8_A2_T3.js b/test/language/types/list/S8.8_A2_T3.js index 2bacf35976..6c316fd39c 100644 --- a/test/language/types/list/S8.8_A2_T3.js +++ b/test/language/types/list/S8.8_A2_T3.js @@ -11,7 +11,7 @@ function __mFunc(){var __accum=""; for (var i = 0; i < arguments.length; ++i){__ ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__mFunc("A","B","C","D","E","F") !== "ABCDEF"){ - $ERROR('#1: function __mFunc(){var __accum=""; for (var i = 0; i < arguments.length; ++i){__accum += arguments[i]};return __accum;}; __mFunc("A","B","C","D","E","F") === "ABCDEF". Actual: ' + (__mFunc("A","B","C","D","E","F"))); + throw new Test262Error('#1: function __mFunc(){var __accum=""; for (var i = 0; i < arguments.length; ++i){__accum += arguments[i]};return __accum;}; __mFunc("A","B","C","D","E","F") === "ABCDEF". Actual: ' + (__mFunc("A","B","C","D","E","F"))); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/null/S8.2_A3.js b/test/language/types/null/S8.2_A3.js index 04b33e9303..2e82c6b2bd 100644 --- a/test/language/types/null/S8.2_A3.js +++ b/test/language/types/null/S8.2_A3.js @@ -16,7 +16,7 @@ description: Check type of null ////////////////////////////////////////////////////////////// // CHECK#1 if (typeof(null) !== "object") { - $ERROR('#1: typeof null === "object". Actual: ' + (typeof null)); + throw new Test262Error('#1: typeof null === "object". Actual: ' + (typeof null)); } // ///////////////////////////////////////////////////////////// diff --git a/test/language/types/number/8.5.1.js b/test/language/types/number/8.5.1.js index a4b9dffd59..a271b77352 100644 --- a/test/language/types/number/8.5.1.js +++ b/test/language/types/number/8.5.1.js @@ -8,7 +8,7 @@ description: Valid Number ranges // Check range support for Number values (IEEE 754 64-bit floats having the form s*m*2**e) // -// For normalized floats, sign (s) is +1 or -1, m (mantisa) is a positive integer less +// For normalized floats, sign (s) is +1 or -1, m (mantisa) is a positive integer less // than 2**53 but not less than 2**52 and e (exponent) is an integer ranging from -1074 to 971 // // For denormalized floats, s is +1 or -1, m is a positive integer less than 2**52, and @@ -20,7 +20,7 @@ description: Valid Number ranges // MIN_NORM = ~2.2250738585072013830902327173324e-308 = 2**-1022 // MAX_DENORM = ~2.2250738585072008890245868760859e-308 = MIN_NORM - MIN_DENORM = (2**-1022) - (2**-1074) // MIN_DENORM = ~4.9406564584124654417656879286822e-324 = 2**-1074 - + // Fill an array with 2 to the power of (0 ... -1075) var value = 1; var floatValues = new Array(1076); @@ -33,30 +33,30 @@ for(var power = 0; power <= 1075; power++){ // The last value is below min denorm and should round to 0, everything else should contain a value if(floatValues[1075] !== 0) { - $ERROR("Value after min denorm should round to 0"); + throw new Test262Error("Value after min denorm should round to 0"); } // Validate the last actual value is min denorm if(floatValues[1074] !== 4.9406564584124654417656879286822e-324) { - $ERROR("Min denorm value is incorrect: " + floatValues[1074]); + throw new Test262Error("Min denorm value is incorrect: " + floatValues[1074]); } // Validate that every value is half the value before it up to 1 for(var index = 1074; index > 0; index--){ if(floatValues[index] === 0){ - $ERROR("2**-" + index + " should not be 0"); + throw new Test262Error("2**-" + index + " should not be 0"); } if(floatValues[index - 1] !== (floatValues[index] * 2)){ - $ERROR("Value should be double adjacent value at index " + index); + throw new Test262Error("Value should be double adjacent value at index " + index); } } // Max norm should be supported and compare less than inifity if(!(1.797693134862315708145274237317e+308 < Infinity)){ - $ERROR("Max Number value 1.797693134862315708145274237317e+308 should not overflow to infinity"); + throw new Test262Error("Max Number value 1.797693134862315708145274237317e+308 should not overflow to infinity"); } // Numbers closer to 2**1024 then max norm should overflow to infinity if(!(1.797693134862315808e+308 === +Infinity)){ - $ERROR("1.797693134862315808e+308 did not resolve to Infinity"); + throw new Test262Error("1.797693134862315808e+308 did not resolve to Infinity"); } diff --git a/test/language/types/number/S8.5_A1.js b/test/language/types/number/S8.5_A1.js index 006f35f4e2..7954acd5e0 100644 --- a/test/language/types/number/S8.5_A1.js +++ b/test/language/types/number/S8.5_A1.js @@ -13,7 +13,7 @@ var x_ = Number.NaN; /////////////////////////////////////////////////////// // CHECK #1 if (x === x_){ - $ERROR('#1: NaN !== NaN '); + throw new Test262Error('#1: NaN !== NaN '); } // ////////////////////////////////////////////////////////// diff --git a/test/language/types/number/S8.5_A11_T1.js b/test/language/types/number/S8.5_A11_T1.js index b518cb1d84..4644d2893e 100644 --- a/test/language/types/number/S8.5_A11_T1.js +++ b/test/language/types/number/S8.5_A11_T1.js @@ -11,5 +11,5 @@ var p_zero=+0; var n_zero=-0; if (1.0/p_zero === 1.0/n_zero){ - $ERROR('#1: var p_zero=+0; var n_zero=-0; 1.0/p_zero !== 1.0/n_zero'); + throw new Test262Error('#1: var p_zero=+0; var n_zero=-0; 1.0/p_zero !== 1.0/n_zero'); } diff --git a/test/language/types/number/S8.5_A11_T2.js b/test/language/types/number/S8.5_A11_T2.js index 982a7df371..35db3770c3 100644 --- a/test/language/types/number/S8.5_A11_T2.js +++ b/test/language/types/number/S8.5_A11_T2.js @@ -12,25 +12,25 @@ var n_zero=-0; //CHECK #1 if ((p_zero == n_zero) !== true){ - $ERROR('#1: var p_zero=+0; var n_zero=-0; p_zero != n_zero'); + throw new Test262Error('#1: var p_zero=+0; var n_zero=-0; p_zero != n_zero'); } //CHECK #2 if ((n_zero == 0) !== true){ - $ERROR('#2: var p_zero=+0; var n_zero=-0; n_zero == 0'); + throw new Test262Error('#2: var p_zero=+0; var n_zero=-0; n_zero == 0'); } //CHECK #3 if ((p_zero == -0) !== true){ - $ERROR('#3: var p_zero=+0; var n_zero=-0; p_zero == -0'); + throw new Test262Error('#3: var p_zero=+0; var n_zero=-0; p_zero == -0'); } //CHECK #4 if ((p_zero === 0) !== true){ - $ERROR('#4: var p_zero=+0; var n_zero=-0; p_zero === 0'); + throw new Test262Error('#4: var p_zero=+0; var n_zero=-0; p_zero === 0'); } //CHECK #5 if ((n_zero === -0) !== true){ - $ERROR('#5: var p_zero=+0; var n_zero=-0; n_zero === -0'); + throw new Test262Error('#5: var p_zero=+0; var n_zero=-0; n_zero === -0'); } diff --git a/test/language/types/number/S8.5_A12.1.js b/test/language/types/number/S8.5_A12.1.js index 90b0d7fc78..244f074d35 100644 --- a/test/language/types/number/S8.5_A12.1.js +++ b/test/language/types/number/S8.5_A12.1.js @@ -10,12 +10,12 @@ description: Compare Infinity and +Infinity with Number.POSITIVE_INFINITY var p_inf=+Infinity; var inf=Infinity; -//CHECK #1 +//CHECK #1 if (p_inf!==Number.POSITIVE_INFINITY){ - $ERROR('#1: +Infinity is the same as Number.POSITIVE_INFINITY'); + throw new Test262Error('#1: +Infinity is the same as Number.POSITIVE_INFINITY'); } -//CHECK #2 +//CHECK #2 if (inf!==Number.POSITIVE_INFINITY){ - $ERROR('#2: Infinity is the same as Number.POSITIVE_INFINITY'); + throw new Test262Error('#2: Infinity is the same as Number.POSITIVE_INFINITY'); } diff --git a/test/language/types/number/S8.5_A12.2.js b/test/language/types/number/S8.5_A12.2.js index 6702a45547..4b96cf83f5 100644 --- a/test/language/types/number/S8.5_A12.2.js +++ b/test/language/types/number/S8.5_A12.2.js @@ -9,7 +9,7 @@ description: Compare -Infinity with Number.NEGATIVE_INFINITY var n_inf=-Infinity; -//CHECK #1 +//CHECK #1 if (n_inf !== Number.NEGATIVE_INFINITY){ - $ERROR('#1: -Infinity is the same as Number.NEGATIVE_INFINITY'); + throw new Test262Error('#1: -Infinity is the same as Number.NEGATIVE_INFINITY'); } diff --git a/test/language/types/number/S8.5_A13_T2.js b/test/language/types/number/S8.5_A13_T2.js index 294ebd6c08..990817f079 100644 --- a/test/language/types/number/S8.5_A13_T2.js +++ b/test/language/types/number/S8.5_A13_T2.js @@ -10,17 +10,17 @@ es5id: 8.5_A13_T2 description: Finite Non zero values where e is 971 ---*/ -//CHECK #1 +//CHECK #1 if ((1*(Math.pow(2,52))*(Math.pow(2,971))) !== 8.98846567431158e+307){ - $ERROR('#1: (1*(Math.pow(2,52))*(Math.pow(2,971))) === 8.98846567431158e+307. Actual: ' + ((1*(Math.pow(2,52))*(Math.pow(2,971))))); + throw new Test262Error('#1: (1*(Math.pow(2,52))*(Math.pow(2,971))) === 8.98846567431158e+307. Actual: ' + ((1*(Math.pow(2,52))*(Math.pow(2,971))))); } -//CHECK #2 +//CHECK #2 if ((1*((Math.pow(2,53))-1)*(Math.pow(2,971))) !== 1.7976931348623157e+308){ - $ERROR('#2: (1*((Math.pow(2,53))-1)*(Math.pow(2,971))) === 1.7976931348623157e+308. Actual: ' + ((1*((Math.pow(2,53))-1)*(Math.pow(2,971))))); + throw new Test262Error('#2: (1*((Math.pow(2,53))-1)*(Math.pow(2,971))) === 1.7976931348623157e+308. Actual: ' + ((1*((Math.pow(2,53))-1)*(Math.pow(2,971))))); } -//CHECK #3 +//CHECK #3 if ((-1*(Math.pow(2,52))*(Math.pow(2,971))) !== -8.98846567431158e+307){ - $ERROR('#3: (-1*(Math.pow(2,52))*(Math.pow(2,971))) === -8.98846567431158e+307. Actual: ' + ((-1*(Math.pow(2,52))*(Math.pow(2,971))))); + throw new Test262Error('#3: (-1*(Math.pow(2,52))*(Math.pow(2,971))) === -8.98846567431158e+307. Actual: ' + ((-1*(Math.pow(2,52))*(Math.pow(2,971))))); } diff --git a/test/language/types/number/S8.5_A14_T1.js b/test/language/types/number/S8.5_A14_T1.js index d95f23f2da..c520fcefd0 100644 --- a/test/language/types/number/S8.5_A14_T1.js +++ b/test/language/types/number/S8.5_A14_T1.js @@ -7,12 +7,12 @@ es5id: 8.5_A14_T1 description: Create number bigger of 2**1024 ---*/ -//CHECK #1 +//CHECK #1 if (1e+308*2 !== Infinity){ - $ERROR('#1: 1e+308*2 === Infinity. Actual: ' + (1e+308*2)); + throw new Test262Error('#1: 1e+308*2 === Infinity. Actual: ' + (1e+308*2)); } -//CHECK #2 +//CHECK #2 if ((1*(Math.pow(2,53))*(Math.pow(2,971))) !== Infinity){ - $ERROR('#2: (1*(Math.pow(2,53))*(Math.pow(2,971))) === Infinity. Actual: ' + ((1*(Math.pow(2,53))*(Math.pow(2,971))))); + throw new Test262Error('#2: (1*(Math.pow(2,53))*(Math.pow(2,971))) === Infinity. Actual: ' + ((1*(Math.pow(2,53))*(Math.pow(2,971))))); } diff --git a/test/language/types/number/S8.5_A14_T2.js b/test/language/types/number/S8.5_A14_T2.js index 72144e3550..fcbff0bdae 100644 --- a/test/language/types/number/S8.5_A14_T2.js +++ b/test/language/types/number/S8.5_A14_T2.js @@ -7,12 +7,12 @@ es5id: 8.5_A14_T2 description: Create number smaller of -2**1024 ---*/ -//CHECK #1 +//CHECK #1 if (-1e+308*3 !== -Infinity){ - $ERROR('#1: -1e+308*3 === Infinity. Actual: ' + (-1e+308*3)); + throw new Test262Error('#1: -1e+308*3 === Infinity. Actual: ' + (-1e+308*3)); } -//CHECK #2 +//CHECK #2 if ((-1*(Math.pow(2,53))*(Math.pow(2,971))) !== -Infinity){ - $ERROR('#2: (-1*(Math.pow(2,53))*(Math.pow(2,971))) === Infinity. Actual: ' + ((-1*(Math.pow(2,53))*(Math.pow(2,971))))); + throw new Test262Error('#2: (-1*(Math.pow(2,53))*(Math.pow(2,971))) === Infinity. Actual: ' + ((-1*(Math.pow(2,53))*(Math.pow(2,971))))); } diff --git a/test/language/types/number/S8.5_A2.1.js b/test/language/types/number/S8.5_A2.1.js index 616887fc92..3a6f33a8b2 100644 --- a/test/language/types/number/S8.5_A2.1.js +++ b/test/language/types/number/S8.5_A2.1.js @@ -13,5 +13,5 @@ var z = x + y; var d = z - x; if (d !== 0){ - $ERROR('#1: var x = 9007199254740994.0; var y = 1.0 - 1/65536.0; var z = x + y; var d = z - x; d === 0. Actual: ' + (d)); + throw new Test262Error('#1: var x = 9007199254740994.0; var y = 1.0 - 1/65536.0; var z = x + y; var d = z - x; d === 0. Actual: ' + (d)); } diff --git a/test/language/types/number/S8.5_A2.2.js b/test/language/types/number/S8.5_A2.2.js index 4418f8483b..c76a82c840 100644 --- a/test/language/types/number/S8.5_A2.2.js +++ b/test/language/types/number/S8.5_A2.2.js @@ -13,5 +13,5 @@ var z = x + y; var d = z - x; if (d === 2){ - $ERROR('#1: var x = 9007199254740994.0; var y = 1.0 - 1/65536.0; var z = x + y; var d = z - x; d !== 2'); + throw new Test262Error('#1: var x = 9007199254740994.0; var y = 1.0 - 1/65536.0; var z = x + y; var d = z - x; d !== 2'); } diff --git a/test/language/types/number/S8.5_A3.js b/test/language/types/number/S8.5_A3.js index af136dd4a6..efab9e90dc 100644 --- a/test/language/types/number/S8.5_A3.js +++ b/test/language/types/number/S8.5_A3.js @@ -12,7 +12,7 @@ var x=NaN; /////////////////////////////////////////////////////// // CHECK#1 if (typeof(x) !== "number"){ - $ERROR('#1: var x=NaN; typeof(x) === "number". Actual: ' + (typeof(x))); + throw new Test262Error('#1: var x=NaN; typeof(x) === "number". Actual: ' + (typeof(x))); } // ////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ if (typeof(x) !== "number"){ /////////////////////////////////////////////////////// // CHECK#2 if (typeof(NaN) !== "number"){ - $ERROR('#2: typeof(NaN) === "number". Actual: ' + (typeof(NaN))); + throw new Test262Error('#2: typeof(NaN) === "number". Actual: ' + (typeof(NaN))); } // ////////////////////////////////////////////////////////// diff --git a/test/language/types/number/S8.5_A5.js b/test/language/types/number/S8.5_A5.js index 1aed53ff22..f4f5872f69 100644 --- a/test/language/types/number/S8.5_A5.js +++ b/test/language/types/number/S8.5_A5.js @@ -17,7 +17,7 @@ var x_geq_0_ADD_leq_0=(x >= 0.0) + (x <= 0.0); /////////////////////////////////////////////////// // CHECK#1 if (x_geq_0){ - $ERROR('#1: NaN not greater or equal zero'); + throw new Test262Error('#1: NaN not greater or equal zero'); } // /////////////////////////////////////////////////// @@ -25,7 +25,7 @@ if (x_geq_0){ /////////////////////////////////////////////////// // CHECK#2 if (x_leq_0){ - $ERROR('#2: NaN not less or equal zero'); + throw new Test262Error('#2: NaN not less or equal zero'); } // /////////////////////////////////////////////////// @@ -33,7 +33,7 @@ if (x_leq_0){ /////////////////////////////////////////////////// // CHECK#3 if (x_leq_0_OR_geq_0){ - $ERROR('#3: NaN not less or equal zero OR greater or equal zero'); + throw new Test262Error('#3: NaN not less or equal zero OR greater or equal zero'); } // /////////////////////////////////////////////////// @@ -41,7 +41,7 @@ if (x_leq_0_OR_geq_0){ /////////////////////////////////////////////////// // CHECK#4 if (x_geq_0_ADD_leq_0){ - $ERROR('#4: NaN not less or equal zero ADD greater or equal zero'); + throw new Test262Error('#4: NaN not less or equal zero ADD greater or equal zero'); } // /////////////////////////////////////////////////// diff --git a/test/language/types/number/S8.5_A6.js b/test/language/types/number/S8.5_A6.js index dfe3567864..b178ca2879 100644 --- a/test/language/types/number/S8.5_A6.js +++ b/test/language/types/number/S8.5_A6.js @@ -12,7 +12,7 @@ var x=-Infinity; /////////////////////////////////////////////////////// // CHECK#1 if (typeof(x) !== "number"){ - $ERROR('#1: var x=-Infinity; typeof(x) === "number". Actual: ' + (typeof(x))); + throw new Test262Error('#1: var x=-Infinity; typeof(x) === "number". Actual: ' + (typeof(x))); } // ////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ if (typeof(x) !== "number"){ /////////////////////////////////////////////////////// // CHECK#2 if (typeof(-Infinity) !== "number"){ - $ERROR('#2: typeof(-Infinity) === "number". Actual: ' + (typeof(-Infinity))); + throw new Test262Error('#2: typeof(-Infinity) === "number". Actual: ' + (typeof(-Infinity))); } // ////////////////////////////////////////////////////////// diff --git a/test/language/types/number/S8.5_A7.js b/test/language/types/number/S8.5_A7.js index 740a9c7c3b..cdfefef394 100644 --- a/test/language/types/number/S8.5_A7.js +++ b/test/language/types/number/S8.5_A7.js @@ -12,7 +12,7 @@ var x=+Infinity; /////////////////////////////////////////////////////// // CHECK#1 if (typeof(x) !== "number"){ - $ERROR('#1: var x=+Infinity; typeof(x) === "number". Actual: ' + (typeof(x))); + throw new Test262Error('#1: var x=+Infinity; typeof(x) === "number". Actual: ' + (typeof(x))); } // ////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ if (typeof(x) !== "number"){ /////////////////////////////////////////////////////// // CHECK#2 if (typeof(+Infinity) !== "number"){ - $ERROR('#2: typeof(+Infinity) === "number". Actual: ' + (typeof(+Infinity))); + throw new Test262Error('#2: typeof(+Infinity) === "number". Actual: ' + (typeof(+Infinity))); } // ////////////////////////////////////////////////////////// diff --git a/test/language/types/number/S8.5_A8.js b/test/language/types/number/S8.5_A8.js index 2c232cd8a6..6a474f6be1 100644 --- a/test/language/types/number/S8.5_A8.js +++ b/test/language/types/number/S8.5_A8.js @@ -11,9 +11,9 @@ var p_inf=+Infinity; var inf=Infinity; /////////////////////////////////////////////////////// -// +// if (p_inf!==inf){ - $ERROR('#1: Infinity is the same as +Infinity'); + throw new Test262Error('#1: Infinity is the same as +Infinity'); } // ////////////////////////////////////////////////////////// diff --git a/test/language/types/number/S8.5_A9.js b/test/language/types/number/S8.5_A9.js index 44340dc26a..017af3b4f7 100644 --- a/test/language/types/number/S8.5_A9.js +++ b/test/language/types/number/S8.5_A9.js @@ -11,5 +11,5 @@ flags: [noStrict] Number.NaN = 1; if (Number.NaN === 1) { - $ERROR('#1: Globally defined variable NaN has not been altered by program execution'); + throw new Test262Error('#1: Globally defined variable NaN has not been altered by program execution'); } diff --git a/test/language/types/object/S8.6.1_A1.js b/test/language/types/object/S8.6.1_A1.js index 86e6718ca0..b5fbbd6ccd 100644 --- a/test/language/types/object/S8.6.1_A1.js +++ b/test/language/types/object/S8.6.1_A1.js @@ -11,5 +11,5 @@ flags: [noStrict] var __e = Math.E; Math.E=1; if (Math.E !==__e){ - $ERROR('#1: __e = Math.E; Math.E=1; Math.E ===__e'); + throw new Test262Error('#1: __e = Math.E; Math.E=1; Math.E ===__e'); } diff --git a/test/language/types/object/S8.6.1_A2.js b/test/language/types/object/S8.6.1_A2.js index d1f17c96c5..c513ec61f1 100644 --- a/test/language/types/object/S8.6.1_A2.js +++ b/test/language/types/object/S8.6.1_A2.js @@ -11,5 +11,5 @@ description: Try to enumerate properties of Number var count=0; for (p in Number) count++; if (count > 0){ - $ERROR('#1: count=0; for (p in Number) count++; count > 0. Actual: ' + (count)); + throw new Test262Error('#1: count=0; for (p in Number) count++; count > 0. Actual: ' + (count)); } diff --git a/test/language/types/object/S8.6.1_A3.js b/test/language/types/object/S8.6.1_A3.js index 4085ced648..44923f8102 100644 --- a/test/language/types/object/S8.6.1_A3.js +++ b/test/language/types/object/S8.6.1_A3.js @@ -13,7 +13,7 @@ flags: [noStrict] ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (delete Number.NaN !== false){ - $ERROR('#1: delete Number.NaN === false. Actual: ' + (delete Number.NaN)); + throw new Test262Error('#1: delete Number.NaN === false. Actual: ' + (delete Number.NaN)); }; // ////////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ if (delete Number.NaN !== false){ ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (typeof(Number.NaN) === "undefined"){ - $ERROR('#2: delete Number.NaN; typeof(Number.NaN) !== "undefined" '); + throw new Test262Error('#2: delete Number.NaN; typeof(Number.NaN) !== "undefined" '); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A1.js b/test/language/types/object/S8.6.2_A1.js index 22df2bb3ec..b2703fc458 100644 --- a/test/language/types/object/S8.6.2_A1.js +++ b/test/language/types/object/S8.6.2_A1.js @@ -13,14 +13,14 @@ description: Check [[Prototype]] property of object //CHECK#1 var __obj={}; if (!Object.prototype.isPrototypeOf(__obj)){ - $ERROR('#1: Native ECMAScript objects have an internal property called [[Prototype]]. '); + throw new Test262Error('#1: Native ECMAScript objects have an internal property called [[Prototype]]. '); }; // ////////////////////////////////////////////////////////////////////////////// //Establish proto (base) object /*function ProtoObj(){ - + };*/ var protoObj={}; //Establish foo object @@ -32,21 +32,21 @@ function FooObj(){}; var obj__= new FooObj; if (!Object.prototype.isPrototypeOf(obj__)){ - $ERROR('#2.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; Object.prototype.isPrototypeOf(obj__) === true. Actual: ' + (Object.prototype.isPrototypeOf(obj__))); + throw new Test262Error('#2.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; Object.prototype.isPrototypeOf(obj__) === true. Actual: ' + (Object.prototype.isPrototypeOf(obj__))); }; if (!FooObj.prototype.isPrototypeOf(obj__)){ - $ERROR('#2.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype.isPrototypeOf(obj__) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(obj__))); + throw new Test262Error('#2.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype.isPrototypeOf(obj__) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(obj__))); }; if (protoObj.isPrototypeOf(obj__)){ - $ERROR('#2.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__))); + throw new Test262Error('#2.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__))); }; // Establish inheritance from proto object FooObj.prototype=protoObj; if (protoObj.isPrototypeOf(obj__)){ - $ERROR('#2.4: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__))); + throw new Test262Error('#2.4: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__))); }; // ////////////////////////////////////////////////////////////////////////////// @@ -58,15 +58,15 @@ if (protoObj.isPrototypeOf(obj__)){ var __foo=new FooObj; if (!Object.prototype.isPrototypeOf(__foo)){ - $ERROR('#3.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; Object.prototype.isPrototypeOf(__foo) === true. Actual: ' + (Object.prototype.isPrototypeOf(__foo))); + throw new Test262Error('#3.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; Object.prototype.isPrototypeOf(__foo) === true. Actual: ' + (Object.prototype.isPrototypeOf(__foo))); }; if (!FooObj.prototype.isPrototypeOf(__foo)){ - $ERROR('#3.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; FooObj.prototype.isPrototypeOf(__foo) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(__foo))); + throw new Test262Error('#3.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; FooObj.prototype.isPrototypeOf(__foo) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(__foo))); }; if (!protoObj.isPrototypeOf(__foo)){ - $ERROR('#3.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; protoObj.isPrototypeOf(__foo) === true. Actual: ' + (protoObj.isPrototypeOf(__foo))); + throw new Test262Error('#3.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; protoObj.isPrototypeOf(__foo) === true. Actual: ' + (protoObj.isPrototypeOf(__foo))); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A2.js b/test/language/types/object/S8.6.2_A2.js index 6914d07cd4..e56f8eb491 100644 --- a/test/language/types/object/S8.6.2_A2.js +++ b/test/language/types/object/S8.6.2_A2.js @@ -21,7 +21,7 @@ var foo= new FooObj; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (foo.prop !== "some"){ - $ERROR('#1: function FooObj(){}; FooObj.prototype.prop="some"; var foo= new FooObj; foo.prop === "some". Actual: ' + (foo.prop)); + throw new Test262Error('#1: function FooObj(){}; FooObj.prototype.prop="some"; var foo= new FooObj; foo.prop === "some". Actual: ' + (foo.prop)); } // ////////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ foo.prop=true; // Invoke another instance of foo object var foo__ = new FooObj; if (foo__.prop !== "some"){ - $ERROR('#2: function FooObj(){}; FooObj.prototype.prop="some"; var foo= new FooObj; foo.prop=true; var foo__ = new FooObj; foo__.prop === "some". Actual: ' + (foo__.prop)); + throw new Test262Error('#2: function FooObj(){}; FooObj.prototype.prop="some"; var foo= new FooObj; foo.prop=true; var foo__ = new FooObj; foo__.prop === "some". Actual: ' + (foo__.prop)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A3.js b/test/language/types/object/S8.6.2_A3.js index 244c9b5ff9..5eeabfd16b 100644 --- a/test/language/types/object/S8.6.2_A3.js +++ b/test/language/types/object/S8.6.2_A3.js @@ -13,7 +13,7 @@ var __obj={}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__obj.toString() !== "[object " + 'Object' + "]"){ - $ERROR('#1: var __obj={}; __obj.toString() === "[object " + \'Object\' + "]". Actual: ' + (__obj.toString())); + throw new Test262Error('#1: var __obj={}; __obj.toString() === "[object " + \'Object\' + "]". Actual: ' + (__obj.toString())); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A4.js b/test/language/types/object/S8.6.2_A4.js index 384ca307ce..f01faae961 100644 --- a/test/language/types/object/S8.6.2_A4.js +++ b/test/language/types/object/S8.6.2_A4.js @@ -16,7 +16,7 @@ var __obj={}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (!(__obj instanceof Object)) { - $ERROR('#1: var __obj={}; (__obj instanceof Object) === true. Actual: ' + ((__obj instanceof Object))); + throw new Test262Error('#1: var __obj={}; (__obj instanceof Object) === true. Actual: ' + ((__obj instanceof Object))); } // ////////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ if (!(__obj instanceof Object)) { ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (__obj instanceof Function) { - $ERROR('#2: var __obj={}; (__obj instanceof Function) === false. Actual: ' + ((__obj instanceof Function))); + throw new Test262Error('#2: var __obj={}; (__obj instanceof Function) === false. Actual: ' + ((__obj instanceof Function))); } // ////////////////////////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ if (__obj instanceof Function) { ////////////////////////////////////////////////////////////////////////////// //CHECK#3 if (__obj instanceof String) { - $ERROR('#3: var __obj={}; (__obj instanceof String) === false. Actual: ' + ((__obj instanceof String))); + throw new Test262Error('#3: var __obj={}; (__obj instanceof String) === false. Actual: ' + ((__obj instanceof String))); } // ////////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ if (__obj instanceof String) { ////////////////////////////////////////////////////////////////////////////// //CHECK#4 if (__obj instanceof Number) { - $ERROR('#4: var __obj={}; (__obj instanceof Number) === false. Actual: ' + ((__obj instanceof Number))); + throw new Test262Error('#4: var __obj={}; (__obj instanceof Number) === false. Actual: ' + ((__obj instanceof Number))); } // ////////////////////////////////////////////////////////////////////////////// @@ -48,7 +48,7 @@ if (__obj instanceof Number) { ////////////////////////////////////////////////////////////////////////////// //CHECK#5 if (__obj instanceof Array) { - $ERROR('#5: var __obj={}; (__obj instanceof Array) === false. Actual: ' + ((__obj instanceof Array))); + throw new Test262Error('#5: var __obj={}; (__obj instanceof Array) === false. Actual: ' + ((__obj instanceof Array))); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A5_T1.js b/test/language/types/object/S8.6.2_A5_T1.js index f4f7dcab4e..8705df9f25 100644 --- a/test/language/types/object/S8.6.2_A5_T1.js +++ b/test/language/types/object/S8.6.2_A5_T1.js @@ -16,7 +16,7 @@ var testScreen = {touch:function(){count++}}; //CHECK#1 testScreen.touch(); if (count !==1) { - $ERROR('#1: this.count=0; testScreen = {touch:function(){count++}}; testScreen.touch(); count === 1. Actual: ' + (count)); + throw new Test262Error('#1: this.count=0; testScreen = {touch:function(){count++}}; testScreen.touch(); count === 1. Actual: ' + (count)); } // ////////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ if (count !==1) { //CHECK#2 testScreen['touch'](); if (count !==2) { - $ERROR('#2: this.count=0; testScreen = {touch:function(){count++}}; testScreen.touch(); testScreen[\'touch\'](); count === 2. Actual: ' + (count)); + throw new Test262Error('#2: this.count=0; testScreen = {touch:function(){count++}}; testScreen.touch(); testScreen[\'touch\'](); count === 2. Actual: ' + (count)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A5_T2.js b/test/language/types/object/S8.6.2_A5_T2.js index df7eaf7a0e..fde9d01789 100644 --- a/test/language/types/object/S8.6.2_A5_T2.js +++ b/test/language/types/object/S8.6.2_A5_T2.js @@ -16,7 +16,7 @@ seat['move']=function(){position++}; //CHECK#1 seat.move(); if (position !==1) { - $ERROR('#1: this.position=0; seat = {}; seat[\'move\']=function(){position++}; seat.move(); position === 1. Actual: ' + (position)); + throw new Test262Error('#1: this.position=0; seat = {}; seat[\'move\']=function(){position++}; seat.move(); position === 1. Actual: ' + (position)); } // ////////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ if (position !==1) { //CHECK#2 seat['move'](); if (position !==2) { - $ERROR('#2: this.position=0; seat = {}; seat[\'move\']=function(){position++}; seat.move(); seat[\'move\'](); position === 2. Actual: ' + (position)); + throw new Test262Error('#2: this.position=0; seat = {}; seat[\'move\']=function(){position++}; seat.move(); seat[\'move\'](); position === 2. Actual: ' + (position)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A5_T3.js b/test/language/types/object/S8.6.2_A5_T3.js index 8de5c06e82..ec635dc60f 100644 --- a/test/language/types/object/S8.6.2_A5_T3.js +++ b/test/language/types/object/S8.6.2_A5_T3.js @@ -15,7 +15,7 @@ var knock=function(){count++}; //CHECK#1 knock(); if (count !==1) { - $ERROR('#1: count=0; knock=function(){count++}; knock(); count === 1. Actual: ' + (count)); + throw new Test262Error('#1: count=0; knock=function(){count++}; knock(); count === 1. Actual: ' + (count)); } // ////////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ if (count !==1) { //CHECK#2 this['knock'](); if (count !==2) { - $ERROR('#2: count=0; knock=function(){count++}; knock(); this[\'knock\'](); count === 2. Actual: ' + (count)); + throw new Test262Error('#2: count=0; knock=function(){count++}; knock(); this[\'knock\'](); count === 2. Actual: ' + (count)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A5_T4.js b/test/language/types/object/S8.6.2_A5_T4.js index 2230c4473c..26ade14427 100644 --- a/test/language/types/object/S8.6.2_A5_T4.js +++ b/test/language/types/object/S8.6.2_A5_T4.js @@ -16,7 +16,7 @@ this["beep"]=function(){__count++}; //CHECK#1 beep(); if (__count !==1) { - $ERROR('#1: __count=0; this["beep"]=function(){__count++}; beep(); __count === 1. Actual: ' + (__count)); + throw new Test262Error('#1: __count=0; this["beep"]=function(){__count++}; beep(); __count === 1. Actual: ' + (__count)); } // ////////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ if (__count !==1) { //CHECK#2 this["beep"](); if (__count !==2) { - $ERROR('#2: __count=0; this["beep"]=function(){__count++}; beep(); this["beep"](); __count === 2. Actual: ' + (__count)); + throw new Test262Error('#2: __count=0; this["beep"]=function(){__count++}; beep(); this["beep"](); __count === 2. Actual: ' + (__count)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A6.js b/test/language/types/object/S8.6.2_A6.js index 73141b8ec3..6d35dc2a15 100644 --- a/test/language/types/object/S8.6.2_A6.js +++ b/test/language/types/object/S8.6.2_A6.js @@ -13,7 +13,7 @@ description: Create a few Objects via the new operator //CHECK#1 var objInstance=new Object; if (objInstance.constructor !== Object){ - $ERROR('#1: var objInstance=new Object; objInstance.constructor === Object. Actual: ' + (objInstance.constructor)); + throw new Test262Error('#1: var objInstance=new Object; objInstance.constructor === Object. Actual: ' + (objInstance.constructor)); } // ////////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ if (objInstance.constructor !== Object){ //CHECK#2 var numInstance=new Number; if (numInstance.constructor !== Number){ - $ERROR('#2: var numInstance=new Number; numInstance.constructor === Number. Actual: ' + (numInstance.constructor)); + throw new Test262Error('#2: var numInstance=new Number; numInstance.constructor === Number. Actual: ' + (numInstance.constructor)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6.2_A8.js b/test/language/types/object/S8.6.2_A8.js index a36daab475..c54768a7b7 100644 --- a/test/language/types/object/S8.6.2_A8.js +++ b/test/language/types/object/S8.6.2_A8.js @@ -18,5 +18,5 @@ try { // be tested separately. } if (Object.getPrototypeOf(x) !== Object.prototype) { - $ERROR("Prototype of non-extensible object mutated"); + throw new Test262Error("Prototype of non-extensible object mutated"); } diff --git a/test/language/types/object/S8.6_A2_T2.js b/test/language/types/object/S8.6_A2_T2.js index 28984e4efa..2b2c947bb7 100644 --- a/test/language/types/object/S8.6_A2_T2.js +++ b/test/language/types/object/S8.6_A2_T2.js @@ -18,7 +18,7 @@ assert.sameValue(__map.foo++, NaN); ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (!("foo" in __map)) { - $ERROR('#2: var __map={}; "foo" in __map'); + throw new Test262Error('#2: var __map={}; "foo" in __map'); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6_A3_T2.js b/test/language/types/object/S8.6_A3_T2.js index 7e495c64af..c7eb368f38 100644 --- a/test/language/types/object/S8.6_A3_T2.js +++ b/test/language/types/object/S8.6_A3_T2.js @@ -18,7 +18,7 @@ assert.sameValue(++__map.foo, NaN, "++__map.foo"); ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (!("foo" in __map)) { - $ERROR('#2: var __map={}; "foo" in __map'); + throw new Test262Error('#2: var __map={}; "foo" in __map'); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6_A4_T1.js b/test/language/types/object/S8.6_A4_T1.js index 51ed416108..00cb78a35c 100644 --- a/test/language/types/object/S8.6_A4_T1.js +++ b/test/language/types/object/S8.6_A4_T1.js @@ -16,7 +16,7 @@ var count=0; for (var property in obj) count++; if (count !== 3){ - $ERROR('#1: obj = {bar:true, some:1, foo:"a"}; count=0; for (property in obj) count++; count === 3. Actual: ' + (count)); + throw new Test262Error('#1: obj = {bar:true, some:1, foo:"a"}; count=0; for (property in obj) count++; count === 3. Actual: ' + (count)); } // //////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ count=0; for (property in obj_) count++; if (count !== 3){ - $ERROR('#2: obj_ = {bar:true}; obj_.some = 1; obj_.foo = "a"; count=0; for (property in obj_) count++; count === 3. Actual: ' + (count)); + throw new Test262Error('#2: obj_ = {bar:true}; obj_.some = 1; obj_.foo = "a"; count=0; for (property in obj_) count++; count === 3. Actual: ' + (count)); } // //////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ count=0; for (property in obj__) count++; if (count !== 3){ - $ERROR('#3: obj__ = new Object(); obj__.bar = true; obj__.some = 1; obj__.foo = "a"; for (property in obj__) count++; count === 3. Actual: ' + (count)); + throw new Test262Error('#3: obj__ = new Object(); obj__.bar = true; obj__.some = 1; obj__.foo = "a"; for (property in obj__) count++; count === 3. Actual: ' + (count)); } // //////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7.1_A1.js b/test/language/types/reference/S8.7.1_A1.js index 16f437b9ba..d4d9ad8be9 100644 --- a/test/language/types/reference/S8.7.1_A1.js +++ b/test/language/types/reference/S8.7.1_A1.js @@ -13,7 +13,7 @@ this.y = 1; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if((delete this.y) !== true){ - $ERROR('#1: this.y = 1; (delete this.y) === true. Actual: ' + ((delete this.y))); + throw new Test262Error('#1: this.y = 1; (delete this.y) === true. Actual: ' + ((delete this.y))); }; // ////////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ if((delete this.y) !== true){ ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (this.y !== undefined){ - $ERROR('#2: this.y = 1; (delete this.y) === true; this.y === undefined. Actual: ' + (this.y)); + throw new Test262Error('#2: this.y = 1; (delete this.y) === true; this.y === undefined. Actual: ' + (this.y)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7.1_A2.js b/test/language/types/reference/S8.7.1_A2.js index e51479dbb0..6075344016 100644 --- a/test/language/types/reference/S8.7.1_A2.js +++ b/test/language/types/reference/S8.7.1_A2.js @@ -16,7 +16,7 @@ var y = 1; //CHECK#1 var result = delete y; if(result){ - $ERROR('#1: y = 1; (delete y) === false. Actual: ' + result); + throw new Test262Error('#1: y = 1; (delete y) === false. Actual: ' + result); }; // ////////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ if(result){ ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (y !== 1) { - $ERROR('#2: y = 1; delete y; y === 1. Actual: ' + (y)); + throw new Test262Error('#2: y = 1; delete y; y === 1. Actual: ' + (y)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7.2_A2.js b/test/language/types/reference/S8.7.2_A2.js index e78e81b79a..068467d6e5 100644 --- a/test/language/types/reference/S8.7.2_A2.js +++ b/test/language/types/reference/S8.7.2_A2.js @@ -13,7 +13,7 @@ var x; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (x !== undefined) { - $ERROR('#1: var x; x === undefined. Actual: ' + (x)); + throw new Test262Error('#1: var x; x === undefined. Actual: ' + (x)); } // ////////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ x++; ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (x === undefined) { - $ERROR('#2: var x; x++; x !== undefined'); + throw new Test262Error('#2: var x; x++; x !== undefined'); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7.2_A3.js b/test/language/types/reference/S8.7.2_A3.js index 3bd8883b89..c8275846e9 100644 --- a/test/language/types/reference/S8.7.2_A3.js +++ b/test/language/types/reference/S8.7.2_A3.js @@ -12,7 +12,7 @@ description: Execute this.x++, where this.x is undefined ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (this.x !== undefined) { - $ERROR('#1: this.x === undefined. Actual: ' + (this.x)); + throw new Test262Error('#1: this.x === undefined. Actual: ' + (this.x)); } // ////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ this.x++; ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (x === undefined) { - $ERROR('#2: this.x; this.x++; x !== undefined'); + throw new Test262Error('#2: this.x; this.x++; x !== undefined'); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A1.js b/test/language/types/reference/S8.7_A1.js index 9a964111b4..3acff31d9e 100644 --- a/test/language/types/reference/S8.7_A1.js +++ b/test/language/types/reference/S8.7_A1.js @@ -24,7 +24,7 @@ obj.oneProperty = true; // We now see that that change is represented in both variables // (Since they both refer to the same object) if(objRef.oneProperty !== true){ - $ERROR('#1: var obj = new Object(); var objRef = obj; objRef.oneProperty = -1; obj.oneProperty = true; objRef.oneProperty === true. Actual: ' + (objRef.oneProperty)); + throw new Test262Error('#1: var obj = new Object(); var objRef = obj; objRef.oneProperty = -1; obj.oneProperty = true; objRef.oneProperty === true. Actual: ' + (objRef.oneProperty)); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A2.js b/test/language/types/reference/S8.7_A2.js index ed97941522..5aea8fe433 100644 --- a/test/language/types/reference/S8.7_A2.js +++ b/test/language/types/reference/S8.7_A2.js @@ -18,7 +18,7 @@ items.push( "four" );var itemsRef = items; // The length of each array should be the same, // since they both point to the same array object if( itemsRef.length !== 4){ - $ERROR('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items.push( "four" );var itemsRef = items; itemsRef.length !== 4'); + throw new Test262Error('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items.push( "four" );var itemsRef = items; itemsRef.length !== 4'); }; // ////////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ items[1]="duo"; // The length of each array should be the same, // since they both point to the same array object if( itemsRef[1] !== "duo"){ - $ERROR('#2: var items = new Array( "one", "two", "three" ); var itemsRef = items; items[1]="duo"; itemsRef[1] === "duo". Actual: ' + (itemsRef[1])); + throw new Test262Error('#2: var items = new Array( "one", "two", "three" ); var itemsRef = items; items[1]="duo"; itemsRef[1] === "duo". Actual: ' + (itemsRef[1])); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A3.js b/test/language/types/reference/S8.7_A3.js index 69046d1cd3..e9f08667f2 100644 --- a/test/language/types/reference/S8.7_A3.js +++ b/test/language/types/reference/S8.7_A3.js @@ -23,7 +23,7 @@ items = new Array( "new", "array" ); // items points to new Array( "new", "array" ) // itemsRef points to new Array( "one", "two", "three" ) if( items == itemsRef ){ - $ERROR('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items = new Array( "new", "array" ); items != itemsRef'); + throw new Test262Error('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items = new Array( "new", "array" ); items != itemsRef'); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A4.js b/test/language/types/reference/S8.7_A4.js index 46b71e2ddc..be5c5d512a 100644 --- a/test/language/types/reference/S8.7_A4.js +++ b/test/language/types/reference/S8.7_A4.js @@ -24,7 +24,7 @@ item += "ing"; // The values of item and itemRef are NOT equal, as a whole // new string object has been created if( item == itemRef ){ - $ERROR('#1: var item = new String("test"); var itemRef = item; item += "ing"; item != itemRef'); + throw new Test262Error('#1: var item = new String("test"); var itemRef = item; item += "ing"; item != itemRef'); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A5_T1.js b/test/language/types/reference/S8.7_A5_T1.js index 7e12e86910..d8754912e6 100644 --- a/test/language/types/reference/S8.7_A5_T1.js +++ b/test/language/types/reference/S8.7_A5_T1.js @@ -11,8 +11,8 @@ flags: [noStrict] ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (typeof(__ref) !== "undefined"){ - $ERROR('#1: typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); -}; + throw new Test262Error('#1: typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); +}; // ////////////////////////////////////////////////////////////////////////////// @@ -22,15 +22,15 @@ var __ref = obj; ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (typeof(__ref) === "undefined"){ - $ERROR('#2: obj = new Object(); var __ref = obj; typeof(__ref) !== "undefined"'); -}; + throw new Test262Error('#2: obj = new Object(); var __ref = obj; typeof(__ref) !== "undefined"'); +}; // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#3 if (delete __ref !== false){ - $ERROR('#3: obj = new Object(); var __ref = obj; delete __ref === false. Actual: ' + (delete __ref)); + throw new Test262Error('#3: obj = new Object(); var __ref = obj; delete __ref === false. Actual: ' + (delete __ref)); }; // ////////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ if (delete __ref !== false){ ////////////////////////////////////////////////////////////////////////////// //CHECK#4 if (typeof(__ref) !== "object"){ - $ERROR('#4: obj = new Object(); var __ref = obj; delete __ref; typeof(__ref) === "object". Actual: ' + (typeof(__ref))); + throw new Test262Error('#4: obj = new Object(); var __ref = obj; delete __ref; typeof(__ref) === "object". Actual: ' + (typeof(__ref))); }; // ////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ if (typeof(__ref) !== "object"){ ////////////////////////////////////////////////////////////////////////////// //CHECK#5 if (typeof(obj) !== "object"){ - $ERROR('#5: obj = new Object(); var __ref = obj; delete __ref; typeof(obj) === "object". Actual: ' + (typeof(obj))); + throw new Test262Error('#5: obj = new Object(); var __ref = obj; delete __ref; typeof(obj) === "object". Actual: ' + (typeof(obj))); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A5_T2.js b/test/language/types/reference/S8.7_A5_T2.js index 37afe18ff2..2e0f7f527e 100644 --- a/test/language/types/reference/S8.7_A5_T2.js +++ b/test/language/types/reference/S8.7_A5_T2.js @@ -11,8 +11,8 @@ flags: [noStrict] ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (typeof(__ref) !== "undefined"){ - $ERROR('#1: typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); -}; + throw new Test262Error('#1: typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); +}; // ////////////////////////////////////////////////////////////////////////////// @@ -22,15 +22,15 @@ __ref = obj; ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (typeof(__ref) === "undefined"){ - $ERROR('#2: obj = new Object(); __ref = obj; typeof(__ref) !== "undefined"'); -}; + throw new Test262Error('#2: obj = new Object(); __ref = obj; typeof(__ref) !== "undefined"'); +}; // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#3 if (delete __ref !== true){ - $ERROR('#3: obj = new Object(); __ref = obj; delete __ref === true. Actual: ' + (delete __ref)); + throw new Test262Error('#3: obj = new Object(); __ref = obj; delete __ref === true. Actual: ' + (delete __ref)); }; // ////////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ if (delete __ref !== true){ ////////////////////////////////////////////////////////////////////////////// //CHECK#4 if (typeof(__ref) !== "undefined"){ - $ERROR('#4: obj = new Object(); __ref = obj; delete __ref; typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); + throw new Test262Error('#4: obj = new Object(); __ref = obj; delete __ref; typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); }; // ////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ if (typeof(__ref) !== "undefined"){ ////////////////////////////////////////////////////////////////////////////// //CHECK#5 if (typeof(obj) !== "object"){ - $ERROR('#5: obj = new Object(); __ref = obj; delete __ref; typeof(obj) === "object". Actual: ' + (typeof(obj))); + throw new Test262Error('#5: obj = new Object(); __ref = obj; delete __ref; typeof(obj) === "object". Actual: ' + (typeof(obj))); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/reference/S8.7_A6.js b/test/language/types/reference/S8.7_A6.js index 868c8391f4..928ee067d2 100644 --- a/test/language/types/reference/S8.7_A6.js +++ b/test/language/types/reference/S8.7_A6.js @@ -19,7 +19,7 @@ addFirst2Second(n, m); ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (m !== 1) { - $ERROR('#1: var n = 1; var m = n; function addFirst2Second(first, second){first += second;} addFirst2Second(n, m); m === 1. Actual: ' + (m)); + throw new Test262Error('#1: var n = 1; var m = n; function addFirst2Second(first, second){first += second;} addFirst2Second(n, m); m === 1. Actual: ' + (m)); } // diff --git a/test/language/types/reference/S8.7_A7.js b/test/language/types/reference/S8.7_A7.js index 64c0ad14b6..da464842d9 100644 --- a/test/language/types/reference/S8.7_A7.js +++ b/test/language/types/reference/S8.7_A7.js @@ -13,7 +13,7 @@ var m = n; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (typeof m !== "object") { - $ERROR('#1: var n = {}; var m = n; typeof m === "object". Actual: ' + (typeof m)); + throw new Test262Error('#1: var n = {}; var m = n; typeof m === "object". Actual: ' + (typeof m)); } // ////////////////////////////////////////////////////////////////////////////// @@ -25,7 +25,7 @@ populateAge(m); ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (n.age !== 50) { - $ERROR('#2: var n = {}; var m = n; function populateAge(person){person.age = 50;} populateAge(m); n.age === 50. Actual: ' + (n.age)); + throw new Test262Error('#2: var n = {}; var m = n; function populateAge(person){person.age = 50;} populateAge(m); n.age === 50. Actual: ' + (n.age)); } // diff --git a/test/language/types/string/S8.4_A1.js b/test/language/types/string/S8.4_A1.js index 31f9b13f23..a3ae0cc9da 100644 --- a/test/language/types/string/S8.4_A1.js +++ b/test/language/types/string/S8.4_A1.js @@ -13,7 +13,7 @@ description: Check type of variable that has been assigned with string literal // CHECK#1 var str="abcdfg"; if (typeof(str)!=="string"){ - $ERROR('#1: var str="abcdfg"; typeof(str) === "string". Actual: ' + (typeof(str))); + throw new Test262Error('#1: var str="abcdfg"; typeof(str) === "string". Actual: ' + (typeof(str))); } // //////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ if (typeof(str)!=="string"){ // CHECK#2 var str2='qwerty'; if (typeof(str2)!=="string"){ - $ERROR('#2: var str2=\'qwerty\'; typeof(str) === "string". Actual: ' + (typeof(str2))); + throw new Test262Error('#2: var str2=\'qwerty\'; typeof(str) === "string". Actual: ' + (typeof(str2))); } // //////////////////////////////////////////////////////// @@ -31,7 +31,7 @@ if (typeof(str2)!=="string"){ // CHECK#3 var __str='\u0042\u0043\u0044\u0045\u0046\u0047\u0048'; if (typeof(__str)!=="string"){ - $ERROR('#3: var __str=\'\\u0042\\u0043\\u0044\\u0045\\u0046\\u0047\\u0048\'; typeof(__str) === "string". Actual: ' + (typeof(__str))); + throw new Test262Error('#3: var __str=\'\\u0042\\u0043\\u0044\\u0045\\u0046\\u0047\\u0048\'; typeof(__str) === "string". Actual: ' + (typeof(__str))); } // //////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ if (typeof(__str)!=="string"){ // CHECK#4 var str__="\u0042\u0043\u0044\u0045\u0046\u0047\u0048"; if (typeof(str__)!=="string"){ - $ERROR('#4: var str__="abcdfg"; typeof(str__) === "string". Actual: ' + (typeof(str__))); + throw new Test262Error('#4: var str__="abcdfg"; typeof(str__) === "string". Actual: ' + (typeof(str__))); } // //////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A10.js b/test/language/types/string/S8.4_A10.js index 9bc4414dff..8a194f1c45 100644 --- a/test/language/types/string/S8.4_A10.js +++ b/test/language/types/string/S8.4_A10.js @@ -11,7 +11,7 @@ description: Create string using both unicode and ascii chars //CHECK#1 var __str = "\u0041A\u0042B\u0043C"; if (__str !== 'AABBCC'){ - $ERROR('#1: var __str = "\\u0041A\\u0042B\\u0043C"; __str === \'AABBCC\'. Actual: ' + (__str)); + throw new Test262Error('#1: var __str = "\\u0041A\\u0042B\\u0043C"; __str === \'AABBCC\'. Actual: ' + (__str)); }; // ////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ if (__str !== 'AABBCC'){ //CHECK#2 var __str__ = "\u0041\u0042\u0043"+'ABC'; if (__str__ !== 'ABCABC'){ - $ERROR('#2: var __str__ = "\\u0041\\u0042\\u0043"+\'ABC\'; __str__ === \'ABCABC\'. Actual: ' + (__str__)); + throw new Test262Error('#2: var __str__ = "\\u0041\\u0042\\u0043"+\'ABC\'; __str__ === \'ABCABC\'. Actual: ' + (__str__)); }; // ////////////////////////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ if (__str__ !== 'ABCABC'){ //CHECK#3 var str__ = "ABC"+'\u0041\u0042\u0043'; if (str__ !== "ABCABC"){ - $ERROR('#2: var str__ = "ABC"+\'\\u0041\\u0042\\u0043\'; str__ === "ABCABC". Actual: ' + (str__)); + throw new Test262Error('#2: var str__ = "ABC"+\'\\u0041\\u0042\\u0043\'; str__ === "ABCABC". Actual: ' + (str__)); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A12.js b/test/language/types/string/S8.4_A12.js index 7229bf46c3..a9ab3a79f4 100644 --- a/test/language/types/string/S8.4_A12.js +++ b/test/language/types/string/S8.4_A12.js @@ -11,7 +11,7 @@ description: Check constructor of simple assigned variable //CHECK#1 var str = "rock'n'roll"; if (str.constructor !== String){ - $ERROR('#1: var str = "rock\'n\'roll"; str.constructor === String. Actual: ' + (str.constructor)); + throw new Test262Error('#1: var str = "rock\'n\'roll"; str.constructor === String. Actual: ' + (str.constructor)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A2.js b/test/language/types/string/S8.4_A2.js index 4001507b52..348dc2d63d 100644 --- a/test/language/types/string/S8.4_A2.js +++ b/test/language/types/string/S8.4_A2.js @@ -11,7 +11,7 @@ description: Create empty string and check it type // CHECK#1 var str = ''; if (typeof(str) !== 'string'){ - $ERROR('#1: var str = \'\'; typeof(str) === \'string\'. Actual: ' + (typeof(str))); + throw new Test262Error('#1: var str = \'\'; typeof(str) === \'string\'. Actual: ' + (typeof(str))); } // //////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ if (typeof(str) !== 'string'){ // CHECK#2 var str = ""; if (typeof(str) !== "string"){ - $ERROR('#2: var str = ""; typeof(str) === "string". Actual: ' + (str)); + throw new Test262Error('#2: var str = ""; typeof(str) === "string". Actual: ' + (str)); } // //////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A3.js b/test/language/types/string/S8.4_A3.js index d32aa57d67..fec366b832 100644 --- a/test/language/types/string/S8.4_A3.js +++ b/test/language/types/string/S8.4_A3.js @@ -11,7 +11,7 @@ var __str = "ABCDEFGH"; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__str.length !== 8) { - $ERROR('#1: var __str = "ABCDEFGH"; __str.length === 8. Actual: ' + (__str.length)); + throw new Test262Error('#1: var __str = "ABCDEFGH"; __str.length === 8. Actual: ' + (__str.length)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A4.js b/test/language/types/string/S8.4_A4.js index 93bb8a2e14..15355c77a0 100644 --- a/test/language/types/string/S8.4_A4.js +++ b/test/language/types/string/S8.4_A4.js @@ -11,7 +11,7 @@ var __str = ""; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__str.length !== 0) { - $ERROR('#1: var __str = ""; __str.length === 0. Actual: ' + (__str)); + throw new Test262Error('#1: var __str = ""; __str.length === 0. Actual: ' + (__str)); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A5.js b/test/language/types/string/S8.4_A5.js index 15eeaf324d..d63ec70abe 100644 --- a/test/language/types/string/S8.4_A5.js +++ b/test/language/types/string/S8.4_A5.js @@ -9,10 +9,10 @@ description: Insert "\0" into string // CHECK#1 if ("x\0y" === "x") { - $ERROR('#1: "x\\0y" !== "x"'); + throw new Test262Error('#1: "x\\0y" !== "x"'); } // CHECK#2 if (!(("x\0a" < "x\0b") && ("x\0b" < "x\0c"))) { - $ERROR('#2: (("x\\0a" < "x\\0b") && ("x\\0b" < "x\\0c")) === true'); + throw new Test262Error('#2: (("x\\0a" < "x\\0b") && ("x\\0b" < "x\\0c")) === true'); } diff --git a/test/language/types/string/S8.4_A6.1.js b/test/language/types/string/S8.4_A6.1.js index f0564cd92d..1c85575b4b 100644 --- a/test/language/types/string/S8.4_A6.1.js +++ b/test/language/types/string/S8.4_A6.1.js @@ -11,7 +11,7 @@ description: Assign variable by large string // Check#1 var largeStr='Standard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chECMAScript LanguageSpecificationStandard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chMB Ecma-262.doc 08-04-02 16,53ECMAScript LanguageSpecificationBrief HistoryThis ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape)and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in thatcompan Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers fromMicrosoft starting with Internet Explorer 3.0.The development of this Standard started in November 1996. The first edition of this ECMA Standard was adopted bythe ECMA General Assembly of June 1997.That ECMA Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved asinternational standard ISO/IEC 16262, in April 1998. The ECMA General Assembly of June 1998 approved thesecond edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the secondedition are editorial in nature.The current document defines the third edition of the Standard and includes powerful regular expressions, betterstring handling, new control statements, try/catch exception handling, tighter definition of errors, formatting fornumeric output and minor changes in anticipation of forthcoming internationalisation facilities and future languagegrowth.Work on the language is not complete. The technical committee is working on significant enhancements, includingmechanisms for scripts to be created and used across the Internet, and tighter coordination with other standards bodiessuch as groups within the World Wide Web Consortium and the Wireless Application Protocol Forum.This Standard has been adopted as 3rd Edition of ECMA-262 by the ECMA General Assembly in December, 1999.- i -Table of contents1 Scope 12 Conformance 13 References 14 Overview 1 4.1 Web Scripting 2 4.2 Language Overview 2 4.2.1 Objects 3 4.3 Definitions 4 4.3.1 Type 4 4.3.2 Primitive Value 4 4.3.3 Object 4 4.3.4 Constructor 4 4.3.5 Prototype 4 4.3.6 Native Object 4 4.3.7 Built-in Object 4 4.3.8 Host Object 4 4.3.9 Undefined Value 4 4.3.10 Undefined Type 4 4.3.11 Null Value 4 4.3.12 Null Type 4 4.3.13 Boolean Value 4 4.3.14 Boolean Type 4 4.3.15 Boolean Object 5 4.3.16 String Value 5 4.3.17 String Type 5 4.3.18 String Object 5 4.3.19 Number Value 5 4.3.20 Number Type 5 4.3.21 Number Object 5 4.3.22 Infinity 5 4.3.23 NaN 5 5 Notational Conventions 6 5.1 Syntactic and Lexical Grammars 6 5.1.1 Context-Free Grammars 6 5.1.2 The Lexical and RegExp Grammars 6 5.1.3 The Numeric String Grammar 6 5.1.4 The Syntactic Grammar 6 5.1.5 Grammar Notation 7 5.2 Algorithm Conventions 9 6. Source Text 10 7 Lexical Conventions 11 7.1 Unicode Format-Control Characters 11 7.2 White Space 11 7.3 Line Terminators 12 7.4 Comments 12 - ii - 7.5 Tokens 13 7.5.1 Reserved Words 13 7.5.2 Keywords 13 7.5.3 Future Reserved Words 14 7.6 Identifiers 14 7.7 Punctuators 15 7.8 Literals 16 7.8.1 Null Literals 16 7.8.2 Boolean Literals 16 7.8.3 Numeric Literals 16 7.8.4 String Literals 18 7.8.5 Regular Expression Literals 20 7.9 Automatic Semicolon Insertion 21 7.9.1 Rules of Automatic Semicolon Insertion 21 7.9.2 Examples of Automatic Semicolon Insertion 22 8 Types 24 8.1 The Undefined Type 24 8.2 The Null Type 24 8.3 The Boolean Type 24 8.4 The String Type 24 8.5 The Number Type 24 8.6 The Object Type 25 8.6.1 Property Attributes 25 8.6.2 Internal Properties and Methods 26 8.7 The Reference Type 29 8.7.1 GetValue (V) 29 8.7.2 PutValue (V, W) 29 8.8 The List Type 30 8.9 The Completion Type 30 9 Type Conversion 30 9.1 ToPrimitive 30 9.2 ToBoolean 30 9.3 ToNumber 31 9.3.1 ToNumber Ap'; if(largeStr !== 'Standard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chECMAScript LanguageSpecificationStandard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chMB Ecma-262.doc 08-04-02 16,53ECMAScript LanguageSpecificationBrief HistoryThis ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape)and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in thatcompan Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers fromMicrosoft starting with Internet Explorer 3.0.The development of this Standard started in November 1996. The first edition of this ECMA Standard was adopted bythe ECMA General Assembly of June 1997.That ECMA Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved asinternational standard ISO/IEC 16262, in April 1998. The ECMA General Assembly of June 1998 approved thesecond edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the secondedition are editorial in nature.The current document defines the third edition of the Standard and includes powerful regular expressions, betterstring handling, new control statements, try/catch exception handling, tighter definition of errors, formatting fornumeric output and minor changes in anticipation of forthcoming internationalisation facilities and future languagegrowth.Work on the language is not complete. The technical committee is working on significant enhancements, includingmechanisms for scripts to be created and used across the Internet, and tighter coordination with other standards bodiessuch as groups within the World Wide Web Consortium and the Wireless Application Protocol Forum.This Standard has been adopted as 3rd Edition of ECMA-262 by the ECMA General Assembly in December, 1999.- i -Table of contents1 Scope 12 Conformance 13 References 14 Overview 1 4.1 Web Scripting 2 4.2 Language Overview 2 4.2.1 Objects 3 4.3 Definitions 4 4.3.1 Type 4 4.3.2 Primitive Value 4 4.3.3 Object 4 4.3.4 Constructor 4 4.3.5 Prototype 4 4.3.6 Native Object 4 4.3.7 Built-in Object 4 4.3.8 Host Object 4 4.3.9 Undefined Value 4 4.3.10 Undefined Type 4 4.3.11 Null Value 4 4.3.12 Null Type 4 4.3.13 Boolean Value 4 4.3.14 Boolean Type 4 4.3.15 Boolean Object 5 4.3.16 String Value 5 4.3.17 String Type 5 4.3.18 String Object 5 4.3.19 Number Value 5 4.3.20 Number Type 5 4.3.21 Number Object 5 4.3.22 Infinity 5 4.3.23 NaN 5 5 Notational Conventions 6 5.1 Syntactic and Lexical Grammars 6 5.1.1 Context-Free Grammars 6 5.1.2 The Lexical and RegExp Grammars 6 5.1.3 The Numeric String Grammar 6 5.1.4 The Syntactic Grammar 6 5.1.5 Grammar Notation 7 5.2 Algorithm Conventions 9 6. Source Text 10 7 Lexical Conventions 11 7.1 Unicode Format-Control Characters 11 7.2 White Space 11 7.3 Line Terminators 12 7.4 Comments 12 - ii - 7.5 Tokens 13 7.5.1 Reserved Words 13 7.5.2 Keywords 13 7.5.3 Future Reserved Words 14 7.6 Identifiers 14 7.7 Punctuators 15 7.8 Literals 16 7.8.1 Null Literals 16 7.8.2 Boolean Literals 16 7.8.3 Numeric Literals 16 7.8.4 String Literals 18 7.8.5 Regular Expression Literals 20 7.9 Automatic Semicolon Insertion 21 7.9.1 Rules of Automatic Semicolon Insertion 21 7.9.2 Examples of Automatic Semicolon Insertion 22 8 Types 24 8.1 The Undefined Type 24 8.2 The Null Type 24 8.3 The Boolean Type 24 8.4 The String Type 24 8.5 The Number Type 24 8.6 The Object Type 25 8.6.1 Property Attributes 25 8.6.2 Internal Properties and Methods 26 8.7 The Reference Type 29 8.7.1 GetValue (V) 29 8.7.2 PutValue (V, W) 29 8.8 The List Type 30 8.9 The Completion Type 30 9 Type Conversion 30 9.1 ToPrimitive 30 9.2 ToBoolean 30 9.3 ToNumber 31 9.3.1 ToNumber Ap'){ - $ERROR('#1: Large string 4096 bytes'); + throw new Test262Error('#1: Large string 4096 bytes'); } // //////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A6.2.js b/test/language/types/string/S8.4_A6.2.js index bc5d70b113..b05dc3fe90 100644 --- a/test/language/types/string/S8.4_A6.2.js +++ b/test/language/types/string/S8.4_A6.2.js @@ -11,7 +11,7 @@ description: Assign variable by large string // Check#2 var largeStr='Standard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chECMAScript LanguageSpecificationStandard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chMB Ecma-262.doc 08-04-02 16,53ECMAScript LanguageSpecificationBrief HistoryThis ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape)and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in thatcompans Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers fromMicrosoft starting with Internet Explorer 3.0.The development of this Standard started in November 1996. The first edition of this ECMA Standard was adopted bythe ECMA General Assembly of June 1997.That ECMA Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved asinternational standard ISO/IEC 16262, in April 1998. The ECMA General Assembly of June 1998 approved thesecond edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the secondedition are editorial in nature.The current document defines the third edition of the Standard and includes powerful regular expressions, betterstring handling, new control statements, try/catch exception handling, tighter definition of errors, formatting fornumeric output and minor changes in anticipation of forthcoming internationalisation facilities and future languagegrowth.Work on the language is not complete. The technical committee is working on significant enhancements, includingmechanisms for scripts to be created and used across the Internet, and tighter coordination with other standards bodiessuch as groups within the World Wide Web Consortium and the Wireless Application Protocol Forum.This Standard has been adopted as 3rd Edition of ECMA-262 by the ECMA General Assembly in December, 1999.- i -Table of contents1 Scope 12 Conformance 13 References 14 Overview 1 4.1 Web Scripting 2 4.2 Language Overview 2 4.2.1 Objects 3 4.3 Definitions 4 4.3.1 Type 4 4.3.2 Primitive Value 4 4.3.3 Object 4 4.3.4 Constructor 4 4.3.5 Prototype 4 4.3.6 Native Object 4 4.3.7 Built-in Object 4 4.3.8 Host Object 4 4.3.9 Undefined Value 4 4.3.10 Undefined Type 4 4.3.11 Null Value 4 4.3.12 Null Type 4 4.3.13 Boolean Value 4 4.3.14 Boolean Type 4 4.3.15 Boolean Object 5 4.3.16 String Value 5 4.3.17 String Type 5 4.3.18 String Object 5 4.3.19 Number Value 5 4.3.20 Number Type 5 4.3.21 Number Object 5 4.3.22 Infinity 5 4.3.23 NaN 5 5 Notational Conventions 6 5.1 Syntactic and Lexical Grammars 6 5.1.1 Context-Free Grammars 6 5.1.2 The Lexical and RegExp Grammars 6 5.1.3 The Numeric String Grammar 6 5.1.4 The Syntactic Grammar 6 5.1.5 Grammar Notation 7 5.2 Algorithm Conventions 9 6. Source Text 10 7 Lexical Conventions 11 7.1 Unicode Format-Control Characters 11 7.2 White Space 11 7.3 Line Terminators 12 7.4 Comments 12 - ii - 7.5 Tokens 13 7.5.1 Reserved Words 13 7.5.2 Keywords 13 7.5.3 Future Reserved Words 14 7.6 Identifiers 14 7.7 Punctuators 15 7.8 Literals 16 7.8.1 Null Literals 16 7.8.2 Boolean Literals 16 7.8.3 Numeric Literals 16 7.8.4 String Literals 18 7.8.5 Regular Expression Literals 20 7.9 Automatic Semicolon Insertion 21 7.9.1 Rules of Automatic Semicolon Insertion 21 7.9.2 Examples of Automatic Semicolon Insertion 22 8 Types 24 8.1 The Undefined Type 24 8.2 The Null Type 24 8.3 The Boolean Type 24 8.4 The String Type 24 8.5 The Number Type 24 8.6 The Object Type 25 8.6.1 Property Attributes 25 8.6.2 Internal Properties and Methods 26 8.7 The Reference Type 29 8.7.1 GetValue (V) 29 8.7.2 PutValue (V, W) 29 8.8 The List Type 30 8.9 The Completion Type 30 9 Type Conversion 30 9.1 ToPrimitive 30 9.2 ToBoolean 30 9.3 ToNumber 31 9.3.1 ToNumber Applied to the String Type 31 9.4 ToInteger 34 9.5 ToInt32: (Signed 32 Bit Integer) 34 9.6 ToUint32: (Unsigned 32 Bit Integer) 34 9.7 ToUint16: (Unsigned 16 Bit Integer) 35 9.8 ToString 35 9.8.1 ToString Applied to the Number Type 35 9.9 ToObject 36 10 Execution Contexts 37 10.1 Definitions 37 10.1.1 Function Objects 37 10.1.2 Types of Executable Code 37 10.1.3 Variable Instantiation 37 10.1.4 Scope Chain and Identifier Resolution 38 10.1.5 Global Object 38 10.1.6 Activation Object 38 - i i i - 10.1.7 This 39 10.1.8 Arguments Object 39 10.2 Entering An Execution Context 39 10.2.1 Global Code 39 10.2.2 Eval Code 39 10.2.3 Function Code 39 11 Expressions 40 11.1 Primary Expressions 40 11.1.1 The this Keyword 40 11.1.2 Identifier Reference 40 11.1.3 Literal Reference 40 11.1.4 Array Initialiser 40 11.1.5 Object Initialiser 41 11.1.6 The Grouping Operator 42 11.2 Left-Hand-Side Expressions 43 11.2.1 Property Accessors 43 11.2.2 The new Operator 44 11.2.3 Function Calls 44 11.2.4 Argument Lists 45 11.2.5 Function Expressions 45 11.3 Postfix Expressions 45 11.3.1 Postfix Increment Operator 45 11.3.2 Postfix Decrement Operator 45 11.4 Unary Operators 46 11.4.1 The delete Operator 46 11.4.2 The void Operator 46 11.4.3 The typeof Operator 46 11.4.4 Prefix Increment Operator 47 11.4.5 Prefix Decrement Operator 47 11.4.6 Unary + Operator 47 11.4.7 Unary - Operator 47 11.4.8 Bitwise NOT Operator ( ~) 48 11.4.9 Logical NOT Operator ( !) 48 11.5 Multiplicative Operators 48 11.5.1 Applying the * Operator 48 11.5.2 Applying the / Operator 49 11.5.3 Applying the % Operator 49 11.6 Additive Operators 50 11.6.1 The Addition operator ( +) 50 11.6.2 The Subtraction Operator ( -) 50 11.6.3 Applying the Additive Operators ( +,- ) to Numbers 51 11.7 Bitwise Shift Operators 51 11.7.1 The Left Shift Operator ( <<) 51 11.7.2 The Signed Right Shift Operator ( >>) 51 11.7.3 The Unsigned Right Shift Operator ( >>>) 52 11.4 Relational Operators 52 11.8.1 The Less-than Operator ( <) 53 11.8.2 The Greater-than Operator ( >) 53 11.8.3 The Less-than-or-equal Operator ( <=) 53 11.8.4 The Greater-than-or-equal Operator ( >=) 53 11.8.5 The Abstract Relational Comparison Algorithm 53 - iv - 11.8.6 The instanceof operator 54 11.8.7 The in operator 54 11.9 Equality Operators 54 11.9.1 The Equals Operator ( ==) 55 11.9.2 The Does-not-equals Operator ( !=) 55 11.9.3 The Abstract Equality Comparison Algorithm 55 11.9.4 The Strict Equals Operator ( ===) 56 11.9.5 The Strict Does-not-equal Operator ( !==) 56 11.9.6 The Strict Equality Comparison Algorithm 56 11.10 Binary Bitwise Operators 57 11.11 Binary Logical Operators 58 11.12 Conditional Operator ( ?: ) 58 11.13 Assignment Operators 59 11.13.1 Simple Assignment ( =) 59 11.13.2 Compound Assignment ( op=) 60 11.14 Comma Operator ( , ) 60 12 Statements 61 12.1 Block 61 12.2 Variable statement 62 12.3 Empty Statement 63 12.4 Expression Statement 63 12.5 The if Statement 63 12.6 Iteration Statements 64 12.6.1 The do-while Statement 64 12.6.2 The while statement 64 12.6.3 The for Statement 65 12.6.4 The for-in Statement 65 12.7 The continue Statement 66 12.8 The break Statement 67 12.9 The return Statement 67 12.10 The with Statement 67 12.11 The switch Statement 68 12.12 Labelled Statements 69 12.13 The throw statement 69 12.14 The try statement 70 13 Function Definition 71 13.1 Definitions 72 13.1.1 Equated Grammar Productions 72 13.1.2 Joined Objects 72 13.2 Creating Function Objects 72 13.2.1 [[Call]] 73 13.2.2 [[Construct]] 74 14 Program 75 15 Native ECMAScript Objects 76 15.1 The Global Object 76 15.1.1 Value Properties of the Global Object 77 15.1.2 Function Properties of the Global Object 77 15.1.3 URI Handling Function Properties 78 - v - 15.1.4 Constructor Properties of the Global Object 83 15.1.5 Other Properties of the Global Object 83 15.2 Object Objects 83 15.2.1 The Object Constructor Called as a Function 83 15.2.2 The Object Constructor 84 15.2.3 Properties of the Object Constructor 84 15.2.4 Properties of the Object Prototype Object 84 15.2.5 Properties of Object Instances 85 15.3 Function Objects 85 '; if(largeStr !== 'Standard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chECMAScript LanguageSpecificationStandard ECMA-2623r d Edition - December 1999S t a n d a r d i z i n g Informat i o n and Commu n i c a t i o n SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: ht tp: / /www.ecma.ch - Internet: helpdesk@ecma.chMB Ecma-262.doc 08-04-02 16,53ECMAScript LanguageSpecificationBrief HistoryThis ECMA Standard is based on several originating technologies, the most well known being JavaScript (Netscape)and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in thatcompans Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers fromMicrosoft starting with Internet Explorer 3.0.The development of this Standard started in November 1996. The first edition of this ECMA Standard was adopted bythe ECMA General Assembly of June 1997.That ECMA Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved asinternational standard ISO/IEC 16262, in April 1998. The ECMA General Assembly of June 1998 approved thesecond edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the secondedition are editorial in nature.The current document defines the third edition of the Standard and includes powerful regular expressions, betterstring handling, new control statements, try/catch exception handling, tighter definition of errors, formatting fornumeric output and minor changes in anticipation of forthcoming internationalisation facilities and future languagegrowth.Work on the language is not complete. The technical committee is working on significant enhancements, includingmechanisms for scripts to be created and used across the Internet, and tighter coordination with other standards bodiessuch as groups within the World Wide Web Consortium and the Wireless Application Protocol Forum.This Standard has been adopted as 3rd Edition of ECMA-262 by the ECMA General Assembly in December, 1999.- i -Table of contents1 Scope 12 Conformance 13 References 14 Overview 1 4.1 Web Scripting 2 4.2 Language Overview 2 4.2.1 Objects 3 4.3 Definitions 4 4.3.1 Type 4 4.3.2 Primitive Value 4 4.3.3 Object 4 4.3.4 Constructor 4 4.3.5 Prototype 4 4.3.6 Native Object 4 4.3.7 Built-in Object 4 4.3.8 Host Object 4 4.3.9 Undefined Value 4 4.3.10 Undefined Type 4 4.3.11 Null Value 4 4.3.12 Null Type 4 4.3.13 Boolean Value 4 4.3.14 Boolean Type 4 4.3.15 Boolean Object 5 4.3.16 String Value 5 4.3.17 String Type 5 4.3.18 String Object 5 4.3.19 Number Value 5 4.3.20 Number Type 5 4.3.21 Number Object 5 4.3.22 Infinity 5 4.3.23 NaN 5 5 Notational Conventions 6 5.1 Syntactic and Lexical Grammars 6 5.1.1 Context-Free Grammars 6 5.1.2 The Lexical and RegExp Grammars 6 5.1.3 The Numeric String Grammar 6 5.1.4 The Syntactic Grammar 6 5.1.5 Grammar Notation 7 5.2 Algorithm Conventions 9 6. Source Text 10 7 Lexical Conventions 11 7.1 Unicode Format-Control Characters 11 7.2 White Space 11 7.3 Line Terminators 12 7.4 Comments 12 - ii - 7.5 Tokens 13 7.5.1 Reserved Words 13 7.5.2 Keywords 13 7.5.3 Future Reserved Words 14 7.6 Identifiers 14 7.7 Punctuators 15 7.8 Literals 16 7.8.1 Null Literals 16 7.8.2 Boolean Literals 16 7.8.3 Numeric Literals 16 7.8.4 String Literals 18 7.8.5 Regular Expression Literals 20 7.9 Automatic Semicolon Insertion 21 7.9.1 Rules of Automatic Semicolon Insertion 21 7.9.2 Examples of Automatic Semicolon Insertion 22 8 Types 24 8.1 The Undefined Type 24 8.2 The Null Type 24 8.3 The Boolean Type 24 8.4 The String Type 24 8.5 The Number Type 24 8.6 The Object Type 25 8.6.1 Property Attributes 25 8.6.2 Internal Properties and Methods 26 8.7 The Reference Type 29 8.7.1 GetValue (V) 29 8.7.2 PutValue (V, W) 29 8.8 The List Type 30 8.9 The Completion Type 30 9 Type Conversion 30 9.1 ToPrimitive 30 9.2 ToBoolean 30 9.3 ToNumber 31 9.3.1 ToNumber Applied to the String Type 31 9.4 ToInteger 34 9.5 ToInt32: (Signed 32 Bit Integer) 34 9.6 ToUint32: (Unsigned 32 Bit Integer) 34 9.7 ToUint16: (Unsigned 16 Bit Integer) 35 9.8 ToString 35 9.8.1 ToString Applied to the Number Type 35 9.9 ToObject 36 10 Execution Contexts 37 10.1 Definitions 37 10.1.1 Function Objects 37 10.1.2 Types of Executable Code 37 10.1.3 Variable Instantiation 37 10.1.4 Scope Chain and Identifier Resolution 38 10.1.5 Global Object 38 10.1.6 Activation Object 38 - i i i - 10.1.7 This 39 10.1.8 Arguments Object 39 10.2 Entering An Execution Context 39 10.2.1 Global Code 39 10.2.2 Eval Code 39 10.2.3 Function Code 39 11 Expressions 40 11.1 Primary Expressions 40 11.1.1 The this Keyword 40 11.1.2 Identifier Reference 40 11.1.3 Literal Reference 40 11.1.4 Array Initialiser 40 11.1.5 Object Initialiser 41 11.1.6 The Grouping Operator 42 11.2 Left-Hand-Side Expressions 43 11.2.1 Property Accessors 43 11.2.2 The new Operator 44 11.2.3 Function Calls 44 11.2.4 Argument Lists 45 11.2.5 Function Expressions 45 11.3 Postfix Expressions 45 11.3.1 Postfix Increment Operator 45 11.3.2 Postfix Decrement Operator 45 11.4 Unary Operators 46 11.4.1 The delete Operator 46 11.4.2 The void Operator 46 11.4.3 The typeof Operator 46 11.4.4 Prefix Increment Operator 47 11.4.5 Prefix Decrement Operator 47 11.4.6 Unary + Operator 47 11.4.7 Unary - Operator 47 11.4.8 Bitwise NOT Operator ( ~) 48 11.4.9 Logical NOT Operator ( !) 48 11.5 Multiplicative Operators 48 11.5.1 Applying the * Operator 48 11.5.2 Applying the / Operator 49 11.5.3 Applying the % Operator 49 11.6 Additive Operators 50 11.6.1 The Addition operator ( +) 50 11.6.2 The Subtraction Operator ( -) 50 11.6.3 Applying the Additive Operators ( +,- ) to Numbers 51 11.7 Bitwise Shift Operators 51 11.7.1 The Left Shift Operator ( <<) 51 11.7.2 The Signed Right Shift Operator ( >>) 51 11.7.3 The Unsigned Right Shift Operator ( >>>) 52 11.4 Relational Operators 52 11.8.1 The Less-than Operator ( <) 53 11.8.2 The Greater-than Operator ( >) 53 11.8.3 The Less-than-or-equal Operator ( <=) 53 11.8.4 The Greater-than-or-equal Operator ( >=) 53 11.8.5 The Abstract Relational Comparison Algorithm 53 - iv - 11.8.6 The instanceof operator 54 11.8.7 The in operator 54 11.9 Equality Operators 54 11.9.1 The Equals Operator ( ==) 55 11.9.2 The Does-not-equals Operator ( !=) 55 11.9.3 The Abstract Equality Comparison Algorithm 55 11.9.4 The Strict Equals Operator ( ===) 56 11.9.5 The Strict Does-not-equal Operator ( !==) 56 11.9.6 The Strict Equality Comparison Algorithm 56 11.10 Binary Bitwise Operators 57 11.11 Binary Logical Operators 58 11.12 Conditional Operator ( ?: ) 58 11.13 Assignment Operators 59 11.13.1 Simple Assignment ( =) 59 11.13.2 Compound Assignment ( op=) 60 11.14 Comma Operator ( , ) 60 12 Statements 61 12.1 Block 61 12.2 Variable statement 62 12.3 Empty Statement 63 12.4 Expression Statement 63 12.5 The if Statement 63 12.6 Iteration Statements 64 12.6.1 The do-while Statement 64 12.6.2 The while statement 64 12.6.3 The for Statement 65 12.6.4 The for-in Statement 65 12.7 The continue Statement 66 12.8 The break Statement 67 12.9 The return Statement 67 12.10 The with Statement 67 12.11 The switch Statement 68 12.12 Labelled Statements 69 12.13 The throw statement 69 12.14 The try statement 70 13 Function Definition 71 13.1 Definitions 72 13.1.1 Equated Grammar Productions 72 13.1.2 Joined Objects 72 13.2 Creating Function Objects 72 13.2.1 [[Call]] 73 13.2.2 [[Construct]] 74 14 Program 75 15 Native ECMAScript Objects 76 15.1 The Global Object 76 15.1.1 Value Properties of the Global Object 77 15.1.2 Function Properties of the Global Object 77 15.1.3 URI Handling Function Properties 78 - v - 15.1.4 Constructor Properties of the Global Object 83 15.1.5 Other Properties of the Global Object 83 15.2 Object Objects 83 15.2.1 The Object Constructor Called as a Function 83 15.2.2 The Object Constructor 84 15.2.3 Properties of the Object Constructor 84 15.2.4 Properties of the Object Prototype Object 84 15.2.5 Properties of Object Instances 85 15.3 Function Objects 85 '){ - $ERROR('#2: Large string 8192 bytes'); + throw new Test262Error('#2: Large string 8192 bytes'); } // //////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A8.js b/test/language/types/string/S8.4_A8.js index feb6233c62..c40051d114 100644 --- a/test/language/types/string/S8.4_A8.js +++ b/test/language/types/string/S8.4_A8.js @@ -14,7 +14,7 @@ var str=''; //////////////////////////////////////////////////////////// // CHECK#1 if (str == undefined){ - $ERROR('#1: Empty string and undefined are not equal (!=) to each other'); + throw new Test262Error('#1: Empty string and undefined are not equal (!=) to each other'); } // ///////////////////////////////////////////////////////////// @@ -22,7 +22,7 @@ if (str == undefined){ //////////////////////////////////////////////////////////// // CHECK#2 if (str == null){ - $ERROR('#1: Empty string and Null are not equal (!=) to each other'); + throw new Test262Error('#1: Empty string and Null are not equal (!=) to each other'); } // ///////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ if (str == null){ //////////////////////////////////////////////////////////// // CHECK#3 if (str != 0){ - $ERROR('#3: Empty string and 0 are equal (==) to each other, since they all evaluate to 0'); + throw new Test262Error('#3: Empty string and 0 are equal (==) to each other, since they all evaluate to 0'); } // ///////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ if (str != 0){ //////////////////////////////////////////////////////////// // CHECK#4 if (str != false){ - $ERROR('#4: Empty string and false are equal (==) to each other, since they all evaluate to 0'); + throw new Test262Error('#4: Empty string and false are equal (==) to each other, since they all evaluate to 0'); } // ///////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A9_T1.js b/test/language/types/string/S8.4_A9_T1.js index ca0d836916..78ee651bae 100644 --- a/test/language/types/string/S8.4_A9_T1.js +++ b/test/language/types/string/S8.4_A9_T1.js @@ -13,7 +13,7 @@ var strObj=new String('ABC'); //////////////////////////////////////////////////////////// // CHECK#1 if (str.constructor !== strObj.constructor){ - $ERROR('#1: \'ABC\'.constructor === new String(\'ABC\').constructor'); + throw new Test262Error('#1: \'ABC\'.constructor === new String(\'ABC\').constructor'); } // ///////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ if (str.constructor !== strObj.constructor){ //////////////////////////////////////////////////////////// // CHECK#2 if (str != strObj){ - $ERROR('#2: "ABC" == new String("ABC")'); + throw new Test262Error('#2: "ABC" == new String("ABC")'); } // ///////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ if (str != strObj){ //////////////////////////////////////////////////////////// // CHECK#3 if (str === strObj){ - $ERROR('#3: "ABC" !== new String("ABC")'); + throw new Test262Error('#3: "ABC" !== new String("ABC")'); } // ///////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A9_T2.js b/test/language/types/string/S8.4_A9_T2.js index 156dbfe4c4..4d93b035b3 100644 --- a/test/language/types/string/S8.4_A9_T2.js +++ b/test/language/types/string/S8.4_A9_T2.js @@ -16,7 +16,7 @@ var strObj_=new String(); //////////////////////////////////////////////////////////// // CHECK#1 if (str.constructor !== strObj.constructor){ - $ERROR('#1: "".constructor === new String("").constructor'); + throw new Test262Error('#1: "".constructor === new String("").constructor'); } // ///////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ if (str.constructor !== strObj.constructor){ //////////////////////////////////////////////////////////// // CHECK#2 if (str.constructor !== strObj_.constructor){ - $ERROR('#2: "".constructor === new String().constructor'); + throw new Test262Error('#2: "".constructor === new String().constructor'); } // ///////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ if (str.constructor !== strObj_.constructor){ //////////////////////////////////////////////////////////// // CHECK#3 if (str != strObj){ - $ERROR('#3: values of str=""; and strObj=new String(""); are equal'); + throw new Test262Error('#3: values of str=""; and strObj=new String(""); are equal'); } // ///////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ if (str != strObj){ //////////////////////////////////////////////////////////// // CHECK#4 if (str === strObj){ - $ERROR('#4: objects of str=""; and strObj=new String(""); are different'); + throw new Test262Error('#4: objects of str=""; and strObj=new String(""); are different'); } // ///////////////////////////////////////////////////////////// @@ -48,7 +48,7 @@ if (str === strObj){ //////////////////////////////////////////////////////////// // CHECK#5 if (str != strObj_){ - $ERROR('#5: values of str=""; and strObj=new String(); are equal'); + throw new Test262Error('#5: values of str=""; and strObj=new String(); are equal'); } // ///////////////////////////////////////////////////////////// @@ -56,7 +56,7 @@ if (str != strObj_){ //////////////////////////////////////////////////////////// // CHECK#6 if (str === strObj_){ - $ERROR('#6: objects of str=""; and strObj=new String(); are different'); + throw new Test262Error('#6: objects of str=""; and strObj=new String(); are different'); } // ///////////////////////////////////////////////////////////// diff --git a/test/language/types/string/S8.4_A9_T3.js b/test/language/types/string/S8.4_A9_T3.js index c389cece25..f0a6433b2d 100644 --- a/test/language/types/string/S8.4_A9_T3.js +++ b/test/language/types/string/S8.4_A9_T3.js @@ -13,7 +13,7 @@ var strObj=new String; //////////////////////////////////////////////////////////// // CHECK#1 if (str.constructor !== strObj.constructor){ - $ERROR('#1: "".constructor === new String.constructor'); + throw new Test262Error('#1: "".constructor === new String.constructor'); } // ///////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ if (str.constructor !== strObj.constructor){ //////////////////////////////////////////////////////////// // CHECK#2 if (str != strObj){ - $ERROR('#2: values of str=""; and strObj=new String(""); are equal'); + throw new Test262Error('#2: values of str=""; and strObj=new String(""); are equal'); } // ///////////////////////////////////////////////////////////// @@ -29,7 +29,7 @@ if (str != strObj){ //////////////////////////////////////////////////////////// // CHECK#3 if (str === strObj){ - $ERROR('#3: objects of str=""; and strObj=new String(""); are different'); + throw new Test262Error('#3: objects of str=""; and strObj=new String(""); are different'); } // ///////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ if (str === strObj){ ////////////////////////////////////////////////////////////////////////////// //CHECK#4 if (typeof str == typeof strObj){ - $ERROR('#4: types of str=""; and strObj=new String(""); are different'); + throw new Test262Error('#4: types of str=""; and strObj=new String(""); are different'); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/undefined/S8.1_A2_T1.js b/test/language/types/undefined/S8.1_A2_T1.js index eb7a24030a..4e044dd8cf 100644 --- a/test/language/types/undefined/S8.1_A2_T1.js +++ b/test/language/types/undefined/S8.1_A2_T1.js @@ -12,7 +12,7 @@ var x; /////////////////////////////////////////////////////////////////// // CHECK#1 if (!(x === undefined)) { - $ERROR('#1: var x; x === undefined. Actual: ' + (x)); + throw new Test262Error('#1: var x; x === undefined. Actual: ' + (x)); } // /////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ if (!(x === undefined)) { /////////////////////////////////////////////////////////////////// // CHECK#2 if (!(typeof(x) === "undefined")) { - $ERROR('#2: var x; typeof(x) === "undefined". Actual: ' + (typeof(x))); + throw new Test262Error('#2: var x; typeof(x) === "undefined". Actual: ' + (typeof(x))); } // /////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ if (!(typeof(x) === "undefined")) { /////////////////////////////////////////////////////////////////// // CHECK#3 if (!(x === void 0)) { - $ERROR('#3: var x; x === void 0. Actual: ' + (x)); + throw new Test262Error('#3: var x; x === void 0. Actual: ' + (x)); } // /////////////////////////////////////////////////////////////////// diff --git a/test/language/types/undefined/S8.1_A2_T2.js b/test/language/types/undefined/S8.1_A2_T2.js index 60c3ba099d..931a0addd5 100644 --- a/test/language/types/undefined/S8.1_A2_T2.js +++ b/test/language/types/undefined/S8.1_A2_T2.js @@ -13,13 +13,13 @@ function test1(x) { } if (!(test1() === void 0)) { - $ERROR('#1: function test1(x){return x} test1() === void 0. Actual: ' + (test1())); + throw new Test262Error('#1: function test1(x){return x} test1() === void 0. Actual: ' + (test1())); } // CHECK#2 -function test2() { +function test2() { } if (!(test2() === void 0)) { - $ERROR('#2: function test2(){} test2() === void 0. Actual: ' + (test2())); + throw new Test262Error('#2: function test2(){} test2() === void 0. Actual: ' + (test2())); } diff --git a/test/language/types/undefined/S8.1_A4.js b/test/language/types/undefined/S8.1_A4.js index 8d8f806492..222a2844bd 100644 --- a/test/language/types/undefined/S8.1_A4.js +++ b/test/language/types/undefined/S8.1_A4.js @@ -7,7 +7,7 @@ es5id: 8.1_A4 description: Check value of not existed property ---*/ -// CHECK#1 +// CHECK#1 if ((new Object()).newProperty !== undefined) { - $ERROR('#1: (new Object()).newProperty === undefined. Actual: ' + ((new Object()).newProperty)); + throw new Test262Error('#1: (new Object()).newProperty === undefined. Actual: ' + ((new Object()).newProperty)); } diff --git a/test/language/types/undefined/S8.1_A5.js b/test/language/types/undefined/S8.1_A5.js index cb40ddf2ff..a7a282b24a 100644 --- a/test/language/types/undefined/S8.1_A5.js +++ b/test/language/types/undefined/S8.1_A5.js @@ -12,7 +12,7 @@ description: Call function without provided argument function test(arg) { // Check and make sure that arg is not undefined if (typeof(arg) !== "undefined") { - $ERROR('#1: Function argument that isn\'t provided has a value of undefined. Actual: ' + (typeof(arg))); + throw new Test262Error('#1: Function argument that isn\'t provided has a value of undefined. Actual: ' + (typeof(arg))); } }