diff --git a/test/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js b/test/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js index 33dd5fb05e37ec2e9cd3d44773b5ad7ca6e9b19f..851b881433049a010a3c38995310c7543d29d16b 100644 --- a/test/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js +++ b/test/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js @@ -9,29 +9,15 @@ description: "ControlLetter :: RUSSIAN ALPHABET is incorrect" ---*/ //CHECK#0410-042F -var result = true; for (var alpha = 0x0410; alpha <= 0x042F; alpha++) { var str = String.fromCharCode(alpha % 32); - var arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str); - if (arr !== null) { - result = false; - } -} - -if (result !== true) { - $ERROR('#1: RUSSIAN CAPITAL ALPHABET is incorrect'); + var arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str); + assert.sameValue(arr, null, 'RUSSIAN CAPITAL ALPHABET: ' + alpha); } //CHECK#0430-044F -var result = true; for (alpha = 0x0430; alpha <= 0x044F; alpha++) { str = String.fromCharCode(alpha % 32); - arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str); - if (arr !== null) { - result = false; - } -} - -if (result !== true) { - $ERROR('#2: russian small alphabet is incorrect'); + arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str); + assert.sameValue(arr, null, 'russian small alphabet: ' + alpha); } diff --git a/test/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js b/test/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js index a6646230f3f40882e1a81a1c78719665ac656c74..a5bd7ea83a9dc45bf5f1a586cf3e96a691c993c0 100644 --- a/test/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js +++ b/test/annexB/built-ins/RegExp/RegExp-decimal-escape-class-range.js @@ -19,24 +19,11 @@ var __expected = ["1\n\n\n\n\nl"]; __expected.index = 4; __expected.input = "line1\n\n\n\n\nline2"; -//CHECK#1 -if (__executed.length !== __expected.length) { - $ERROR('#1: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length); -} - -//CHECK#2 -if (__executed.index !== __expected.index) { - $ERROR('#2: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index); -} - -//CHECK#3 -if (__executed.input !== __expected.input) { - $ERROR('#3: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input); -} +assert.sameValue(__executed.length, __expected.length, '.length'); +assert.sameValue(__executed.index, __expected.index, '.index'); +assert.sameValue(__executed.input, __expected.input, '.input'); //CHECK#4 -for(var index=0; index<__expected.length; index++) { - if (__executed[index] !== __expected[index]) { - $ERROR('#4: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]); - } +for(var index=0; index < __expected.length; index++) { + assert.sameValue(__executed[index], __expected[index], 'index: ' + index); } diff --git a/test/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js b/test/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js index 219cf0b77d71700cfe5f5fc8611ba606d3d45b4e..a677b6e4545c0a5a33dcc12330a7c0e03b5d234a 100644 --- a/test/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js +++ b/test/annexB/built-ins/RegExp/RegExp-decimal-escape-not-capturing.js @@ -13,9 +13,6 @@ description: > check results ---*/ -var __executed = /\b(\w+) \2\b/.test("do you listen the the band"); +var executed = /\b(\w+) \2\b/.test("do you listen the the band"); -//CHECK#1 -if (__executed) { - $ERROR('#1: /\\b(\\w+) \\2\\b/.test("do you listen the the band") === false'); -} +assert.sameValue(executed, false); diff --git a/test/annexB/built-ins/escape/B.2.1.propertyCheck.js b/test/annexB/built-ins/escape/B.2.1.propertyCheck.js deleted file mode 100644 index 9d1179c4e0c7f3e85d49105c96b361fc3c15b1ae..0000000000000000000000000000000000000000 --- a/test/annexB/built-ins/escape/B.2.1.propertyCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Check type of various properties -es5id: B.2.1 -description: Checking properties of this object (escape) ----*/ - -if (typeof this.escape === "undefined") $ERROR('#1: typeof this.escape !== "undefined"'); -if (typeof this['escape'] === "undefined") $ERROR('#2: typeof this["escape"] !== "undefined"'); diff --git a/test/annexB/built-ins/escape/B.2.1.js b/test/annexB/built-ins/escape/prop-desc.js similarity index 60% rename from test/annexB/built-ins/escape/B.2.1.js rename to test/annexB/built-ins/escape/prop-desc.js index 6c23ce7600a4412d94c5129f983735b8f66f4f1b..7867e0afa89d0f51afc03111142570f5d654d9a3 100644 --- a/test/annexB/built-ins/escape/B.2.1.js +++ b/test/annexB/built-ins/escape/prop-desc.js @@ -9,8 +9,11 @@ description: > includes: [propertyHelper.js] ---*/ -var global = this; +assert.sameValue(typeof this.escape, "function"); +assert.sameValue(typeof this["escape"], "function"); -verifyWritable(global, "escape"); -verifyNotEnumerable(global, "escape"); -verifyConfigurable(global, "escape"); +verifyProperty(this, "escape", { + writable: true, + enumerable: false, + configurable: true +}); diff --git a/test/annexB/built-ins/unescape/B.2.2.propertyCheck.js b/test/annexB/built-ins/unescape/B.2.2.propertyCheck.js deleted file mode 100644 index bd3f6e56e9c349a88e8f984cdb3dd2eabfa3636a..0000000000000000000000000000000000000000 --- a/test/annexB/built-ins/unescape/B.2.2.propertyCheck.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Check type of various properties -es5id: B.2.2 -description: Checking properties of this object (unescape) ----*/ - -if (typeof this.unescape === "undefined") $ERROR('#1: typeof this.unescape !== "undefined"'); -if (typeof this['unescape'] === "undefined") $ERROR('#2: typeof this["unescape"] !== "undefined"'); diff --git a/test/annexB/built-ins/unescape/B.2.2.js b/test/annexB/built-ins/unescape/prop-desc.js similarity index 59% rename from test/annexB/built-ins/unescape/B.2.2.js rename to test/annexB/built-ins/unescape/prop-desc.js index 04e65cf55e49f95b71fd9e98caa75ebe5d1055ae..65b9292db99e0739722984d346f2c9b5c6dac318 100644 --- a/test/annexB/built-ins/unescape/B.2.2.js +++ b/test/annexB/built-ins/unescape/prop-desc.js @@ -9,6 +9,11 @@ description: > includes: [propertyHelper.js] ---*/ -verifyWritable(this, "unescape"); -verifyNotEnumerable(this, "unescape"); -verifyConfigurable(this, "unescape"); +assert.sameValue(typeof this.unescape, "function"); +assert.sameValue(typeof this["unescape"], "function"); + +verifyProperty(this, "unescape", { + writable: true, + enumerable: false, + configurable: true +}); diff --git a/test/built-ins/Array/S15.4.1_A1.1_T1.js b/test/built-ins/Array/S15.4.1_A1.1_T1.js index 156c2a242c8dcd36589f5825d89c2e2a36a44a91..d74649f823f27a0ca5ef2b40f792c20765725607 100644 --- a/test/built-ins/Array/S15.4.1_A1.1_T1.js +++ b/test/built-ins/Array/S15.4.1_A1.1_T1.js @@ -13,13 +13,8 @@ description: > ---*/ //CHECK#1 -Array.prototype.myproperty = 1; -var x = Array(); -if (x.myproperty !== 1) { - $ERROR('#1: Array.prototype.myproperty = 1; var x = Array(); x.myproperty === 1. Actual: ' + (x.myproperty)); -} +Array.prototype.myproperty = 42; +var x = Array(); +assert.sameValue(x.myproperty, 42); -//CHECK#2 -if (x.hasOwnProperty('myproperty') !== false) { - $ERROR('#2: Array.prototype.myproperty = 1; var x = Array(); x.hasOwnProperty(\'myproperty\') === false. Actual: ' + (x.hasOwnProperty('myproperty'))); -} +assert.sameValue(Object.prototype.hasOwnProperty.call(x, 'myproperty'), false); diff --git a/test/built-ins/Array/S15.4_A1.1_T1.js b/test/built-ins/Array/S15.4_A1.1_T1.js deleted file mode 100644 index d8a2b814c0b328494cadb837e754a4e1136f35ca..0000000000000000000000000000000000000000 --- a/test/built-ins/Array/S15.4_A1.1_T1.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: > - A property name P (in the form of a string value) is an array index - if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 2^32 - 1 -es5id: 15.4_A1.1_T1 -description: Checking for boolean primitive ----*/ - -//CHECK#1 -var x = []; -x[true] = 1; -if (x[1] !== undefined) { - $ERROR('#1: x = []; x[true] = 1; x[1] === undefined. Actual: ' + (x[1])); -} - -//CHECK#2 -if (x["true"] !== 1) { - $ERROR('#2: x = []; x[true] = 1; x["true"] === 1. Actual: ' + (x["true"])); -} - -//CHECK#3 -x[false] = 0; -if (x[0] !== undefined) { - $ERROR('#3: x = []; x[true] = 1; x[false] = 0; x[0] === undefined. Actual: ' + (x[0])); -} - -//CHECK#4 -if (x["false"] !== 0) { - $ERROR('#4: x = []; x[false] = 1; x["false"] === 0. Actual: ' + (x["false"])); -} diff --git a/test/built-ins/Array/S15.4_A1.1_T2.js b/test/built-ins/Array/S15.4_A1.1_T2.js deleted file mode 100644 index feeeade1b64f3ead976b70ac48c7241e9dab7355..0000000000000000000000000000000000000000 --- a/test/built-ins/Array/S15.4_A1.1_T2.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: > - A property name P (in the form of a string value) is an array index - if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 2^32 - 1 -es5id: 15.4_A1.1_T2 -description: Checking for number primitive ----*/ - -//CHECK#1 -var x = []; -x[NaN] = 1; -if (x[0] !== undefined) { - $ERROR('#1: x = []; x[NaN] = 1; x[0] === undefined. Actual: ' + (x[0])); -} - -//CHECK#2 -if (x["NaN"] !== 1) { - $ERROR('#2: x = []; x[NaN] = 1; x["NaN"] === 1. Actual: ' + (x["NaN"])); -} - -//CHECK#3 -var y = []; -y[Number.POSITIVE_INFINITY] = 1; -if (y[0] !== undefined) { - $ERROR('#3: y = []; y[Number.POSITIVE_INFINITY] = 1; y[0] === undefined. Actual: ' + (y[0])); -} - -//CHECK#4 -if (y["Infinity"] !== 1) { - $ERROR('#4: y = []; y[Number.POSITIVE_INFINITY] = 1; y["Infinity"] === 1. Actual: ' + (y["Infinity"])); -} - -//CHECK#5 -var z = []; -z[Number.NEGATIVE_INFINITY] = 1; -if (z[0] !== undefined) { - $ERROR('#5: z = []; z[Number.NEGATIVE_INFINITY] = 1; z[0] === undefined. Actual: ' + (z[0])); -} - -//CHECK#6 -if (z["-Infinity"] !== 1) { - $ERROR('#6: z = []; z[Number.NEGATIVE_INFINITY] = 1; z["-Infinity"] === 1. Actual: ' + (z["-Infinity"])); -} diff --git a/test/built-ins/Array/property-cast-boolean-primitive.js b/test/built-ins/Array/property-cast-boolean-primitive.js new file mode 100644 index 0000000000000000000000000000000000000000..3b89dfc25dc179dbf14e4dad18b0927f2c473a09 --- /dev/null +++ b/test/built-ins/Array/property-cast-boolean-primitive.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: > + A property name P (in the form of a string value) is an array index + if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 2^32 - 1 +es5id: 15.4_A1.1_T1 +description: Checking for boolean primitive +---*/ + +var x = []; + +x[true] = 1; +assert.sameValue(x[1], undefined, "x[1]"); +assert.sameValue(x["true"], 1, "x['true']"); + +x[false] = 0; +assert.sameValue(x[0], undefined, "x[0]"); +assert.sameValue(x["false"], 0, "x['false']") diff --git a/test/built-ins/Array/property-cast-nan-infinity.js b/test/built-ins/Array/property-cast-nan-infinity.js new file mode 100644 index 0000000000000000000000000000000000000000..07c139669bf8f60f121414ab00585a127b2ba9fd --- /dev/null +++ b/test/built-ins/Array/property-cast-nan-infinity.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: > + A property name P (in the form of a string value) is an array index + if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 2^32 - 1 +es5id: 15.4_A1.1_T2 +description: Checking for number primitive +---*/ + +var x = []; + +x[NaN] = 1; +assert.sameValue(x[0], undefined, "x[NaN] does not cast to x[0]"); +assert.sameValue(x["NaN"], 1, "x[NaN] casts to x['NaN']"); + +var y = []; +y[Number.POSITIVE_INFINITY] = 1; +assert.sameValue(y[0], undefined, "y[Number.POSITIVE_INFINITY] !== y[0]"); +assert.sameValue(y["Infinity"], 1, "y[Number.POSITIVE_INFINITY] === y['Infinity']"); + +var z = []; +z[Number.NEGATIVE_INFINITY] = 1; +assert.sameValue(z[0], undefined, "z[Number.NEGATIVE_INFINITY] !== z[0]"); +assert.sameValue(z["-Infinity"], 1, "z[Number.NEGATIVE_INFINITY] === z['-Infinity']"); diff --git a/test/built-ins/Array/S15.4_A1.1_T3.js b/test/built-ins/Array/property-cast-number.js similarity index 71% rename from test/built-ins/Array/S15.4_A1.1_T3.js rename to test/built-ins/Array/property-cast-number.js index 9287214f1e2bb2549b78bb1e6a2eb876a5e89ab1..e6abc6516d1208123619b587bf9189ac53e9f4f6 100644 --- a/test/built-ins/Array/S15.4_A1.1_T3.js +++ b/test/built-ins/Array/property-cast-number.js @@ -9,38 +9,30 @@ es5id: 15.4_A1.1_T3 description: Checking for number primitive ---*/ -//CHECK#1 var x = []; x[4294967296] = 1; -if (x[0] !== undefined) { - $ERROR('#1: x = []; x[4294967296] = 1; x[0] === undefined. Actual: ' + (x[0])); -} - -//CHECK#2 -if (x["4294967296"] !== 1) { - $ERROR('#2: x = []; x[4294967296] = 1; x["4294967296"] === 1. Actual: ' + (x["4294967296"])); -} +assert.sameValue(x[0], undefined, "x[0]"); +assert.sameValue(x["4294967296"], 1, "x['4294967296'] !== 1"); -//CHECK#3 var y = []; y[4294967297] = 1; if (y[1] !== undefined) { - $ERROR('#3: y = []; y[4294967297] = 1; y[1] === undefined. Actual: ' + (y[1])); -} + $ERROR('#3: y = []; y[4294967297] = 1; y[1] === undefined. Actual: ' + (y[1])); +} //CHECK#4 if (y["4294967297"] !== 1) { - $ERROR('#4: y = []; y[4294967297] = 1; y["4294967297"] === 1. Actual: ' + (y["4294967297"])); + $ERROR('#4: y = []; y[4294967297] = 1; y["4294967297"] === 1. Actual: ' + (y["4294967297"])); } //CHECK#5 var z = []; z[1.1] = 1; if (z[1] !== undefined) { - $ERROR('#5: z = []; z[1.1] = 1; z[1] === undefined. Actual: ' + (z[1])); + $ERROR('#5: z = []; z[1.1] = 1; z[1] === undefined. Actual: ' + (z[1])); } //CHECK#6 if (z["1.1"] !== 1) { - $ERROR('#6: z = []; z[1.1] = 1; z["1.1"] === 1. Actual: ' + (z["1.1"])); + $ERROR('#6: z = []; z[1.1] = 1; z["1.1"] === 1. Actual: ' + (z["1.1"])); }