From 19d081ef1d1b806117fcaf61dbfaaf2ba59cc127 Mon Sep 17 00:00:00 2001 From: rwaldron Date: Thu, 12 Aug 2021 16:28:19 -0400 Subject: [PATCH] Transform legacy format to harness assertions: test/built-ins/O*/**/*.js --- test/built-ins/Object/S15.2.1.1_A1_T1.js | 36 +-- test/built-ins/Object/S15.2.1.1_A1_T2.js | 36 +-- test/built-ins/Object/S15.2.1.1_A1_T3.js | 36 +-- test/built-ins/Object/S15.2.1.1_A1_T4.js | 36 +-- test/built-ins/Object/S15.2.1.1_A1_T5.js | 36 +-- test/built-ins/Object/S15.2.1.1_A2_T1.js | 23 +- test/built-ins/Object/S15.2.1.1_A2_T10.js | 11 +- test/built-ins/Object/S15.2.1.1_A2_T11.js | 21 +- test/built-ins/Object/S15.2.1.1_A2_T12.js | 19 +- test/built-ins/Object/S15.2.1.1_A2_T13.js | 23 +- test/built-ins/Object/S15.2.1.1_A2_T14.js | 18 +- test/built-ins/Object/S15.2.1.1_A2_T2.js | 23 +- test/built-ins/Object/S15.2.1.1_A2_T3.js | 23 +- test/built-ins/Object/S15.2.1.1_A2_T4.js | 11 +- test/built-ins/Object/S15.2.1.1_A2_T5.js | 17 +- test/built-ins/Object/S15.2.1.1_A2_T6.js | 23 +- test/built-ins/Object/S15.2.1.1_A2_T7.js | 23 +- test/built-ins/Object/S15.2.1.1_A2_T8.js | 11 +- test/built-ins/Object/S15.2.1.1_A2_T9.js | 18 +- test/built-ins/Object/S15.2.1.1_A3_T1.js | 16 +- test/built-ins/Object/S15.2.1.1_A3_T2.js | 11 +- test/built-ins/Object/S15.2.1.1_A3_T3.js | 16 +- test/built-ins/Object/S15.2.2.1_A1_T1.js | 33 +-- test/built-ins/Object/S15.2.2.1_A1_T2.js | 33 +-- test/built-ins/Object/S15.2.2.1_A1_T3.js | 33 +-- test/built-ins/Object/S15.2.2.1_A1_T4.js | 33 +-- test/built-ins/Object/S15.2.2.1_A1_T5.js | 33 +-- test/built-ins/Object/S15.2.2.1_A2_T1.js | 11 +- test/built-ins/Object/S15.2.2.1_A2_T2.js | 12 +- test/built-ins/Object/S15.2.2.1_A2_T3.js | 11 +- test/built-ins/Object/S15.2.2.1_A2_T5.js | 12 +- test/built-ins/Object/S15.2.2.1_A2_T6.js | 13 +- test/built-ins/Object/S15.2.2.1_A2_T7.js | 26 +- test/built-ins/Object/S15.2.2.1_A3_T1.js | 28 +- test/built-ins/Object/S15.2.2.1_A3_T2.js | 28 +- test/built-ins/Object/S15.2.2.1_A3_T3.js | 23 +- test/built-ins/Object/S15.2.2.1_A4_T1.js | 31 +-- test/built-ins/Object/S15.2.2.1_A4_T2.js | 31 +-- test/built-ins/Object/S15.2.2.1_A4_T3.js | 26 +- test/built-ins/Object/S15.2.2.1_A5_T1.js | 28 +- test/built-ins/Object/S15.2.2.1_A5_T2.js | 16 +- test/built-ins/Object/S15.2.2.1_A5_T3.js | 28 +- test/built-ins/Object/S15.2.2.1_A5_T4.js | 23 +- test/built-ins/Object/S15.2.2.1_A6_T1.js | 17 +- test/built-ins/Object/S15.2.2.1_A6_T2.js | 11 +- test/built-ins/Object/S15.2.2.1_A6_T3.js | 18 +- test/built-ins/Object/S15.2.3_A1.js | 8 +- test/built-ins/Object/S15.2.3_A2.js | 9 +- test/built-ins/Object/S15.2.3_A3.js | 14 +- test/built-ins/Object/S15.2_A1.js | 4 +- test/built-ins/Object/S9.9_A3.js | 41 +-- test/built-ins/Object/S9.9_A4.js | 252 ++++++++---------- test/built-ins/Object/S9.9_A5.js | 94 +++---- test/built-ins/Object/S9.9_A6.js | 26 +- .../Object/assign/Source-Null-Undefined.js | 2 +- .../assign/Source-Number-Boolen-Symbol.js | 2 +- test/built-ins/Object/assign/Source-String.js | 6 +- .../Object/defineProperty/S15.2.3.6_A1.js | 4 +- .../Object/defineProperty/S15.2.3.6_A2.js | 8 +- .../getOwnPropertyNames/S15.2.3.4_A1_T1.js | 4 +- .../Object/prototype/S15.2.3.1_A1.js | 12 +- .../Object/prototype/S15.2.3.1_A2.js | 20 +- .../Object/prototype/S15.2.3.1_A3.js | 14 +- .../Object/prototype/S15.2.4_A1_T1.js | 10 +- .../Object/prototype/S15.2.4_A1_T2.js | 15 +- test/built-ins/Object/prototype/S15.2.4_A2.js | 5 +- test/built-ins/Object/prototype/S15.2.4_A3.js | 2 +- test/built-ins/Object/prototype/S15.2.4_A4.js | 2 +- .../prototype/constructor/S15.2.4.1_A1_T1.js | 10 +- .../prototype/constructor/S15.2.4.1_A1_T2.js | 30 +-- .../prototype/hasOwnProperty/S15.2.4.5_A12.js | 2 +- .../prototype/hasOwnProperty/S15.2.4.5_A13.js | 2 +- .../hasOwnProperty/S15.2.4.5_A1_T1.js | 19 +- .../hasOwnProperty/S15.2.4.5_A1_T2.js | 36 +-- .../hasOwnProperty/S15.2.4.5_A1_T3.js | 34 +-- .../prototype/hasOwnProperty/S15.2.4.5_A6.js | 11 +- .../prototype/hasOwnProperty/S15.2.4.5_A7.js | 6 +- .../propertyIsEnumerable/S15.2.4.7_A10.js | 20 +- .../propertyIsEnumerable/S15.2.4.7_A11.js | 18 +- .../propertyIsEnumerable/S15.2.4.7_A12.js | 2 +- .../propertyIsEnumerable/S15.2.4.7_A13.js | 2 +- .../propertyIsEnumerable/S15.2.4.7_A1_T1.js | 38 +-- .../propertyIsEnumerable/S15.2.4.7_A2_T1.js | 19 +- .../propertyIsEnumerable/S15.2.4.7_A2_T2.js | 35 ++- .../propertyIsEnumerable/S15.2.4.7_A6.js | 11 +- .../propertyIsEnumerable/S15.2.4.7_A7.js | 6 +- .../propertyIsEnumerable/S15.2.4.7_A8.js | 24 +- .../propertyIsEnumerable/S15.2.4.7_A9.js | 18 +- .../prototype/toLocaleString/S15.2.4.3_A1.js | 28 +- .../prototype/toLocaleString/S15.2.4.3_A10.js | 20 +- .../prototype/toLocaleString/S15.2.4.3_A11.js | 18 +- .../prototype/toLocaleString/S15.2.4.3_A12.js | 2 +- .../prototype/toLocaleString/S15.2.4.3_A13.js | 2 +- .../prototype/toLocaleString/S15.2.4.3_A6.js | 11 +- .../prototype/toLocaleString/S15.2.4.3_A7.js | 6 +- .../prototype/toLocaleString/S15.2.4.3_A8.js | 24 +- .../prototype/toLocaleString/S15.2.4.3_A9.js | 25 +- .../Object/prototype/valueOf/S15.2.4.4_A10.js | 20 +- .../Object/prototype/valueOf/S15.2.4.4_A11.js | 18 +- .../Object/prototype/valueOf/S15.2.4.4_A12.js | 2 +- .../Object/prototype/valueOf/S15.2.4.4_A13.js | 2 +- .../Object/prototype/valueOf/S15.2.4.4_A14.js | 2 +- .../Object/prototype/valueOf/S15.2.4.4_A15.js | 7 +- .../prototype/valueOf/S15.2.4.4_A1_T1.js | 21 +- .../prototype/valueOf/S15.2.4.4_A1_T2.js | 21 +- .../prototype/valueOf/S15.2.4.4_A1_T3.js | 21 +- .../prototype/valueOf/S15.2.4.4_A1_T4.js | 21 +- .../prototype/valueOf/S15.2.4.4_A1_T5.js | 21 +- .../prototype/valueOf/S15.2.4.4_A1_T6.js | 21 +- .../prototype/valueOf/S15.2.4.4_A1_T7.js | 21 +- .../Object/prototype/valueOf/S15.2.4.4_A6.js | 11 +- .../Object/prototype/valueOf/S15.2.4.4_A7.js | 6 +- .../Object/prototype/valueOf/S15.2.4.4_A8.js | 24 +- .../Object/prototype/valueOf/S15.2.4.4_A9.js | 25 +- 114 files changed, 903 insertions(+), 1439 deletions(-) diff --git a/test/built-ins/Object/S15.2.1.1_A1_T1.js b/test/built-ins/Object/S15.2.1.1_A1_T1.js index 1964b17703..459df4fb02 100644 --- a/test/built-ins/Object/S15.2.1.1_A1_T1.js +++ b/test/built-ins/Object/S15.2.1.1_A1_T1.js @@ -13,22 +13,28 @@ var __obj = Object(null); var n__obj = new Object(null); -if (__obj.toString() !== n__obj.toString()) { - throw new Test262Error('#1'); -} +assert.sameValue( + __obj.toString(), + n__obj.toString(), + '__obj.toString() must return the same value returned by n__obj.toString()' +); -if (__obj.constructor !== n__obj.constructor) { - throw new Test262Error('#2'); -} +assert.sameValue( + __obj.constructor, + n__obj.constructor, + 'The value of __obj.constructor is expected to equal the value of n__obj.constructor' +); -if (__obj.prototype !== n__obj.prototype) { - throw new Test262Error('#3'); -} +assert.sameValue( + __obj.prototype, + n__obj.prototype, + 'The value of __obj.prototype is expected to equal the value of n__obj.prototype' +); -if (__obj.toLocaleString() !== n__obj.toLocaleString()) { - throw new Test262Error('#4'); -} +assert.sameValue( + __obj.toLocaleString(), + n__obj.toLocaleString(), + '__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()' +); -if (typeof __obj !== typeof n__obj) { - throw new Test262Error('#5'); -} +assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj'); diff --git a/test/built-ins/Object/S15.2.1.1_A1_T2.js b/test/built-ins/Object/S15.2.1.1_A1_T2.js index 9ce97bed60..f2b9b9c88a 100644 --- a/test/built-ins/Object/S15.2.1.1_A1_T2.js +++ b/test/built-ins/Object/S15.2.1.1_A1_T2.js @@ -16,22 +16,28 @@ var __obj = Object(void 0); var n__obj = new Object(void 0); -if (__obj.toString() !== n__obj.toString()) { - throw new Test262Error('#1'); -} +assert.sameValue( + __obj.toString(), + n__obj.toString(), + '__obj.toString() must return the same value returned by n__obj.toString()' +); -if (__obj.constructor !== n__obj.constructor) { - throw new Test262Error('#2'); -} +assert.sameValue( + __obj.constructor, + n__obj.constructor, + 'The value of __obj.constructor is expected to equal the value of n__obj.constructor' +); -if (__obj.prototype !== n__obj.prototype) { - throw new Test262Error('#3'); -} +assert.sameValue( + __obj.prototype, + n__obj.prototype, + 'The value of __obj.prototype is expected to equal the value of n__obj.prototype' +); -if (__obj.toLocaleString() !== n__obj.toLocaleString()) { - throw new Test262Error('#4'); -} +assert.sameValue( + __obj.toLocaleString(), + n__obj.toLocaleString(), + '__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()' +); -if (typeof __obj !== typeof n__obj) { - throw new Test262Error('#5'); -} +assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj'); diff --git a/test/built-ins/Object/S15.2.1.1_A1_T3.js b/test/built-ins/Object/S15.2.1.1_A1_T3.js index 1a5ebc6265..bf4c3f9e3c 100644 --- a/test/built-ins/Object/S15.2.1.1_A1_T3.js +++ b/test/built-ins/Object/S15.2.1.1_A1_T3.js @@ -13,22 +13,28 @@ var __obj = Object(); var n__obj = new Object(); -if (__obj.toString() !== n__obj.toString()) { - throw new Test262Error('#1'); -} +assert.sameValue( + __obj.toString(), + n__obj.toString(), + '__obj.toString() must return the same value returned by n__obj.toString()' +); -if (__obj.constructor !== n__obj.constructor) { - throw new Test262Error('#2'); -} +assert.sameValue( + __obj.constructor, + n__obj.constructor, + 'The value of __obj.constructor is expected to equal the value of n__obj.constructor' +); -if (__obj.prototype !== n__obj.prototype) { - throw new Test262Error('#3'); -} +assert.sameValue( + __obj.prototype, + n__obj.prototype, + 'The value of __obj.prototype is expected to equal the value of n__obj.prototype' +); -if (__obj.toLocaleString() !== n__obj.toLocaleString()) { - throw new Test262Error('#4'); -} +assert.sameValue( + __obj.toLocaleString(), + n__obj.toLocaleString(), + '__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()' +); -if (typeof __obj !== typeof n__obj) { - throw new Test262Error('#5'); -} +assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj'); diff --git a/test/built-ins/Object/S15.2.1.1_A1_T4.js b/test/built-ins/Object/S15.2.1.1_A1_T4.js index 067271461f..a884b00e45 100644 --- a/test/built-ins/Object/S15.2.1.1_A1_T4.js +++ b/test/built-ins/Object/S15.2.1.1_A1_T4.js @@ -13,22 +13,28 @@ var __obj = Object(undefined); var n__obj = new Object(undefined); -if (__obj.toString() !== n__obj.toString()) { - throw new Test262Error('#1'); -} +assert.sameValue( + __obj.toString(), + n__obj.toString(), + '__obj.toString() must return the same value returned by n__obj.toString()' +); -if (__obj.constructor !== n__obj.constructor) { - throw new Test262Error('#2'); -} +assert.sameValue( + __obj.constructor, + n__obj.constructor, + 'The value of __obj.constructor is expected to equal the value of n__obj.constructor' +); -if (__obj.prototype !== n__obj.prototype) { - throw new Test262Error('#3'); -} +assert.sameValue( + __obj.prototype, + n__obj.prototype, + 'The value of __obj.prototype is expected to equal the value of n__obj.prototype' +); -if (__obj.toLocaleString() !== n__obj.toLocaleString()) { - throw new Test262Error('#4'); -} +assert.sameValue( + __obj.toLocaleString(), + n__obj.toLocaleString(), + '__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()' +); -if (typeof __obj !== typeof n__obj) { - throw new Test262Error('#5'); -} +assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj'); diff --git a/test/built-ins/Object/S15.2.1.1_A1_T5.js b/test/built-ins/Object/S15.2.1.1_A1_T5.js index ba66948dfc..00baccf5fb 100644 --- a/test/built-ins/Object/S15.2.1.1_A1_T5.js +++ b/test/built-ins/Object/S15.2.1.1_A1_T5.js @@ -13,24 +13,30 @@ var __obj = Object(x); var n__obj = new Object(x); -if (__obj.toString() !== n__obj.toString()) { - throw new Test262Error('#1'); -} +assert.sameValue( + __obj.toString(), + n__obj.toString(), + '__obj.toString() must return the same value returned by n__obj.toString()' +); -if (__obj.constructor !== n__obj.constructor) { - throw new Test262Error('#2'); -} +assert.sameValue( + __obj.constructor, + n__obj.constructor, + 'The value of __obj.constructor is expected to equal the value of n__obj.constructor' +); -if (__obj.prototype !== n__obj.prototype) { - throw new Test262Error('#3'); -} +assert.sameValue( + __obj.prototype, + n__obj.prototype, + 'The value of __obj.prototype is expected to equal the value of n__obj.prototype' +); -if (__obj.toLocaleString() !== n__obj.toLocaleString()) { - throw new Test262Error('#4'); -} +assert.sameValue( + __obj.toLocaleString(), + n__obj.toLocaleString(), + '__obj.toLocaleString() must return the same value returned by n__obj.toLocaleString()' +); -if (typeof __obj !== typeof n__obj) { - throw new Test262Error('#5'); -} +assert.sameValue(typeof __obj, typeof n__obj, 'The value of `typeof __obj` is expected to be typeof n__obj'); var x; diff --git a/test/built-ins/Object/S15.2.1.1_A2_T1.js b/test/built-ins/Object/S15.2.1.1_A2_T1.js index e6eb529ad0..2b40746b07 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T1.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T1.js @@ -11,24 +11,11 @@ description: Calling Object function with boolean argument value var bool = true; -if (typeof bool !== 'boolean') { - throw new Test262Error('#1: bool should be boolean primitive'); -} +assert.sameValue(typeof bool, 'boolean', 'The value of `typeof bool` is expected to be "boolean"'); var obj = Object(bool); -if (obj.constructor !== Boolean) { - throw new Test262Error('#2: Object(true) returns ToObject(true)'); -} - -if (typeof obj !== "object") { - throw new Test262Error('#3: Object(true) returns ToObject(true)'); -} - -if (!obj) { - throw new Test262Error('#4: Object(true) returns ToObject(true)'); -} - -if (obj === true) { - throw new Test262Error('#5: Object(true) returns ToObject(true)'); -} +assert.sameValue(obj.constructor, Boolean, 'The value of obj.constructor is expected to equal the value of Boolean'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(!!obj, 'The value of !!obj is expected to be true'); +assert.notSameValue(obj, true, 'The value of obj is not true'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T10.js b/test/built-ins/Object/S15.2.1.1_A2_T10.js index ee98f99a3a..9ea976fb43 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T10.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T10.js @@ -11,16 +11,11 @@ description: Calling Object function with array of numbers as argument value var arr = [1, 2, 3]; -//CHECK#1 -if (typeof arr !== 'object') { - throw new Test262Error('#1: arr = [1,2,3] is NOT an object'); -} +assert.sameValue(typeof arr, 'object', 'The value of `typeof arr` is expected to be "object"'); var n_obj = Object(arr); arr.push(4); -//CHECK#2 -if ((n_obj !== arr) || (n_obj[3] !== 4)) { - throw new Test262Error('#2: Object([1,2,3]) returns ToObject([1,2,3])'); -} +assert.sameValue(n_obj, arr, 'The value of n_obj is expected to equal the value of arr'); +assert.sameValue(n_obj[3], 4, 'The value of n_obj[3] is expected to be 4'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T11.js b/test/built-ins/Object/S15.2.1.1_A2_T11.js index e61e0dbe98..6cfea71dd1 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T11.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T11.js @@ -8,22 +8,17 @@ info: | es5id: 15.2.1.1_A2_T11 description: Calling Object function with function declaration as argument value ---*/ - -//CHECK#1 -if (typeof func !== 'undefined') { - throw new Test262Error('#1: function expression can\'t be declarated'); -} +assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"'); var n_obj = Object(function func() { return 1; }); -//CHECK#2 -if ((n_obj.constructor !== Function) || (n_obj() !== 1)) { - throw new Test262Error('#2: Object(function func(){return 1;}) returns function'); -} +assert.sameValue( + n_obj.constructor, + Function, + 'The value of n_obj.constructor is expected to equal the value of Function' +); +assert.sameValue(n_obj(), 1, 'n_obj() must return 1') +assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"'); -//CHECK#3 -if (typeof func !== 'undefined') { - throw new Test262Error('#3: function expression can\'t be declarated'); -} diff --git a/test/built-ins/Object/S15.2.1.1_A2_T12.js b/test/built-ins/Object/S15.2.1.1_A2_T12.js index 6df2800f57..8b05f7a4d2 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T12.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T12.js @@ -13,18 +13,7 @@ var obj = Object(1.1 * ([].length + { q: 1 }["q"])); -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Object(expression) returns ToObject(expression)'); -} - -//CHECK#3 -if (obj.constructor !== Number) { - throw new Test262Error('#3: Object(expression) returns ToObject(expression)'); -} - -//CHECK#4 -if ((obj != 1.1) || (obj === 1.1)) { - throw new Test262Error('#4: Object(expression) returns ToObject(expression)'); -} -// +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert(obj == 1.1, 'The result of evaluating (obj == 1.1) is expected to be true'); +assert.notSameValue(obj, 1.1, 'The value of obj is not 1.1'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T13.js b/test/built-ins/Object/S15.2.1.1_A2_T13.js index e164bd6fc3..f3d023ab36 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T13.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T13.js @@ -11,22 +11,7 @@ description: Calling Object function with boolean expression as argument value var obj = Object((1 === 1) && (!false)); -//CHECK#1 -if (obj.constructor !== Boolean) { - throw new Test262Error('#1: Object(expression) returns ToObject(expression)'); -} - -//CHECK#1.1 -if (typeof obj !== "object") { - throw new Test262Error('#1.1: Object(expression) returns ToObject(expression)'); -} - -//CHECK#2 -if (!(obj)) { - throw new Test262Error('#2: Object(expression) returns ToObject(expression)'); -} - -//CHECK#3 -if (obj === true) { - throw new Test262Error('#3: Object(expression) returns ToObject(expression)'); -} +assert.sameValue(obj.constructor, Boolean, 'The value of obj.constructor is expected to equal the value of Boolean'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(!!obj, 'The value of !!obj is expected to be true'); +assert.notSameValue(obj, true, 'The value of obj is not true'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T14.js b/test/built-ins/Object/S15.2.1.1_A2_T14.js index f4f9a845e4..a1b0d276e4 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T14.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T14.js @@ -13,17 +13,7 @@ description: > var obj = Object("" + 1); -//CHECK#2 -if (obj.constructor !== String) { - throw new Test262Error('#2: Object(expression) returns ToObject(expression)'); -} - -//CHECK#3 -if (typeof obj !== "object") { - throw new Test262Error('#3: Object(expression) returns ToObject(expression)'); -} - -//CHECK#4 -if ((obj != "1") || (obj === "1")) { - throw new Test262Error('#4: Object(expression) returns ToObject(expression)'); -} +assert.sameValue(obj.constructor, String, 'The value of obj.constructor is expected to equal the value of String'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(obj == "1", 'The result of evaluating (obj == "1") is expected to be true'); +assert.notSameValue(obj, "1", 'The value of obj is not "1"'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T2.js b/test/built-ins/Object/S15.2.1.1_A2_T2.js index b9d812dbeb..89b1f969c3 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T2.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T2.js @@ -11,25 +11,12 @@ description: Calling Object function with number argument value var num = 1.1; -// CHECK#1 -if (typeof num !== 'number') { - throw new Test262Error('#1: num = 1.1 should be Number primitive'); -} +assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"'); var obj = Object(num); -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Object(1.1) returns ToObject(1.1)'); -} +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); -//CHECK#3 -if (obj.constructor !== Number) { - throw new Test262Error('#3: Object(1.1) returns ToObject(1.1)'); -} - -//CHECK#4 -if ((obj != 1.1) || (obj === 1.1)) { - throw new Test262Error('#4: Object(1.1) returns ToObject(1.1)'); -} -// +assert(obj == 1.1, 'The result of evaluating (obj == 1.1) is expected to be true'); +assert.notSameValue(obj, 1.1, 'The value of obj is not 1.1'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T3.js b/test/built-ins/Object/S15.2.1.1_A2_T3.js index 3b476b6dec..c54eaa7c17 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T3.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T3.js @@ -11,24 +11,11 @@ description: Calling Object function with string argument value var str = 'Luke Skywalker'; -// CHECK#1 -if (typeof str !== 'string') { - throw new Test262Error('#1: "Luke Skywalker" should be a String primitive'); -} +assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"'); var obj = Object(str); -//CHECK#2 -if (obj.constructor !== String) { - throw new Test262Error('#2: Object("Luke Skywalker") returns ToObject("Luke Skywalker")'); -} - -//CHECK#3 -if (typeof obj !== "object") { - throw new Test262Error('#3: Object("Luke Skywalker") returns ToObject("Luke Skywalker")'); -} - -//CHECK#4 -if ((obj != "Luke Skywalker") || (obj === "Luke Skywalker")) { - throw new Test262Error('#4: Object("Luke Skywalker") returns ToObject("Luke Skywalker")'); -} +assert.sameValue(obj.constructor, String, 'The value of obj.constructor is expected to equal the value of String'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(obj == "Luke Skywalker", 'The result of evaluating (obj == "Luke Skywalker") is expected to be true'); +assert.notSameValue(obj, "Luke Skywalker", 'The value of obj is not "Luke Skywalker"'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T4.js b/test/built-ins/Object/S15.2.1.1_A2_T4.js index 673e74f309..85a59fdb44 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T4.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T4.js @@ -13,14 +13,9 @@ var obj = { flag: true }; -//CHECK#1 -if (typeof(obj) !== 'object') { - throw new Test262Error('#1: obj = {flag:true} should be an Object'); -} +assert.sameValue(typeof(obj), 'object', 'The value of `typeof(obj)` is expected to be "object"'); var n_obj = Object(obj); -//CHECK#2 -if ((n_obj !== obj) || (!(n_obj['flag']))) { - throw new Test262Error('#2: Object({flag:true}) returns ToObject({flag:true})'); -} +assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj'); +assert(!!n_obj['flag'], 'The value of !!n_obj["flag"] is expected to be true'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T5.js b/test/built-ins/Object/S15.2.1.1_A2_T5.js index a147ef147a..3b57c1d092 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T5.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T5.js @@ -11,20 +11,9 @@ description: Calling Object function with NaN argument value var num = NaN; -// CHECK#1 -if (typeof num !== 'number') { - throw new Test262Error('#1: num = NaN should have number type'); -} +assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"'); var obj = Object(num); -//CHECK#2 -if (obj.constructor !== Number) { - throw new Test262Error('#2: Object(NaN) returns ToObject(NaN)'); -} - -//CHECK#3 -if (typeof obj !== "object") { - throw new Test262Error('#2: Object(NaN) returns ToObject(NaN)'); -} -// +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T6.js b/test/built-ins/Object/S15.2.1.1_A2_T6.js index 8d566e782c..d685d346bd 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T6.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T6.js @@ -11,24 +11,11 @@ description: Calling Object function with Infinity argument value var num = Infinity; -// CHECK#1 -if (typeof num !== 'number') { - throw new Test262Error('#1: num = Infinity should be a Number primitive'); -} +assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"'); var obj = Object(num); -//CHECK#2 -if (obj.constructor !== Number) { - throw new Test262Error('#2: Object(Infinity) returns ToObject(Infinity)'); -} - -//CHECK#3 -if (typeof obj !== "object") { - throw new Test262Error('#3: Object(Infinity) returns ToObject(Infinity)'); -} - -//CHECK#4 -if ((obj != Infinity) || (obj === Infinity)) { - throw new Test262Error('#4: Object(Infinity) returns ToObject(Infinity)'); -} +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(obj == Infinity, 'The result of evaluating (obj == Infinity) is expected to be true'); +assert.notSameValue(obj, Infinity, 'The value of obj is expected to not equal ``Infinity``'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T7.js b/test/built-ins/Object/S15.2.1.1_A2_T7.js index 7eb8e22548..87c569106a 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T7.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T7.js @@ -11,24 +11,11 @@ description: Calling Object function with empty string argument value var str = ''; -// CHECK#1 -if (typeof(str) !== 'string') { - throw new Test262Error('#1: "" is NOT a String'); -} +assert.sameValue(typeof(str), 'string', 'The value of `typeof(str)` is expected to be "string"'); var obj = Object(str); -//CHECK#2 -if (obj.constructor !== String) { - throw new Test262Error('#2: Object("") returns ToObject("")'); -} - -//CHECK#3 -if (typeof obj !== "object") { - throw new Test262Error('#3: Object("") returns ToObject("")'); -} - -//CHECK#4 -if ((obj != "") || (obj === "")) { - throw new Test262Error('#4: Object("") returns ToObject("")'); -} +assert.sameValue(obj.constructor, String, 'The value of obj.constructor is expected to equal the value of String'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(obj == "", 'The result of evaluating (obj == "") is expected to be true'); +assert.notSameValue(obj, "", 'The value of obj is not ""'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T8.js b/test/built-ins/Object/S15.2.1.1_A2_T8.js index ad8428338c..20d875082d 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T8.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T8.js @@ -13,14 +13,9 @@ var func = function() { return 1; }; -//CHECK#1 -if (typeof func !== 'function') { - throw new Test262Error('#1: func = function(){return 1;} is NOT an function'); -} +assert.sameValue(typeof func, 'function', 'The value of `typeof func` is expected to be "function"'); var n_obj = Object(func); -//CHECK#2 -if ((n_obj !== func) || (n_obj() !== 1)) { - throw new Test262Error('#2: Object(function) returns function'); -} +assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func'); +assert.sameValue(n_obj(), 1, 'n_obj() must return 1'); diff --git a/test/built-ins/Object/S15.2.1.1_A2_T9.js b/test/built-ins/Object/S15.2.1.1_A2_T9.js index 2757ec3608..f88904e5f7 100644 --- a/test/built-ins/Object/S15.2.1.1_A2_T9.js +++ b/test/built-ins/Object/S15.2.1.1_A2_T9.js @@ -10,19 +10,13 @@ description: > Calling Object function with function argument value. The function is declared ---*/ - -//CHECK#1 -if (typeof func !== 'function') { - throw new Test262Error('#1: func = function(){return 1;} is NOT an function'); +function func() { + return 1; } +assert.sameValue(typeof func, 'function', 'The value of `typeof func` is expected to be "function"'); + var n_obj = Object(func); -//CHECK#2 -if ((n_obj !== func) || (n_obj() !== 1)) { - throw new Test262Error('#2: Object(function) returns function'); -} - -function func() { - return 1; -}; +assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func'); +assert.sameValue(n_obj(), 1, 'n_obj() must return 1'); diff --git a/test/built-ins/Object/S15.2.1.1_A3_T1.js b/test/built-ins/Object/S15.2.1.1_A3_T1.js index d7921485dc..8723312bdc 100644 --- a/test/built-ins/Object/S15.2.1.1_A3_T1.js +++ b/test/built-ins/Object/S15.2.1.1_A3_T1.js @@ -11,17 +11,9 @@ description: Creating an object with "Object(1,2,3)" var obj = Object(1, 2, 3); -//CHECK#1 -if (obj.constructor !== Number) { - throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert(obj == 1, 'The result of evaluating (obj == 1) is expected to be true'); +assert.notSameValue(obj, 1, 'The value of obj is not 1'); -//CHECK#3 -if ((obj != 1) || (obj === 1)) { - throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} diff --git a/test/built-ins/Object/S15.2.1.1_A3_T2.js b/test/built-ins/Object/S15.2.1.1_A3_T2.js index afc5c2cf61..18f1d85be4 100644 --- a/test/built-ins/Object/S15.2.1.1_A3_T2.js +++ b/test/built-ins/Object/S15.2.1.1_A3_T2.js @@ -11,12 +11,5 @@ description: Creating an object with "Object(null,2,3)" var obj = Object(null, 2, 3); -//CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} - -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); diff --git a/test/built-ins/Object/S15.2.1.1_A3_T3.js b/test/built-ins/Object/S15.2.1.1_A3_T3.js index da1aef8148..2c5f6fea61 100644 --- a/test/built-ins/Object/S15.2.1.1_A3_T3.js +++ b/test/built-ins/Object/S15.2.1.1_A3_T3.js @@ -11,17 +11,9 @@ description: Creating an object with "Object((null,2,3),1,2)" var obj = Object((null, 2, 3), 1, 2); -//CHECK#1 -if (obj.constructor !== Number) { - throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert(obj == 3, 'The result of evaluating (obj == 3) is expected to be true'); +assert.notSameValue(obj, 3, 'The value of obj is not 3'); -//CHECK#3 -if ((obj != 3) || (obj === 3)) { - throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} diff --git a/test/built-ins/Object/S15.2.2.1_A1_T1.js b/test/built-ins/Object/S15.2.2.1_A1_T1.js index ce30cf9ab4..e48bcc7a93 100644 --- a/test/built-ins/Object/S15.2.2.1_A1_T1.js +++ b/test/built-ins/Object/S15.2.2.1_A1_T1.js @@ -16,28 +16,19 @@ description: Creating new Object() and checking its properties var obj = new Object(); -// CHECK#0 -if (obj === undefined) { - throw new Test262Error('#0: new Object() return the newly created native object.'); -} +assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); -// CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: new Object() create a new native ECMAScript object'); -} +assert( + !!Object.prototype.isPrototypeOf(obj), + 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' +); -// CHECK#2 -if (!(Object.prototype.isPrototypeOf(obj))) { - throw new Test262Error('#2: when new Object() calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.'); -} - -// CHECK#3 var to_string_result = '[object ' + 'Object' + ']'; -if (obj.toString() !== to_string_result) { - throw new Test262Error('#3: when new Object() calls the [[Class]] property of the newly constructed object is set to "Object".'); -} +assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); -// CHECK#4 -if (obj.valueOf().toString() !== to_string_result.toString()) { - throw new Test262Error('#4: when new Object() calls the newly constructed object has no [[Value]] property.'); -} +assert.sameValue( + obj.valueOf().toString(), + to_string_result.toString(), + 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()' +); diff --git a/test/built-ins/Object/S15.2.2.1_A1_T2.js b/test/built-ins/Object/S15.2.2.1_A1_T2.js index 27744917ff..7d2f16dcd6 100644 --- a/test/built-ins/Object/S15.2.2.1_A1_T2.js +++ b/test/built-ins/Object/S15.2.2.1_A1_T2.js @@ -17,28 +17,19 @@ description: Creating new Object(void 0) and checking its properties //var foo = void 0; var obj = new Object(void 0); -// CHECK#0 -if (obj === undefined) { - throw new Test262Error('#0: new Object(undefined) return the newly created native object.'); -} +assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); -// CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: new Object(undefined) create a new native ECMAScript object'); -} +assert( + !!Object.prototype.isPrototypeOf(obj), + 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' +); -// CHECK#2 -if (!(Object.prototype.isPrototypeOf(obj))) { - throw new Test262Error('#2: when new Object(undefined) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.'); -} - -// CHECK#3 var to_string_result = '[object ' + 'Object' + ']'; -if (obj.toString() !== to_string_result) { - throw new Test262Error('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".'); -} +assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); -// CHECK#4 -if (obj.valueOf().toString() !== to_string_result.toString()) { - throw new Test262Error('#4: when new Object(undefined) calls the newly constructed object has no [[Value]] property.'); -} +assert.sameValue( + obj.valueOf().toString(), + to_string_result.toString(), + 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()' +); diff --git a/test/built-ins/Object/S15.2.2.1_A1_T3.js b/test/built-ins/Object/S15.2.2.1_A1_T3.js index 847e93b180..1c2bfb061a 100644 --- a/test/built-ins/Object/S15.2.2.1_A1_T3.js +++ b/test/built-ins/Object/S15.2.2.1_A1_T3.js @@ -16,28 +16,19 @@ description: Creating new Object(null) and checking its properties var obj = new Object(null); -// CHECK#0 -if (obj === undefined) { - throw new Test262Error('#0: new Object(null) return the newly created native object.'); -} +assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); -// CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: new Object(null) create a new native ECMAScript object'); -} +assert( + !!Object.prototype.isPrototypeOf(obj), + 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' +); -// CHECK#2 -if (!(Object.prototype.isPrototypeOf(obj))) { - throw new Test262Error('#2: when new Object(null) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.'); -} - -// CHECK#3 var to_string_result = '[object ' + 'Object' + ']'; -if (obj.toString() !== to_string_result) { - throw new Test262Error('#3: when new Object(null) calls the [[Class]] property of the newly constructed object is set to "Object".'); -} +assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); -// CHECK#4 -if (obj.valueOf().toString() !== to_string_result.toString()) { - throw new Test262Error('#4: when new Object(null) calls the newly constructed object has no [[Value]] property.'); -} +assert.sameValue( + obj.valueOf().toString(), + to_string_result.toString(), + 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()' +); diff --git a/test/built-ins/Object/S15.2.2.1_A1_T4.js b/test/built-ins/Object/S15.2.2.1_A1_T4.js index 8b0cfab4b9..a1e4aba13e 100644 --- a/test/built-ins/Object/S15.2.2.1_A1_T4.js +++ b/test/built-ins/Object/S15.2.2.1_A1_T4.js @@ -16,28 +16,19 @@ description: Creating new Object(undefined) and checking its properties var obj = new Object(undefined); -// CHECK#0 -if (obj === undefined) { - throw new Test262Error('#0: new Object(undefined) return the newly created native object.'); -} +assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); -// CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: new Object(undefined) create a new native ECMAScript object'); -} +assert( + !!Object.prototype.isPrototypeOf(obj), + 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' +); -// CHECK#2 -if (!(Object.prototype.isPrototypeOf(obj))) { - throw new Test262Error('#2: when new Object(undefined) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.'); -} - -// CHECK#3 var to_string_result = '[object ' + 'Object' + ']'; -if (obj.toString() !== to_string_result) { - throw new Test262Error('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".'); -} +assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); -// CHECK#4 -if (obj.valueOf().toString() !== to_string_result.toString()) { - throw new Test262Error('#4: when new Object(undefined) calls the newly constructed object has no [[Value]] property.'); -} +assert.sameValue( + obj.valueOf().toString(), + to_string_result.toString(), + 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()' +); diff --git a/test/built-ins/Object/S15.2.2.1_A1_T5.js b/test/built-ins/Object/S15.2.2.1_A1_T5.js index 294b220995..2c699677b0 100644 --- a/test/built-ins/Object/S15.2.2.1_A1_T5.js +++ b/test/built-ins/Object/S15.2.2.1_A1_T5.js @@ -18,30 +18,21 @@ description: > var obj = new Object(x); -// CHECK#0 -if (obj === undefined) { - throw new Test262Error('#0: new Object(undefined) return the newly created native object.'); -} +assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); -// CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: new Object(undefined) create a new native ECMAScript object'); -} +assert( + !!Object.prototype.isPrototypeOf(obj), + 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' +); -// CHECK#2 -if (!(Object.prototype.isPrototypeOf(obj))) { - throw new Test262Error('#2: when new Object(undefined) calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.'); -} - -// CHECK#3 var to_string_result = '[object ' + 'Object' + ']'; -if (obj.toString() !== to_string_result) { - throw new Test262Error('#3: when new Object(undefined) calls the [[Class]] property of the newly constructed object is set to "Object".'); -} +assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); -// CHECK#4 -if (obj.valueOf().toString() !== to_string_result.toString()) { - throw new Test262Error('#4: when new Object(undefined) calls the newly constructed object has no [[Value]] property.'); -} +assert.sameValue( + obj.valueOf().toString(), + to_string_result.toString(), + 'obj.valueOf().toString() must return the same value returned by to_string_result.toString()' +); var x; diff --git a/test/built-ins/Object/S15.2.2.1_A2_T1.js b/test/built-ins/Object/S15.2.2.1_A2_T1.js index c6593fe6da..9482ac7aa1 100644 --- a/test/built-ins/Object/S15.2.2.1_A2_T1.js +++ b/test/built-ins/Object/S15.2.2.1_A2_T1.js @@ -15,12 +15,5 @@ var obj = { var n_obj = new Object(obj); -//CHECK#1 -if (n_obj !== obj) { - throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns.'); -} - -//CHECK#2 -if (n_obj['prop'] !== 1) { - throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns.'); -} +assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj'); +assert.sameValue(n_obj['prop'], 1, 'The value of n_obj["prop"] is expected to be 1'); diff --git a/test/built-ins/Object/S15.2.2.1_A2_T2.js b/test/built-ins/Object/S15.2.2.1_A2_T2.js index 16052dd49a..0fe7b97e7e 100644 --- a/test/built-ins/Object/S15.2.2.1_A2_T2.js +++ b/test/built-ins/Object/S15.2.2.1_A2_T2.js @@ -15,13 +15,5 @@ var func = function() { var n_obj = new Object(func); -//CHECK#1 -if (n_obj !== func) { - throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns'); -} - -//CHECK#2 -if (n_obj() !== 1) { - throw new Test262Error('When the Object constructor is called and if the value is an Object simply value returns'); -} -// +assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func'); +assert.sameValue(n_obj(), 1, 'n_obj() must return 1'); diff --git a/test/built-ins/Object/S15.2.2.1_A2_T3.js b/test/built-ins/Object/S15.2.2.1_A2_T3.js index 5102962688..867a091b40 100644 --- a/test/built-ins/Object/S15.2.2.1_A2_T3.js +++ b/test/built-ins/Object/S15.2.2.1_A2_T3.js @@ -15,12 +15,5 @@ var n_obj = new Object(arr); arr.push(4); -//CHECK#1 -if (n_obj !== arr) { - throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns.'); -} - -//CHECK#2 -if (n_obj[3] !== 4) { - throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns.'); -} +assert.sameValue(n_obj, arr, 'The value of n_obj is expected to equal the value of arr'); +assert.sameValue(n_obj[3], 4, 'The value of n_obj[3] is expected to be 4'); diff --git a/test/built-ins/Object/S15.2.2.1_A2_T5.js b/test/built-ins/Object/S15.2.2.1_A2_T5.js index 1bf78b9028..70bfd0e11f 100644 --- a/test/built-ins/Object/S15.2.2.1_A2_T5.js +++ b/test/built-ins/Object/S15.2.2.1_A2_T5.js @@ -13,12 +13,6 @@ var obj = new Date(1978, 3); var n_obj = new Object(obj); -//CHECK#1 -if (n_obj !== obj) { - throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns.'); -} - -//CHECK#2 -if ((n_obj.getFullYear() !== 1978) || (n_obj.getMonth() !== 3)) { - throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns.'); -} +assert.sameValue(n_obj, obj, 'The value of n_obj is expected to equal the value of obj'); +assert.sameValue(n_obj.getFullYear(), 1978, 'n_obj.getFullYear() must return 1978'); +assert.sameValue(n_obj.getMonth(), 3, 'n_obj.getMonth() must return 3'); diff --git a/test/built-ins/Object/S15.2.2.1_A2_T6.js b/test/built-ins/Object/S15.2.2.1_A2_T6.js index 211032c595..81c5d5503c 100644 --- a/test/built-ins/Object/S15.2.2.1_A2_T6.js +++ b/test/built-ins/Object/S15.2.2.1_A2_T6.js @@ -11,16 +11,9 @@ description: The value is a declared function var n_obj = new Object(func); -//CHECK#1 -if (n_obj !== func) { - throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns'); -} - -//CHECK#2 -if (n_obj() !== 1) { - throw new Test262Error('When the Object constructor is called and if the value is an Object simply value returns'); -} +assert.sameValue(n_obj, func, 'The value of n_obj is expected to equal the value of func'); +assert.sameValue(n_obj(), 1, 'n_obj() must return 1'); function func() { return 1; -}; +} diff --git a/test/built-ins/Object/S15.2.2.1_A2_T7.js b/test/built-ins/Object/S15.2.2.1_A2_T7.js index dd1675e74c..d931901d08 100644 --- a/test/built-ins/Object/S15.2.2.1_A2_T7.js +++ b/test/built-ins/Object/S15.2.2.1_A2_T7.js @@ -8,27 +8,17 @@ info: | es5id: 15.2.2.1_A2_T7 description: The value is a function declaration ---*/ - -//CHECK#0 -if (typeof func !== 'undefined') { - throw new Test262Error('#0: function expression can\'t be declarated'); -} +assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"'); var n_obj = new Object(function func() { return 1; }); -//CHECK#1 -if (n_obj.constructor !== Function) { - throw new Test262Error('#1: When the Object constructor is called and if the value is an Object simply value returns'); -} +assert.sameValue( + n_obj.constructor, + Function, + 'The value of n_obj.constructor is expected to equal the value of Function' +); -//CHECK#2 -if (n_obj() !== 1) { - throw new Test262Error('#2: When the Object constructor is called and if the value is an Object simply value returns'); -} - -//CHECK#3 -if (typeof func !== 'undefined') { - throw new Test262Error('#3: function expression can\'t be declarated'); -} +assert.sameValue(n_obj(), 1, 'n_obj() must return 1'); +assert.sameValue(typeof func, 'undefined', 'The value of `typeof func` is expected to be "undefined"'); diff --git a/test/built-ins/Object/S15.2.2.1_A3_T1.js b/test/built-ins/Object/S15.2.2.1_A3_T1.js index 54aa6c1daf..55a075dd4b 100644 --- a/test/built-ins/Object/S15.2.2.1_A3_T1.js +++ b/test/built-ins/Object/S15.2.2.1_A3_T1.js @@ -11,30 +11,12 @@ description: Argument value is a nonempty string var str = 'Obi-Wan Kenobi'; -//CHECK#1 -if (typeof str !== 'string') { - throw new Test262Error('#1: "Obi-Wan Kenobi" is NOT a String'); -} +assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"'); var n_obj = new Object(str); -//CHECK#2 -if (n_obj.constructor !== String) { - throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#4 -if (n_obj != str) { - throw new Test262Error('#4: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#5 -if (n_obj === str) { - throw new Test262Error('#5: When the Object constructor is called with String argument return ToObject(string)'); -} +assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == str, 'The result of evaluating (n_obj == str) is expected to be true'); +assert.notSameValue(n_obj, str, 'The value of n_obj is expected to not equal the value of `str`'); diff --git a/test/built-ins/Object/S15.2.2.1_A3_T2.js b/test/built-ins/Object/S15.2.2.1_A3_T2.js index 3df6985a5a..6fc6c8baed 100644 --- a/test/built-ins/Object/S15.2.2.1_A3_T2.js +++ b/test/built-ins/Object/S15.2.2.1_A3_T2.js @@ -11,29 +11,11 @@ description: Argument value is an empty string var str = ''; -//CHECK#1 -if (typeof str !== 'string') { - throw new Test262Error('#1: "" is NOT a String'); -} +assert.sameValue(typeof str, 'string', 'The value of `typeof str` is expected to be "string"'); var n_obj = new Object(str); -//CHECK#2 -if (n_obj.constructor !== String) { - throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#4 -if (n_obj != str) { - throw new Test262Error('#4: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#5 -if (n_obj === str) { - throw new Test262Error('#5: When the Object constructor is called with String argument return ToObject(string)'); -} +assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == str, 'The result of evaluating (n_obj == str) is expected to be true'); +assert.notSameValue(n_obj, str, 'The value of n_obj is expected to not equal the value of `str`'); diff --git a/test/built-ins/Object/S15.2.2.1_A3_T3.js b/test/built-ins/Object/S15.2.2.1_A3_T3.js index f476237c96..436b6ea069 100644 --- a/test/built-ins/Object/S15.2.2.1_A3_T3.js +++ b/test/built-ins/Object/S15.2.2.1_A3_T3.js @@ -11,22 +11,7 @@ description: Argument value is sum of empty string and number var n_obj = new Object("" + 1); -//CHECK#2 -if (n_obj.constructor !== String) { - throw new Test262Error('#2: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#4 -if (n_obj != "1") { - throw new Test262Error('#4: When the Object constructor is called with String argument return ToObject(string)'); -} - -//CHECK#5 -if (n_obj === "1") { - throw new Test262Error('#5: When the Object constructor is called with String argument return ToObject(string)'); -} +assert.sameValue(n_obj.constructor, String, 'The value of n_obj.constructor is expected to equal the value of String'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == "1", 'The result of evaluating (n_obj == "1") is expected to be true'); +assert.notSameValue(n_obj, "1", 'The value of n_obj is not "1"'); diff --git a/test/built-ins/Object/S15.2.2.1_A4_T1.js b/test/built-ins/Object/S15.2.2.1_A4_T1.js index 147e0676b1..1a713921e9 100644 --- a/test/built-ins/Object/S15.2.2.1_A4_T1.js +++ b/test/built-ins/Object/S15.2.2.1_A4_T1.js @@ -11,29 +11,16 @@ description: Argument value is "true" var bool = true; -//CHECK#1 -if (typeof bool !== 'boolean') { - throw new Test262Error('#1: true is NOT a boolean'); -} +assert.sameValue(typeof bool, 'boolean', 'The value of `typeof bool` is expected to be "boolean"'); var n_obj = new Object(bool); -//CHECK#2 -if (n_obj.constructor !== Boolean) { - throw new Test262Error('#2: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} +assert.sameValue( + n_obj.constructor, + Boolean, + 'The value of n_obj.constructor is expected to equal the value of Boolean' +); -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} - -//CHECK#4 -if (n_obj != bool) { - throw new Test262Error('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} - -//CHECK#5 -if (n_obj === bool) { - throw new Test262Error('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == bool, 'The result of evaluating (n_obj == bool) is expected to be true'); +assert.notSameValue(n_obj, bool, 'The value of n_obj is expected to not equal the value of `bool`'); diff --git a/test/built-ins/Object/S15.2.2.1_A4_T2.js b/test/built-ins/Object/S15.2.2.1_A4_T2.js index 0e0676006a..ee3bf3dfdf 100644 --- a/test/built-ins/Object/S15.2.2.1_A4_T2.js +++ b/test/built-ins/Object/S15.2.2.1_A4_T2.js @@ -11,29 +11,16 @@ description: Argument value is "false" var bool = false; -//CHECK#1 -if (typeof bool !== 'boolean') { - throw new Test262Error('#1: false is NOT a boolean'); -} +assert.sameValue(typeof bool, 'boolean', 'The value of `typeof bool` is expected to be "boolean"'); var n_obj = new Object(bool); -//CHECK#2 -if (n_obj.constructor !== Boolean) { - throw new Test262Error('#2: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} +assert.sameValue( + n_obj.constructor, + Boolean, + 'The value of n_obj.constructor is expected to equal the value of Boolean' +); -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} - -//CHECK#4 -if (n_obj != bool) { - throw new Test262Error('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} - -//CHECK#5 -if (n_obj === bool) { - throw new Test262Error('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == bool, 'The result of evaluating (n_obj == bool) is expected to be true'); +assert.notSameValue(n_obj, bool, 'The value of n_obj is expected to not equal the value of `bool`'); diff --git a/test/built-ins/Object/S15.2.2.1_A4_T3.js b/test/built-ins/Object/S15.2.2.1_A4_T3.js index 3769cfc0ae..bee0284dec 100644 --- a/test/built-ins/Object/S15.2.2.1_A4_T3.js +++ b/test/built-ins/Object/S15.2.2.1_A4_T3.js @@ -11,22 +11,12 @@ description: Argument value is boolean expression var n_obj = new Object((1 === 1) && !(false)); -//CHECK#2 -if (n_obj.constructor !== Boolean) { - throw new Test262Error('#2: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} +assert.sameValue( + n_obj.constructor, + Boolean, + 'The value of n_obj.constructor is expected to equal the value of Boolean' +); -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} - -//CHECK#4 -if (n_obj != true) { - throw new Test262Error('#4: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} - -//CHECK#5 -if (n_obj === true) { - throw new Test262Error('#5: When the Object constructor is called with Boolean argument return ToObject(boolean)'); -} +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == true, 'The result of evaluating (n_obj == true) is expected to be true'); +assert.notSameValue(n_obj, true, 'The value of n_obj is not true'); diff --git a/test/built-ins/Object/S15.2.2.1_A5_T1.js b/test/built-ins/Object/S15.2.2.1_A5_T1.js index da2b630bfa..4951823f14 100644 --- a/test/built-ins/Object/S15.2.2.1_A5_T1.js +++ b/test/built-ins/Object/S15.2.2.1_A5_T1.js @@ -11,29 +11,11 @@ description: Argument value is any number var num = 1.0; -//CHECK#1 -if (typeof num !== 'number') { - throw new Test262Error('#1: 1.0 is NOT a number'); -} +assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"'); var n_obj = new Object(num); -//CHECK#2 -if (n_obj.constructor !== Number) { - throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#4 -if (n_obj != num) { - throw new Test262Error('#4: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#5 -if (n_obj === num) { - throw new Test262Error('#5: When the Object constructor is called with Number argument return ToObject(number)'); -} +assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == num, 'The result of evaluating (n_obj == num) is expected to be true'); +assert.notSameValue(n_obj, num, 'The value of n_obj is expected to not equal the value of `num`'); diff --git a/test/built-ins/Object/S15.2.2.1_A5_T2.js b/test/built-ins/Object/S15.2.2.1_A5_T2.js index 2e5e2fa924..5e70256cfe 100644 --- a/test/built-ins/Object/S15.2.2.1_A5_T2.js +++ b/test/built-ins/Object/S15.2.2.1_A5_T2.js @@ -11,19 +11,9 @@ description: Argument value is NaN var num = NaN; -//CHECK#1 -if (typeof num !== 'number') { - throw new Test262Error('#1: NaN is NOT a number'); -} +assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"'); var n_obj = new Object(num); -//CHECK#2 -if (n_obj.constructor !== Number) { - throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)'); -} +assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); diff --git a/test/built-ins/Object/S15.2.2.1_A5_T3.js b/test/built-ins/Object/S15.2.2.1_A5_T3.js index dd001ce384..db39aa271f 100644 --- a/test/built-ins/Object/S15.2.2.1_A5_T3.js +++ b/test/built-ins/Object/S15.2.2.1_A5_T3.js @@ -11,29 +11,11 @@ description: Argument value is Infinity var num = Infinity; -//CHECK#1 -if (typeof num !== 'number') { - throw new Test262Error('#1: Infinity is NOT a number'); -} +assert.sameValue(typeof num, 'number', 'The value of `typeof num` is expected to be "number"'); var n_obj = new Object(num); -//CHECK#2 -if (n_obj.constructor !== Number) { - throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#4 -if (n_obj != num) { - throw new Test262Error('#4: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#5 -if (n_obj === num) { - throw new Test262Error('#5: When the Object constructor is called with Number argument return ToObject(number)'); -} +assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == num, 'The result of evaluating (n_obj == num) is expected to be true'); +assert.notSameValue(n_obj, num, 'The value of n_obj is expected to not equal the value of `num`'); diff --git a/test/built-ins/Object/S15.2.2.1_A5_T4.js b/test/built-ins/Object/S15.2.2.1_A5_T4.js index 1abad02825..e4bf8628fe 100644 --- a/test/built-ins/Object/S15.2.2.1_A5_T4.js +++ b/test/built-ins/Object/S15.2.2.1_A5_T4.js @@ -13,22 +13,7 @@ var n_obj = new Object(2 * ([].length + { q: 1 }["q"])); -//CHECK#2 -if (n_obj.constructor !== Number) { - throw new Test262Error('#2: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#3 -if (typeof n_obj !== 'object') { - throw new Test262Error('#3: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#4 -if (n_obj != 2) { - throw new Test262Error('#4: When the Object constructor is called with Number argument return ToObject(number)'); -} - -//CHECK#5 -if (n_obj === 2) { - throw new Test262Error('#5: When the Object constructor is called with Number argument return ToObject(number)'); -} +assert.sameValue(n_obj.constructor, Number, 'The value of n_obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof n_obj, 'object', 'The value of `typeof n_obj` is expected to be "object"'); +assert(n_obj == 2, 'The result of evaluating (n_obj == 2) is expected to be true'); +assert.notSameValue(n_obj, 2, 'The value of n_obj is not 2'); diff --git a/test/built-ins/Object/S15.2.2.1_A6_T1.js b/test/built-ins/Object/S15.2.2.1_A6_T1.js index 8e68d11934..2dd43c0000 100644 --- a/test/built-ins/Object/S15.2.2.1_A6_T1.js +++ b/test/built-ins/Object/S15.2.2.1_A6_T1.js @@ -11,17 +11,8 @@ description: Creating an object with "new Object(1,2,3)" var obj = new Object(1, 2, 3); -//CHECK#1 -if (obj.constructor !== Number) { - throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(obj == 1, 'The result of evaluating (obj == 1) is expected to be true'); +assert.notSameValue(obj, 1, 'The value of obj is not 1'); -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} - -//CHECK#3 -if ((obj != 1) || (obj === 1)) { - throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} diff --git a/test/built-ins/Object/S15.2.2.1_A6_T2.js b/test/built-ins/Object/S15.2.2.1_A6_T2.js index f98242ba78..1b88acfcca 100644 --- a/test/built-ins/Object/S15.2.2.1_A6_T2.js +++ b/test/built-ins/Object/S15.2.2.1_A6_T2.js @@ -11,12 +11,5 @@ description: Creating an object with "new Object(null,2,3)" var obj = new Object(null, 2, 3); -//CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} - -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); diff --git a/test/built-ins/Object/S15.2.2.1_A6_T3.js b/test/built-ins/Object/S15.2.2.1_A6_T3.js index 8cf2e36893..24d3e41ec2 100644 --- a/test/built-ins/Object/S15.2.2.1_A6_T3.js +++ b/test/built-ins/Object/S15.2.2.1_A6_T3.js @@ -11,17 +11,7 @@ description: Creating an object with "new Object((null,2,3),2,3)" var obj = new Object((null, 2, 3), 1, 2); -//CHECK#1 -if (obj.constructor !== Number) { - throw new Test262Error('#1: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} - -//CHECK#2 -if (typeof obj !== "object") { - throw new Test262Error('#2: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} - -//CHECK#3 -if ((obj != 3) || (obj === 3)) { - throw new Test262Error('3#: Since Object as a function calling is the same as function calling list of arguments can appears in braces;'); -} +assert.sameValue(obj.constructor, Number, 'The value of obj.constructor is expected to equal the value of Number'); +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert(obj == 3, 'The result of evaluating (obj == 3) is expected to be true'); +assert.notSameValue(obj, 3, 'The value of obj is not 3'); diff --git a/test/built-ins/Object/S15.2.3_A1.js b/test/built-ins/Object/S15.2.3_A1.js index d95164824e..3a32528d5b 100644 --- a/test/built-ins/Object/S15.2.3_A1.js +++ b/test/built-ins/Object/S15.2.3_A1.js @@ -6,7 +6,7 @@ info: The Object constructor has the property "prototype" es5id: 15.2.3_A1 description: Checking existence of the property "prototype" ---*/ - -if (!Object.hasOwnProperty("prototype")) { - throw new Test262Error('#1: The Object constructor has the property "prototype"'); -} +assert( + !!Object.hasOwnProperty("prototype"), + 'The value of !!Object.hasOwnProperty("prototype") is expected to be true' +); diff --git a/test/built-ins/Object/S15.2.3_A2.js b/test/built-ins/Object/S15.2.3_A2.js index b9ec98f0c9..6c21a48f7f 100644 --- a/test/built-ins/Object/S15.2.3_A2.js +++ b/test/built-ins/Object/S15.2.3_A2.js @@ -8,8 +8,7 @@ info: | es5id: 15.2.3_A2 description: Checking Function.prototype.isPrototypeOf(Object) ---*/ - -// CHECK# -if (!(Function.prototype.isPrototypeOf(Object))) { - throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Object constructor is the Function prototype object.'); -} +assert( + !!Function.prototype.isPrototypeOf(Object), + 'The value of !!Function.prototype.isPrototypeOf(Object) is expected to be true' +); diff --git a/test/built-ins/Object/S15.2.3_A3.js b/test/built-ins/Object/S15.2.3_A3.js index cad0df324e..7089a87156 100644 --- a/test/built-ins/Object/S15.2.3_A3.js +++ b/test/built-ins/Object/S15.2.3_A3.js @@ -6,13 +6,9 @@ info: Object constructor has length property whose value is 1 es5id: 15.2.3_A3 description: Checking Object.length ---*/ +assert( + !!Object.hasOwnProperty("length"), + 'The value of !!Object.hasOwnProperty("length") is expected to be true' +); -//CHECK#1 -if (!Object.hasOwnProperty("length")) { - throw new Test262Error('#1: The Object constructor has the property "length"'); -} - -//CHECK#2 -if (Object.length !== 1) { - throw new Test262Error('#2: Object.length property value should be 1'); -} +assert.sameValue(Object.length, 1, 'The value of Object.length is expected to be 1'); diff --git a/test/built-ins/Object/S15.2_A1.js b/test/built-ins/Object/S15.2_A1.js index 23f9686492..8542173e2d 100644 --- a/test/built-ins/Object/S15.2_A1.js +++ b/test/built-ins/Object/S15.2_A1.js @@ -11,6 +11,4 @@ var obj = Object; var thisobj = this.Object; -if (obj !== thisobj) { - throw new Test262Error('Object is the property of global'); -} +assert.sameValue(obj, thisobj, 'The value of obj is expected to equal the value of thisobj'); diff --git a/test/built-ins/Object/S9.9_A3.js b/test/built-ins/Object/S9.9_A3.js index 97956ab66a..af8273a0b6 100644 --- a/test/built-ins/Object/S9.9_A3.js +++ b/test/built-ins/Object/S9.9_A3.js @@ -8,33 +8,20 @@ info: | es5id: 9.9_A3 description: Trying to convert from Boolean to Object ---*/ +assert.sameValue(Object(true).valueOf(), true, 'Object(true).valueOf() must return true'); +assert.sameValue(typeof Object(true), "object", 'The value of `typeof Object(true)` is expected to be "object"'); -// CHECK#1 -if (Object(true).valueOf() !== true) { - throw new Test262Error('#1: Object(true).valueOf() === true. Actual: ' + (Object(true).valueOf())); -} +assert.sameValue( + Object(true).constructor.prototype, + Boolean.prototype, + 'The value of Object(true).constructor.prototype is expected to equal the value of Boolean.prototype' +); -// CHECK#2 -if (typeof Object(true) !== "object") { - throw new Test262Error('#2: typeof Object(true) === "object". Actual: ' + (typeof Object(true))); -} +assert.sameValue(Object(false).valueOf(), false, 'Object(false).valueOf() must return false'); +assert.sameValue(typeof Object(false), "object", 'The value of `typeof Object(false)` is expected to be "object"'); -// CHECK#3 -if (Object(true).constructor.prototype !== Boolean.prototype) { - throw new Test262Error('#3: Object(true).constructor.prototype === Boolean.prototype. Actual: ' + (Object(true).constructor.prototype)); -} - -// CHECK#4 -if (Object(false).valueOf() !== false) { - throw new Test262Error('#4: Object(false).valueOf() === false. Actual: ' + (Object(false).valueOf())); -} - -// CHECK#5 -if (typeof Object(false) !== "object") { - throw new Test262Error('#5: typeof Object(false) === "object". Actual: ' + (typeof Object(false))); -} - -// CHECK#6 -if (Object(false).constructor.prototype !== Boolean.prototype) { - throw new Test262Error('#6: Object(false).constructor.prototype === Boolean.prototype. Actual: ' + (Object(false).constructor.prototype)); -} +assert.sameValue( + Object(false).constructor.prototype, + Boolean.prototype, + 'The value of Object(false).constructor.prototype is expected to equal the value of Boolean.prototype' +); diff --git a/test/built-ins/Object/S9.9_A4.js b/test/built-ins/Object/S9.9_A4.js index 7fc29a7aaf..904acd88dd 100644 --- a/test/built-ins/Object/S9.9_A4.js +++ b/test/built-ins/Object/S9.9_A4.js @@ -8,168 +8,142 @@ info: | es5id: 9.9_A4 description: Converting from various numbers to Object ---*/ +assert.sameValue(Object(0).valueOf(), 0, 'Object(0).valueOf() must return 0'); +assert.sameValue(typeof Object(0), "object", 'The value of `typeof Object(0)` is expected to be "object"'); -// CHECK#1 -if (Object(0).valueOf() !== 0) { - throw new Test262Error('#1: Object(0).valueOf() === 0. Actual: ' + (Object(0).valueOf())); -} +assert.sameValue( + Object(0).constructor.prototype, + Number.prototype, + 'The value of Object(0).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#2 -if (typeof Object(0) !== "object") { - throw new Test262Error('#2: typeof Object(0) === "object". Actual: ' + (typeof Object(0))); -} +assert.sameValue(Object(-0).valueOf(), -0, 'Object(-0).valueOf() must return -0'); +assert.sameValue(typeof Object(-0), "object", 'The value of `typeof Object(-0)` is expected to be "object"'); -// CHECK#3 -if (Object(0).constructor.prototype !== Number.prototype) { - throw new Test262Error('#3: Object(0).constructor.prototype === Number.prototype. Actual: ' + (Object(0).constructor.prototype)); -} +assert.sameValue( + Object(-0).constructor.prototype, + Number.prototype, + 'The value of Object(-0).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#4 -if (Object(-0).valueOf() !== -0) { - throw new Test262Error('#4.1: Object(-0).valueOf() === 0. Actual: ' + (Object(-0).valueOf())); -} else if (1 / Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) { - throw new Test262Error('#4.2: Object(-0).valueOf() === -0. Actual: +0'); -} +assert.sameValue(Object(1).valueOf(), 1, 'Object(1).valueOf() must return 1'); +assert.sameValue(typeof Object(1), "object", 'The value of `typeof Object(1)` is expected to be "object"'); -// CHECK#5 -if (typeof Object(-0) !== "object") { - throw new Test262Error('#5: typeof Object(-0) === "object". Actual: ' + (typeof Object(-0))); -} +assert.sameValue( + Object(1).constructor.prototype, + Number.prototype, + 'The value of Object(1).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#6 -if (Object(-0).constructor.prototype !== Number.prototype) { - throw new Test262Error('#6: Object(-0).constructor.prototype === Number.prototype. Actual: ' + (Object(-0).constructor.prototype)); -} +assert.sameValue(Object(-1).valueOf(), -1, 'Object(-1).valueOf() must return -1'); +assert.sameValue(typeof Object(-1), "object", 'The value of `typeof Object(-1)` is expected to be "object"'); -// CHECK#7 -if (Object(1).valueOf() !== 1) { - throw new Test262Error('#7: Object(1).valueOf() === 1. Actual: ' + (Object(1).valueOf())); -} +assert.sameValue( + Object(-1).constructor.prototype, + Number.prototype, + 'The value of Object(-1).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#8 -if (typeof Object(1) !== "object") { - throw new Test262Error('#8: typeof Object(1) === "object". Actual: ' + (typeof Object(1))); -} +assert.sameValue( + Object(Number.MIN_VALUE).valueOf(), + Number.MIN_VALUE, + 'Object(Number.MIN_VALUE).valueOf() returns Number.MIN_VALUE' +); -// CHECK#9 -if (Object(1).constructor.prototype !== Number.prototype) { - throw new Test262Error('#9: Object(1).constructor.prototype === Number.prototype. Actual: ' + (Object(1).constructor.prototype)); -} +assert.sameValue( + typeof Object(Number.MIN_VALUE), + "object", + 'The value of `typeof Object(Number.MIN_VALUE)` is expected to be "object"' +); -// CHECK#10 -if (Object(-1).valueOf() !== -1) { - throw new Test262Error('#10: Object(-1).valueOf() === -1. Actual: ' + (Object(-1).valueOf())); -} +assert.sameValue( + Object(Number.MIN_VALUE).constructor.prototype, + Number.prototype, + 'The value of Object(Number.MIN_VALUE).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#11 -if (typeof Object(-1) !== "object") { - throw new Test262Error('#11: typeof Object(-1) === "object". Actual: ' + (typeof Object(-1))); -} +assert.sameValue( + Object(Number.MAX_VALUE).valueOf(), + Number.MAX_VALUE, + 'Object(Number.MAX_VALUE).valueOf() returns Number.MAX_VALUE' +); -// CHECK#12 -if (Object(-1).constructor.prototype !== Number.prototype) { - throw new Test262Error('#12: Object(-1).constructor.prototype === Number.prototype. Actual: ' + (Object(-1).constructor.prototype)); -} +assert.sameValue( + typeof Object(Number.MAX_VALUE), + "object", + 'The value of `typeof Object(Number.MAX_VALUE)` is expected to be "object"' +); -// CHECK#13 -if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE) { - throw new Test262Error('#13: Object(Number.MIN_VALUE).valueOf() === Number.MIN_VALUE. Actual: ' + (Object(Number.MIN_VALUE).valueOf())); -} +assert.sameValue( + Object(Number.MAX_VALUE).constructor.prototype, + Number.prototype, + 'The value of Object(Number.MAX_VALUE).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#14 -if (typeof Object(Number.MIN_VALUE) !== "object") { - throw new Test262Error('#14: typeof Object(Number.MIN_VALUE) === "object". Actual: ' + (typeof Object(Number.MIN_VALUE))); -} +assert.sameValue( + Object(Number.POSITIVE_INFINITY).valueOf(), + Number.POSITIVE_INFINITY, + 'Object(Number.POSITIVE_INFINITY).valueOf() returns Number.POSITIVE_INFINITY' +); -// CHECK#15 -if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype) { - throw new Test262Error('#15: Object(Number.MIN_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MIN_VALUE).constructor.prototype)); -} +assert.sameValue( + typeof Object(Number.POSITIVE_INFINITY), + "object", + 'The value of `typeof Object(Number.POSITIVE_INFINITY)` is expected to be "object"' +); -// CHECK#16 -if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE) { - throw new Test262Error('#16: Object(Number.MAX_VALUE).valueOf() === Number.MAX_VALUE. Actual: ' + (Object(Number.MAX_VALUE).valueOf())); -} +assert.sameValue( + Object(Number.POSITIVE_INFINITY).constructor.prototype, + Number.prototype, + 'The value of Object(Number.POSITIVE_INFINITY).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#17 -if (typeof Object(Number.MAX_VALUE) !== "object") { - throw new Test262Error('#17: typeof Object(Number.MAX_VALUE) === "object". Actual: ' + (typeof Object(Number.MAX_VALUE))); -} +assert.sameValue( + Object(Number.NEGATIVE_INFINITY).valueOf(), + Number.NEGATIVE_INFINITY, + 'Object(Number.NEGATIVE_INFINITY).valueOf() returns Number.NEGATIVE_INFINITY' +); -// CHECK#18 -if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype) { - throw new Test262Error('#18: Object(Number.MAX_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MAX_VALUE).constructor.prototype)); -} +assert.sameValue( + typeof Object(Number.NEGATIVE_INFINITY), + "object", + 'The value of `typeof Object(Number.NEGATIVE_INFINITY)` is expected to be "object"' +); -// CHECK#19 -if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY) { - throw new Test262Error('#19: Object(Number.POSITIVE_INFINITY).valueOf() === Number.POSITIVE_INFINITY. Actual: ' + (Object(Number.POSITIVE_INFINITY).valueOf())); -} +assert.sameValue( + Object(Number.NEGATIVE_INFINITY).constructor.prototype, + Number.prototype, + 'The value of Object(Number.NEGATIVE_INFINITY).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#20 -if (typeof Object(Number.POSITIVE_INFINITY) !== "object") { - throw new Test262Error('#20: typeof Object(Number.POSITIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.POSITIVE_INFINITY))); -} +assert.sameValue(Object(NaN).valueOf(), NaN, 'Object(NaN).valueOf() returns NaN'); -// CHECK#21 -if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype) { - throw new Test262Error('#21: Object(Number.POSITIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.POSITIVE_INFINITY).constructor.prototype)); -} +assert.sameValue( + typeof Object(Number.NaN), + "object", + 'The value of `typeof Object(Number.NaN)` is expected to be "object"' +); -// CHECK#22 -if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY) { - throw new Test262Error('#22: Object(Number.NEGATIVE_INFINITY).valueOf() === Number.NEGATIVE_INFINITY. Actual: ' + (Object(Number.NEGATIVE_INFINITY).valueOf())); -} +assert.sameValue( + Object(Number.NaN).constructor.prototype, + Number.prototype, + 'The value of Object(Number.NaN).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#23 -if (typeof Object(Number.NEGATIVE_INFINITY) !== "object") { - throw new Test262Error('#23: typeof Object(Number.NEGATIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.NEGATIVE_INFINITY))); -} +assert.sameValue(Object(1.2345).valueOf(), 1.2345, 'Object(1.2345).valueOf() must return 1.2345'); +assert.sameValue(typeof Object(1.2345), "object", 'The value of `typeof Object(1.2345)` is expected to be "object"'); -// CHECK#24 -if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype) { - throw new Test262Error('#24: Object(Number.NEGATIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NEGATIVE_INFINITY).constructor.prototype)); -} +assert.sameValue( + Object(1.2345).constructor.prototype, + Number.prototype, + 'The value of Object(1.2345).constructor.prototype is expected to equal the value of Number.prototype' +); -// CHECK#25 -assert.sameValue(Object(NaN).valueOf(), NaN, "Object(NaN).valueOf()"); +assert.sameValue(Object(-1.2345).valueOf(), -1.2345, 'Object(-1.2345).valueOf() must return -1.2345'); +assert.sameValue(typeof Object(-1.2345), "object", 'The value of `typeof Object(-1.2345)` is expected to be "object"'); -// CHECK#26 -if (typeof Object(Number.NaN) !== "object") { - throw new Test262Error('#26: typeof Object(Number.NaN) === "object". Actual: ' + (typeof Object(Number.NaN))); -} - -// CHECK#27 -if (Object(Number.NaN).constructor.prototype !== Number.prototype) { - throw new Test262Error('#27: Object(Number.NaN).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NaN).constructor.prototype)); -} - -// CHECK#28 -if (Object(1.2345).valueOf() !== 1.2345) { - throw new Test262Error('#28: Object(1.2345).valueOf() === 1.2345. Actual: ' + (Object(1.2345).valueOf())); -} - -// CHECK#29 -if (typeof Object(1.2345) !== "object") { - throw new Test262Error('#29: typeof Object(1.2345) === "object". Actual: ' + (typeof Object(1.2345))); -} - -// CHECK#30 -if (Object(1.2345).constructor.prototype !== Number.prototype) { - throw new Test262Error('#30: Object(1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(1.2345).constructor.prototype)); -} - -// CHECK#31 -if (Object(-1.2345).valueOf() !== -1.2345) { - throw new Test262Error('#31: Object(-1.2345).valueOf() === -1.2345. Actual: ' + (Object(-1.2345).valueOf())); -} - -// CHECK#32 -if (typeof Object(-1.2345) !== "object") { - throw new Test262Error('#32: typeof Object(-1.2345) === "object". Actual: ' + (typeof Object(-1.2345))); -} - -// CHECK#33 -if (Object(-1.2345).constructor.prototype !== Number.prototype) { - throw new Test262Error('#33: Object(-1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(-1.2345).constructor.prototype)); -} +assert.sameValue( + Object(-1.2345).constructor.prototype, + Number.prototype, + 'The value of Object(-1.2345).constructor.prototype is expected to equal the value of Number.prototype' +); diff --git a/test/built-ins/Object/S9.9_A5.js b/test/built-ins/Object/S9.9_A5.js index 32c7744775..6331c65ce1 100644 --- a/test/built-ins/Object/S9.9_A5.js +++ b/test/built-ins/Object/S9.9_A5.js @@ -8,63 +8,57 @@ info: | es5id: 9.9_A5 description: Converting from various strings to Object ---*/ +assert.sameValue( + Object("some string").valueOf(), + "some string", + 'Object("some string").valueOf() must return "some string"' +); -// CHECK#1 -if (Object("some string").valueOf() !== "some string") { - throw new Test262Error('#1: Object("some string").valueOf() === "some string". Actual: ' + (Object("some string").valueOf())); -} +assert.sameValue( + typeof Object("some string"), + "object", + 'The value of `typeof Object("some string")` is expected to be "object"' +); -// CHECK#2 -if (typeof Object("some string") !== "object") { - throw new Test262Error('#2: typeof Object("some string") === "object". Actual: ' + (typeof Object("some string"))); -} +assert.sameValue( + Object("some string").constructor.prototype, + String.prototype, + 'The value of Object("some string").constructor.prototype is expected to equal the value of String.prototype' +); -// CHECK#3 -if (Object("some string").constructor.prototype !== String.prototype) { - throw new Test262Error('#3: Object("some string").constructor.prototype === String.prototype. Actual: ' + (Object("some string").constructor.prototype)); -} +assert.sameValue(Object("").valueOf(), "", 'Object("").valueOf() must return ""'); +assert.sameValue(typeof Object(""), "object", 'The value of `typeof Object("")` is expected to be "object"'); -// CHECK#4 -if (Object("").valueOf() !== "") { - throw new Test262Error('#4: Object("").valueOf() === false. Actual: ' + (Object("").valueOf())); -} +assert.sameValue( + Object("").constructor.prototype, + String.prototype, + 'The value of Object("").constructor.prototype is expected to equal the value of String.prototype' +); -// CHECK#5 -if (typeof Object("") !== "object") { - throw new Test262Error('#5: typeof Object("") === "object". Actual: ' + (typeof Object(""))); -} +assert.sameValue(Object("\r\t\b\n\v\f").valueOf(), "\r\t\b\n\v\f", 'Object("rtbnvf").valueOf() must return "rtbnvf"'); -// CHECK#6 -if (Object("").constructor.prototype !== String.prototype) { - throw new Test262Error('#6: Object("").constructor.prototype === String.prototype. Actual: ' + (Object("").constructor.prototype)); -} +assert.sameValue( + typeof Object("\r\t\b\n\v\f"), + "object", + 'The value of `typeof Object("rtbnvf")` is expected to be "object"' +); -// CHECK#7 -if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f") { - throw new Test262Error('#7: Object("\\r\\t\\b\\n\\v\\f").valueOf() === false. Actual: ' + (Object("\r\t\b\n\v\f").valueOf())); -} +assert.sameValue( + Object("\r\t\b\n\v\f").constructor.prototype, + String.prototype, + 'The value of Object("rtbnvf").constructor.prototype is expected to equal the value of String.prototype' +); -// CHECK#8 -if (typeof Object("\r\t\b\n\v\f") !== "object") { - throw new Test262Error('#8: typeof Object("\\r\\t\\b\\n\\v\\f") === "object". Actual: ' + (typeof Object("\r\t\b\n\v\f"))); -} +assert.sameValue(Object(String(10)).valueOf(), "10", 'Object(String(10)).valueOf() must return "10"'); -// CHECK#9 -if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype) { - throw new Test262Error('#9: Object("\\r\\t\\b\\n\\v\\f").constructor.prototype === String.prototype. Actual: ' + (Object("\r\t\b\n\v\f").constructor.prototype)); -} +assert.sameValue( + typeof Object(String(10)), + "object", + 'The value of `typeof Object(String(10))` is expected to be "object"' +); -// CHECK#10 -if (Object(String(10)).valueOf() !== "10") { - throw new Test262Error('#10: Object(String(10)).valueOf() === false. Actual: ' + (Object(String(10)).valueOf())); -} - -// CHECK#11 -if (typeof Object(String(10)) !== "object") { - throw new Test262Error('#11: typeof Object(String(10)) === "object". Actual: ' + (typeof Object(String(10)))); -} - -// CHECK#12 -if (Object(String(10)).constructor.prototype !== String.prototype) { - throw new Test262Error('#12: Object(String(10)).constructor.prototype === String.prototype. Actual: ' + (Object(String(10)).constructor.prototype)); -} +assert.sameValue( + Object(String(10)).constructor.prototype, + String.prototype, + 'The value of Object(String(10)).constructor.prototype is expected to equal the value of String.prototype' +); diff --git a/test/built-ins/Object/S9.9_A6.js b/test/built-ins/Object/S9.9_A6.js index 15bfe5b0dd..cc222a5626 100644 --- a/test/built-ins/Object/S9.9_A6.js +++ b/test/built-ins/Object/S9.9_A6.js @@ -19,23 +19,13 @@ function MyObject(val) { var x = new MyObject(1); var y = Object(x); -// CHECK#1 -if (y.valueOf() !== x.valueOf()) { - throw new Test262Error('#1: Object(obj).valueOf() === obj.valueOf(). Actual: ' + (Object(obj).valueOf())); -} +assert.sameValue(y.valueOf(), x.valueOf(), 'y.valueOf() must return the same value returned by x.valueOf()'); +assert.sameValue(typeof y, typeof x, 'The value of `typeof y` is expected to be typeof x'); -// CHECK#2 -if (typeof y !== typeof x) { - throw new Test262Error('#2: typeof Object(obj) === typeof obj. Actual: ' + (typeof Object(obj))); -} +assert.sameValue( + y.constructor.prototype, + x.constructor.prototype, + 'The value of y.constructor.prototype is expected to equal the value of x.constructor.prototype' +); -// CHECK#3 -if (y.constructor.prototype !== x.constructor.prototype) { - throw new Test262Error('#3: Object(obj).constructor.prototype === obj.constructor.prototype. Actual: ' + (Object(obj).constructor.prototype)); -} - - -// CHECK#4 -if (y !== x) { - throw new Test262Error('#4: Object(obj) === obj'); -} +assert.sameValue(y, x, 'The value of y is expected to equal the value of x'); diff --git a/test/built-ins/Object/assign/Source-Null-Undefined.js b/test/built-ins/Object/assign/Source-Null-Undefined.js index b41e102fc0..e81ee1179d 100644 --- a/test/built-ins/Object/assign/Source-Null-Undefined.js +++ b/test/built-ins/Object/assign/Source-Null-Undefined.js @@ -9,4 +9,4 @@ esid: sec-object.assign var target = new Object(); var result = Object.assign(target, undefined, null); -assert.sameValue(result, target, "null and undefined should be ignored, result should be original object."); +assert.sameValue(result, target, 'The value of result is expected to equal the value of target'); diff --git a/test/built-ins/Object/assign/Source-Number-Boolen-Symbol.js b/test/built-ins/Object/assign/Source-Number-Boolen-Symbol.js index 69ef3499a3..2949fc8723 100644 --- a/test/built-ins/Object/assign/Source-Number-Boolen-Symbol.js +++ b/test/built-ins/Object/assign/Source-Number-Boolen-Symbol.js @@ -12,4 +12,4 @@ features: [Symbol] var target = new Object(); var result = Object.assign(target, 123, true, Symbol('foo')); -assert.sameValue(result, target, "Numbers, booleans, and symbols cannot have wrappers with own enumerable properties."); +assert.sameValue(result, target, 'The value of result is expected to equal the value of target'); diff --git a/test/built-ins/Object/assign/Source-String.js b/test/built-ins/Object/assign/Source-String.js index 78e006461e..3b0decd047 100644 --- a/test/built-ins/Object/assign/Source-String.js +++ b/test/built-ins/Object/assign/Source-String.js @@ -9,6 +9,6 @@ esid: sec-object.assign var target = new Object(); var result = Object.assign(target, "123"); -assert.sameValue(result[0], "1", "The value should be {\"0\":\"1\"}."); -assert.sameValue(result[1], "2", "The value should be {\"1\":\"2\"}."); -assert.sameValue(result[2], "3", "The value should be {\"2\":\"3\"}."); +assert.sameValue(result[0], "1", 'The value of result[0] is expected to be "1"'); +assert.sameValue(result[1], "2", 'The value of result[1] is expected to be "2"'); +assert.sameValue(result[2], "3", 'The value of result[2] is expected to be "3"'); diff --git a/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js b/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js index c4ee2d69c0..5f552e99c8 100644 --- a/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js +++ b/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js @@ -31,8 +31,6 @@ if (typeof document !== 'undefined' && } if (!refused) { var desc = Object.getOwnPropertyDescriptor(f, 'foo'); - if (desc.get !== getter) { - throw new Test262Error('Getter on HTMLFormElement disappears'); - } + assert.sameValue(desc.get, getter, 'The value of desc.get is expected to equal the value of getter'); } } diff --git a/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js b/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js index 2df9f1cde3..8f472abffd 100644 --- a/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js +++ b/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js @@ -17,6 +17,8 @@ function getter() { Object.defineProperty(base, 'foo', { get: getter }); -if (derived.hasOwnProperty('foo')) { - throw new Test262Error('Accessor properties inherit as own properties'); -} + +assert( + !derived.hasOwnProperty('foo'), + 'The value of !derived.hasOwnProperty("foo") is expected to be true' +); diff --git a/test/built-ins/Object/getOwnPropertyNames/S15.2.3.4_A1_T1.js b/test/built-ins/Object/getOwnPropertyNames/S15.2.3.4_A1_T1.js index 14c8bb9b11..d1675e1141 100644 --- a/test/built-ins/Object/getOwnPropertyNames/S15.2.3.4_A1_T1.js +++ b/test/built-ins/Object/getOwnPropertyNames/S15.2.3.4_A1_T1.js @@ -16,7 +16,5 @@ function foo() {} var names = Object.getOwnPropertyNames(foo); for (var i = 0, len = names.length; i < len; i++) { - if (!foo.hasOwnProperty(names[i])) { - throw new Test262Error('Phantom own property: ' + names[i]); - } + assert(!!foo.hasOwnProperty(names[i]), 'The value of !!foo.hasOwnProperty(names[i]) is expected to be true'); } diff --git a/test/built-ins/Object/prototype/S15.2.3.1_A1.js b/test/built-ins/Object/prototype/S15.2.3.1_A1.js index 95bf68c92d..5af364c7ce 100644 --- a/test/built-ins/Object/prototype/S15.2.3.1_A1.js +++ b/test/built-ins/Object/prototype/S15.2.3.1_A1.js @@ -13,15 +13,15 @@ verifyNotWritable(Object, "prototype", null, function() { return "shifted"; }); -//CHECK#1 -if (Object.prototype !== obj) { - throw new Test262Error('#1: the Object.prototype property has the attributes ReadOnly.'); -} +assert.sameValue(Object.prototype, obj, 'The value of Object.prototype is expected to equal the value of obj'); -//CHECK#2 try { Object.prototype(); throw new Test262Error('#2: the Object.prototype property has the attributes ReadOnly'); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/S15.2.3.1_A2.js b/test/built-ins/Object/prototype/S15.2.3.1_A2.js index 904495076f..d40f6ea021 100644 --- a/test/built-ins/Object/prototype/S15.2.3.1_A2.js +++ b/test/built-ins/Object/prototype/S15.2.3.1_A2.js @@ -6,19 +6,19 @@ info: The Object.prototype property has the attribute DontEnum es5id: 15.2.3.1_A2 description: Checking if enumerating "Object.prototype" property fails ---*/ +assert( + !Object.propertyIsEnumerable('prototype'), + 'The value of !Object.propertyIsEnumerable("prototype") is expected to be true' +); -// CHECK#1 -if (Object.propertyIsEnumerable('prototype')) { - throw new Test262Error('#1: the Object.prototype property has the attributes DontEnum'); -} - -// CHECK#2 var cout = 0; for (var p in Object) { - if (p === "prototype") cout++; + if (p === "prototype") { + cout++; + } } -if (cout !== 0) { - throw new Test262Error('#2: the Object.prototype property has the attributes DontEnum'); -} +assert.sameValue(cout, 0, 'The value of cout is expected to be 0'); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/S15.2.3.1_A3.js b/test/built-ins/Object/prototype/S15.2.3.1_A3.js index dc24eb5ba8..2b2dee07ac 100644 --- a/test/built-ins/Object/prototype/S15.2.3.1_A3.js +++ b/test/built-ins/Object/prototype/S15.2.3.1_A3.js @@ -9,17 +9,17 @@ includes: [propertyHelper.js] verifyNotConfigurable(Object, "prototype"); -//CHECK#1 try { - if ((delete Object.prototype) !== false) { - throw new Test262Error('#1: Object.prototype has the attribute DontDelete'); - } + assert.sameValue(delete Object.prototype, false, 'The value of `delete Object.prototype` is expected to be false'); } catch (e) { - if (e instanceof Test262Error) throw e; - assert(e instanceof TypeError); + if (e instanceof Test262Error) { + throw e; + } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } -//CHECK#2 if (!(Object.hasOwnProperty('prototype'))) { throw new Test262Error('#2: the Object.prototype property has the attributes DontDelete.'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/S15.2.4_A1_T1.js b/test/built-ins/Object/prototype/S15.2.4_A1_T1.js index 4e13708e22..f359fb8886 100644 --- a/test/built-ins/Object/prototype/S15.2.4_A1_T1.js +++ b/test/built-ins/Object/prototype/S15.2.4_A1_T1.js @@ -6,8 +6,8 @@ info: Object prototype object has not prototype es5id: 15.2.4_A1_T1 description: Checking if obtaining Object.prototype.prototype fails ---*/ - -// CHECK#1 -if (Object.prototype.prototype !== undefined) { - throw new Test262Error('#1: Object prototype has not prototype'); -} +assert.sameValue( + Object.prototype.prototype, + undefined, + 'The value of Object.prototype.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Object/prototype/S15.2.4_A1_T2.js b/test/built-ins/Object/prototype/S15.2.4_A1_T2.js index 76ee577e39..7aaea8999e 100644 --- a/test/built-ins/Object/prototype/S15.2.4_A1_T2.js +++ b/test/built-ins/Object/prototype/S15.2.4_A1_T2.js @@ -8,21 +8,18 @@ description: > Since the Object prototype object has not prototype, deleted toString method can not be found in prototype chain ---*/ - -//CHECK#1 -if (Object.prototype.toString() == false) { - throw new Test262Error('#1: Object prototype object has not prototype'); -} +assert.notSameValue(Object.prototype.toString(), false, 'Object.prototype.toString() must return false'); delete Object.prototype.toString; -// CHECK#2 try { Object.prototype.toString(); throw new Test262Error('#2: Object prototype object has not prototype'); } catch (e) { - if ((e instanceof TypeError) !== true) { - throw new Test262Error('#1.1: delete Object.prototype.toString; Object.prototype.toString() throw a TypeError. Actual: ' + (e)); - } + assert.sameValue( + e instanceof TypeError, + true, + 'The result of evaluating (e instanceof TypeError) is expected to be true' + ); } // diff --git a/test/built-ins/Object/prototype/S15.2.4_A2.js b/test/built-ins/Object/prototype/S15.2.4_A2.js index 9a8bc9d58e..35e9974e2d 100644 --- a/test/built-ins/Object/prototype/S15.2.4_A2.js +++ b/test/built-ins/Object/prototype/S15.2.4_A2.js @@ -13,7 +13,4 @@ description: > var tostr = Object.prototype.toString(); -//CHECK#1 -if (tostr !== "[object Object]") { - throw new Test262Error('#1: the value of the internal [[Class]] property of Object prototype object is "Object"'); -} +assert.sameValue(tostr, "[object Object]", 'The value of tostr is expected to be "[object Object]"'); diff --git a/test/built-ins/Object/prototype/S15.2.4_A3.js b/test/built-ins/Object/prototype/S15.2.4_A3.js index 855899ae67..9d298c97ca 100644 --- a/test/built-ins/Object/prototype/S15.2.4_A3.js +++ b/test/built-ins/Object/prototype/S15.2.4_A3.js @@ -11,4 +11,4 @@ description: Checking if calling Object prototype as a function fails assert.throws(TypeError, function() { Object.prototype(); -}); +}, 'Object.prototype() throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/S15.2.4_A4.js b/test/built-ins/Object/prototype/S15.2.4_A4.js index d8459fcd72..25ed3b526e 100644 --- a/test/built-ins/Object/prototype/S15.2.4_A4.js +++ b/test/built-ins/Object/prototype/S15.2.4_A4.js @@ -11,4 +11,4 @@ description: Checking if creating "new Object.prototype" fails assert.throws(TypeError, function() { new Object.prototype; -}); +}, '`new Object.prototype` throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T1.js b/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T1.js index e73a888f0a..bafbc2f7eb 100644 --- a/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T1.js +++ b/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T1.js @@ -8,8 +8,8 @@ info: | es5id: 15.2.4.1_A1_T1 description: Checking the Object.prototype.constructor ---*/ - -//CHECK#1 -if (Object.prototype.constructor !== Object) { - throw new Test262Error('#1: The initial value of Object.prototype.constructor is the built-in Object constructor'); -} +assert.sameValue( + Object.prototype.constructor, + Object, + 'The value of Object.prototype.constructor is expected to equal the value of Object' +); diff --git a/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T2.js b/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T2.js index 31183632ae..50a6303954 100644 --- a/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T2.js +++ b/test/built-ins/Object/prototype/constructor/S15.2.4.1_A1_T2.js @@ -15,28 +15,14 @@ var constr = Object.prototype.constructor; var obj = new constr; -// CHECK#0 -if (obj === undefined) { - throw new Test262Error('#0: new Object() return the newly created native object.'); -} +assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``'); +assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object'); -// CHECK#1 -if (obj.constructor !== Object) { - throw new Test262Error('#1: new Object() create a new native ECMAScript object'); -} +assert( + !!Object.prototype.isPrototypeOf(obj), + 'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true' +); -// CHECK#2 -if (!(Object.prototype.isPrototypeOf(obj))) { - throw new Test262Error('#2: when new Object() calls the [[Prototype]] property of the newly constructed object is set to the Object prototype object.'); -} - -// CHECK#3 var to_string_result = '[object ' + 'Object' + ']'; -if (obj.toString() !== to_string_result) { - throw new Test262Error('#3: when new Object() calls the [[Class]] property of the newly constructed object is set to "Object".'); -} - -// CHECK#4 -if (obj.valueOf().toString() !== to_string_result) { - throw new Test262Error('#4: when new Object() calls the newly constructed object has no [[Value]] property.'); -} +assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result'); +assert.sameValue(obj.valueOf().toString(), to_string_result, 'obj.valueOf().toString() returns to_string_result'); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A12.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A12.js index 6b8c1bd579..76943bd6be 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A12.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A12.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Object.prototype.hasOwnProperty.call(undefined, 'foo'); -}); +}, 'Object.prototype.hasOwnProperty.call(undefined, "foo") throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A13.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A13.js index e1dd5a7b02..a1aefca0b7 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A13.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A13.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Object.prototype.hasOwnProperty.call(null, 'foo'); -}); +}, 'Object.prototype.hasOwnProperty.call(null, "foo") throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T1.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T1.js index e141eb214b..67315792f0 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T1.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T1.js @@ -13,14 +13,13 @@ description: > Checking type of the Object.prototype.hasOwnProperty and the returned result ---*/ +assert.sameValue( + typeof Object.prototype.hasOwnProperty, + "function", + 'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"' +); -//CHECK#1 -if (typeof Object.prototype.hasOwnProperty !== "function") { - throw new Test262Error('#1: hasOwnProperty method is defined'); -} - -//CHECK#2 -if (!(Object.prototype.hasOwnProperty("hasOwnProperty"))) { - throw new Test262Error('#2: hasOwnProperty method works properly'); -} -// +assert( + !!Object.prototype.hasOwnProperty("hasOwnProperty"), + 'The value of !!Object.prototype.hasOwnProperty("hasOwnProperty") is expected to be true' +); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T2.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T2.js index d5cc9d19e9..4fe1a7638a 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T2.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T2.js @@ -11,28 +11,28 @@ info: | es5id: 15.2.4.5_A1_T2 description: Argument of the hasOwnProperty method is a custom boolean property ---*/ - -//CHECK#1 -if (typeof Object.prototype.hasOwnProperty !== "function") { - throw new Test262Error('#1: hasOwnProperty method is defined'); -} +assert.sameValue( + typeof Object.prototype.hasOwnProperty, + "function", + 'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"' +); var obj = { the_property: true }; -//CHECK#2 -if (typeof obj.hasOwnProperty !== "function") { - throw new Test262Error('#2: hasOwnProperty method is accessed'); -} +assert.sameValue( + typeof obj.hasOwnProperty, + "function", + 'The value of `typeof obj.hasOwnProperty` is expected to be "function"' +); -//CHECK#3 -if (obj.hasOwnProperty("hasOwnProperty")) { - throw new Test262Error('#3: hasOwnProperty method works properly'); -} +assert( + !obj.hasOwnProperty("hasOwnProperty"), + 'The value of !obj.hasOwnProperty("hasOwnProperty") is expected to be true' +); -//CHECK#4 -if (!(obj.hasOwnProperty("the_property"))) { - throw new Test262Error('#4: hasOwnProperty method works properly'); -} -// +assert( + !!obj.hasOwnProperty("the_property"), + 'The value of !!obj.hasOwnProperty("the_property") is expected to be true' +); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T3.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T3.js index 99e1f97004..997a5bfb45 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T3.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A1_T3.js @@ -20,22 +20,24 @@ var FACTORY = function() { var instance = new FACTORY; -//CHECK#1 -if (typeof Object.prototype.hasOwnProperty !== "function") { - throw new Test262Error('#1: hasOwnProperty method is defined'); -} +assert.sameValue( + typeof Object.prototype.hasOwnProperty, + "function", + 'The value of `typeof Object.prototype.hasOwnProperty` is expected to be "function"' +); -//CHECK#2 -if (typeof instance.hasOwnProperty !== "function") { - throw new Test262Error('#2: hasOwnProperty method is accessed'); -} +assert.sameValue( + typeof instance.hasOwnProperty, + "function", + 'The value of `typeof instance.hasOwnProperty` is expected to be "function"' +); -//CHECK#3 -if (instance.hasOwnProperty("toString")) { - throw new Test262Error('#3: hasOwnProperty method works properly'); -} +assert( + !instance.hasOwnProperty("toString"), + 'The value of !instance.hasOwnProperty("toString") is expected to be true' +); -//CHECK#4 -if (!(instance.hasOwnProperty("aproperty"))) { - throw new Test262Error('#4: hasOwnProperty method works properly'); -} +assert( + !!instance.hasOwnProperty("aproperty"), + 'The value of !!instance.hasOwnProperty("aproperty") is expected to be true' +); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A6.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A6.js index be9fd54663..7b1548875f 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A6.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A6.js @@ -8,9 +8,8 @@ description: > Checking if obtaining the prototype property of Object.prototype.hasOwnProperty fails ---*/ - -//CHECK#1 -if (Object.prototype.hasOwnProperty.prototype !== undefined) { - throw new Test262Error('#1: Object.prototype.hasOwnProperty has not prototype property' + Object.prototype.hasOwnProperty.prototype); -} -// +assert.sameValue( + Object.prototype.hasOwnProperty.prototype, + undefined, + 'The value of Object.prototype.hasOwnProperty.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js index 8b99b376a5..bffb92c10f 100644 --- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js +++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js @@ -7,8 +7,6 @@ es5id: 15.2.4.5_A7 description: Checking if creating "new Object.prototype.hasOwnProperty" fails ---*/ -var FACTORY = Object.prototype.hasOwnProperty; - assert.throws(TypeError, function() { - new FACTORY; -}); + new Object.prototype.hasOwnProperty(); +}, '`new Object.prototype.hasOwnProperty()` throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A10.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A10.js index 54385a21a8..96d4e95a6a 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A10.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A10.js @@ -11,11 +11,10 @@ description: > Object.prototype.propertyIsEnumerable.length property fails includes: [propertyHelper.js] ---*/ - -//CHECK#1 -if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) { - throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable has length property'); -} +assert( + !!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'), + 'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true' +); var obj = Object.prototype.propertyIsEnumerable.length; @@ -23,7 +22,10 @@ verifyNotWritable(Object.prototype.propertyIsEnumerable, "length", null, functio return "shifted"; }); -//CHECK#2 -if (Object.prototype.propertyIsEnumerable.length !== obj) { - throw new Test262Error('#2: the Object.prototype.propertyIsEnumerable length property has the attributes ReadOnly'); -} +assert.sameValue( + Object.prototype.propertyIsEnumerable.length, + obj, + 'The value of Object.prototype.propertyIsEnumerable.length is expected to equal the value of obj' +); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A11.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A11.js index 35d2d5e2da..7bf97032a4 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A11.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A11.js @@ -6,13 +6,13 @@ info: The length property of the hasOwnProperty method is 1 es5id: 15.2.4.7_A11 description: Checking the value of Object.prototype.hasOwnProperty.length ---*/ +assert( + !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length"), + 'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true' +); -//CHECK#1 -if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty("length"))) { - throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable has length property'); -} - -//CHECK#2 -if (Object.prototype.propertyIsEnumerable.length !== 1) { - throw new Test262Error('#2: The length property of the toObject method is 1'); -} +assert.sameValue( + Object.prototype.propertyIsEnumerable.length, + 1, + 'The value of Object.prototype.propertyIsEnumerable.length is expected to be 1' +); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A12.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A12.js index 880b6efa66..f95b51f33c 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A12.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A12.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Object.prototype.propertyIsEnumerable.call(undefined, 'foo'); -}); +}, 'Object.prototype.propertyIsEnumerable.call(undefined, "foo") throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A13.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A13.js index ec8f38591b..0db0aadd0f 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A13.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A13.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Object.prototype.propertyIsEnumerable.call(null, 'foo'); -}); +}, 'Object.prototype.propertyIsEnumerable.call(null, "foo") throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A1_T1.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A1_T1.js index c7e48df8f8..669dc42bbd 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A1_T1.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A1_T1.js @@ -10,11 +10,11 @@ description: > Calling the propertyIsEnumerable method for object in the prototype chain ---*/ - -//CHECK#1 -if (typeof Object.prototype.propertyIsEnumerable !== "function") { - throw new Test262Error('#1: propertyIsEnumerable method is defined'); -} +assert.sameValue( + typeof Object.prototype.propertyIsEnumerable, + "function", + 'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"' +); var proto = { rootprop: "avis" @@ -22,24 +22,24 @@ var proto = { function AVISFACTORY(name) { this.name = name -}; +} AVISFACTORY.prototype = proto; var seagull = new AVISFACTORY("seagull"); -//CHECK#2 -if (typeof seagull.propertyIsEnumerable !== "function") { - throw new Test262Error('#2: propertyIsEnumerable method is accessed'); -} +assert.sameValue( + typeof seagull.propertyIsEnumerable, + "function", + 'The value of `typeof seagull.propertyIsEnumerable` is expected to be "function"' +); -//CHECK#3 -if (!(seagull.propertyIsEnumerable("name"))) { - throw new Test262Error('#3: propertyIsEnumerable method works properly'); -} +assert( + !!seagull.propertyIsEnumerable("name"), + 'The value of !!seagull.propertyIsEnumerable("name") is expected to be true' +); -//CHECK#4 -if (seagull.propertyIsEnumerable("rootprop")) { - throw new Test262Error('#4: propertyIsEnumerable method does not consider objects in the prototype chain'); -} -// +assert( + !seagull.propertyIsEnumerable("rootprop"), + 'The value of !seagull.propertyIsEnumerable("rootprop") is expected to be true' +); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T1.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T1.js index df53c1359f..6e29aa01e6 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T1.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T1.js @@ -14,14 +14,15 @@ description: > Checking the type of Object.prototype.propertyIsEnumerable and the returned result ---*/ +assert.sameValue( + typeof Object.prototype.propertyIsEnumerable, + "function", + 'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"' +); -//CHECK#1 -if (typeof Object.prototype.propertyIsEnumerable !== "function") { - throw new Test262Error('#1: hasOwnProperty method is defined'); -} +assert( + !Object.prototype.propertyIsEnumerable("propertyIsEnumerable"), + 'The value of !Object.prototype.propertyIsEnumerable("propertyIsEnumerable") is expected to be true' +); -//CHECK#2 -if (Object.prototype.propertyIsEnumerable("propertyIsEnumerable")) { - throw new Test262Error('#2: hasOwnProperty method works properly'); -} -// +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T2.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T2.js index c43d61ae41..2ada5b7f82 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T2.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A2_T2.js @@ -14,32 +14,31 @@ description: > Argument of the propertyIsEnumerable method is a custom boolean property ---*/ - -//CHECK#1 -if (typeof Object.prototype.propertyIsEnumerable !== "function") { - throw new Test262Error('#1: propertyIsEnumerable method is defined'); -} +assert.sameValue( + typeof Object.prototype.propertyIsEnumerable, + "function", + 'The value of `typeof Object.prototype.propertyIsEnumerable` is expected to be "function"' +); var obj = { the_property: true }; -//CHECK#2 -if (typeof obj.propertyIsEnumerable !== "function") { - throw new Test262Error('#2: propertyIsEnumerable method is accessed'); -} +assert.sameValue( + typeof obj.propertyIsEnumerable, + "function", + 'The value of `typeof obj.propertyIsEnumerable` is expected to be "function"' +); -//CHECK#3 -if (!(obj.propertyIsEnumerable("the_property"))) { - throw new Test262Error('#3: propertyIsEnumerable method works properly'); -} +assert( + !!obj.propertyIsEnumerable("the_property"), + 'The value of !!obj.propertyIsEnumerable("the_property") is expected to be true' +); -//CHECK#4 var accum = ""; for (var prop in obj) { accum += prop; } -if (accum.indexOf("the_property") !== 0) { - throw new Test262Error('#4: enumerating works properly'); -} -// +assert.sameValue(accum.indexOf("the_property"), 0, 'accum.indexOf("the_property") must return 0'); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A6.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A6.js index 3c147edd62..25bfa31cc5 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A6.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A6.js @@ -8,9 +8,8 @@ description: > Checking if obtaining the prototype property of Object.prototype.propertyIsEnumerable fails ---*/ - -//CHECK#1 -if (Object.prototype.propertyIsEnumerable.prototype !== undefined) { - throw new Test262Error('#1: Object.prototype.propertyIsEnumerable has not prototype property' + Object.prototype.propertyIsEnumerable.prototype); -} -// +assert.sameValue( + Object.prototype.propertyIsEnumerable.prototype, + undefined, + 'The value of Object.prototype.propertyIsEnumerable.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js index 98ac74a123..b909f57748 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js @@ -9,8 +9,6 @@ description: > fails ---*/ -var FACTORY = Object.prototype.propertyIsEnumerable; - assert.throws(TypeError, function() { - new FACTORY; -}); + new Object.prototype.propertyIsEnumerable(); +}, '`new Object.prototype.propertyIsEnumerable()` throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A8.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A8.js index b625c00039..1c85a0d87d 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A8.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A8.js @@ -10,21 +10,19 @@ description: > Checking if enumerating the Object.prototype.propertyIsEnumerable.length property fails ---*/ +assert( + !!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'), + 'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true' +); -//CHECK#0 -if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Object.prototype.propertyIsEnumerable has length property'); -} +assert( + !Object.prototype.propertyIsEnumerable.propertyIsEnumerable('length'), + 'The value of !Object.prototype.propertyIsEnumerable.propertyIsEnumerable("length") is expected to be true' +); - -// CHECK#1 -if (Object.prototype.propertyIsEnumerable.propertyIsEnumerable('length')) { - throw new Test262Error('#1: the Object.prototype.propertyIsEnumerable.length property has the attributes DontEnum'); -} - -// CHECK#2 for (var p in Object.prototype.propertyIsEnumerable) { - if (p === "length") - throw new Test262Error('#2: the Object.prototype.propertyIsEnumerable.length property has the attributes DontEnum'); + assert.notSameValue(p, "length", 'The value of p is not "length"'); } // + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A9.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A9.js index de32336545..ba0767cd3d 100644 --- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A9.js +++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A9.js @@ -10,14 +10,14 @@ description: > Checking if deleting the Object.prototype.propertyIsEnumerable.length property fails ---*/ +assert( + !!Object.prototype.propertyIsEnumerable.hasOwnProperty('length'), + 'The value of !!Object.prototype.propertyIsEnumerable.hasOwnProperty("length") is expected to be true' +); -//CHECK#0 -if (!(Object.prototype.propertyIsEnumerable.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Object.prototype.propertyIsEnumerable has length property'); -} +assert( + !!delete Object.prototype.propertyIsEnumerable.length, + 'The value of !!delete Object.prototype.propertyIsEnumerable.length is expected to be true' +); -//CHECK#1 -if (!delete Object.prototype.propertyIsEnumerable.length) { - throw new Test262Error('#1: The Object.prototype.propertyIsEnumerable.length property does not have the attributes DontDelete'); -} -// +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A1.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A1.js index 2cf1ea7ca2..f6de875259 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A1.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A1.js @@ -8,18 +8,20 @@ description: > Checking the type of Object.prototype.toLocaleString and the returned result ---*/ +assert.sameValue( + typeof Object.prototype.toLocaleString, + "function", + 'The value of `typeof Object.prototype.toLocaleString` is expected to be "function"' +); -//CHECK#1 -if (typeof Object.prototype.toLocaleString !== "function") { - throw new Test262Error('#1: toLocaleString method defined'); -} +assert.sameValue( + Object.prototype.toLocaleString(), + Object.prototype.toString(), + 'Object.prototype.toLocaleString() must return the same value returned by Object.prototype.toString()' +); -//CHECK#2 -if (Object.prototype.toLocaleString() !== Object.prototype.toString()) { - throw new Test262Error('#1: toLocaleString function returns the result of calling toString()'); -} - -//CHECK#2 -if ({}.toLocaleString() !== {}.toString()) { - throw new Test262Error('#2: toLocaleString function returns the result of calling toString()'); -} +assert.sameValue( + {}.toLocaleString(), + {}.toString(), + '({}).toLocaleString() must return the same value returned by ({}).toString()' +); diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A10.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A10.js index dfdb84f0cc..5302cb156d 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A10.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A10.js @@ -11,11 +11,10 @@ description: > property fails includes: [propertyHelper.js] ---*/ - -//CHECK#1 -if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) { - throw new Test262Error('#1: the Object.prototype.toLocaleString has length property.'); -} +assert( + !!Object.prototype.toLocaleString.hasOwnProperty('length'), + 'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true' +); var obj = Object.prototype.toLocaleString.length; @@ -23,7 +22,10 @@ verifyNotWritable(Object.prototype.toLocaleString, "length", null, function() { return "shifted"; }); -//CHECK#2 -if (Object.prototype.toLocaleString.length !== obj) { - throw new Test262Error('#2: the Object.prototype.toLocaleString length property has the attributes ReadOnly.'); -} +assert.sameValue( + Object.prototype.toLocaleString.length, + obj, + 'The value of Object.prototype.toLocaleString.length is expected to equal the value of obj' +); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A11.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A11.js index d75b565d4e..a13bf5e5b6 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A11.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A11.js @@ -6,13 +6,13 @@ info: The length property of the toLocaleString method is 0 es5id: 15.2.4.3_A11 description: Checking the Object.prototype.toLocaleString.length ---*/ +assert( + !!Object.prototype.toLocaleString.hasOwnProperty("length"), + 'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true' +); -//CHECK#1 -if (!(Object.prototype.toLocaleString.hasOwnProperty("length"))) { - throw new Test262Error('#1: The length property of the toLocaleString method is 0'); -} - -//CHECK#2 -if (Object.prototype.toLocaleString.length !== 0) { - throw new Test262Error('#2: The length property of the toLocaleString method is 0'); -} +assert.sameValue( + Object.prototype.toLocaleString.length, + 0, + 'The value of Object.prototype.toLocaleString.length is expected to be 0' +); diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A12.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A12.js index a24064372e..ad5e0e27af 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A12.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A12.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Object.prototype.toLocaleString.call(undefined); -}); +}, 'Object.prototype.toLocaleString.call(undefined) throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A13.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A13.js index 5a097f22e8..d2db862118 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A13.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A13.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Object.prototype.toLocaleString.call(null); -}); +}, 'Object.prototype.toLocaleString.call(null) throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A6.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A6.js index 8b91c83818..434afb82b7 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A6.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A6.js @@ -8,9 +8,8 @@ description: > Checking if obtaining the prototype property of Object.prototype.toLocaleString fails ---*/ - -//CHECK#1 -if (Object.prototype.toLocaleString.prototype !== undefined) { - throw new Test262Error('#1: Object.prototype.toLocaleString has not prototype property' + Object.prototype.toLocaleString.prototype); -} -// +assert.sameValue( + Object.prototype.toLocaleString.prototype, + undefined, + 'The value of Object.prototype.toLocaleString.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js index b186512351..1a8a4a3e2d 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js @@ -7,8 +7,6 @@ es5id: 15.2.4.3_A7 description: Checking if creating "new Object.prototype.toLocaleString" fails ---*/ -var FACTORY = Object.prototype.toLocaleString; - assert.throws(TypeError, function() { - new FACTORY; -}); + new Object.prototype.toLocaleString(); +}, '`new Object.prototype.toLocaleString()` throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A8.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A8.js index 8ccaaaa0dd..346bb18271 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A8.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A8.js @@ -10,21 +10,19 @@ description: > Checking if enumerating the Object.prototype.toLocaleString.length property fails ---*/ +assert( + !!Object.prototype.toLocaleString.hasOwnProperty('length'), + 'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true' +); -//CHECK#0 -if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Object.prototype.toLocaleString has length property.'); -} +assert( + !Object.prototype.toLocaleString.propertyIsEnumerable('length'), + 'The value of !Object.prototype.toLocaleString.propertyIsEnumerable("length") is expected to be true' +); - -// CHECK#1 -if (Object.prototype.toLocaleString.propertyIsEnumerable('length')) { - throw new Test262Error('#1: the Object.prototype.toLocaleString.length property has the attributes DontEnum'); -} - -// CHECK#2 for (var p in Object.prototype.toLocaleString) { - if (p === "length") - throw new Test262Error('#2: the Object.prototype.toLocaleString.length property has the attributes DontEnum'); + assert.notSameValue(p, "length", 'The value of p is not "length"'); } // + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A9.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A9.js index 9ad9048933..e11791aebd 100644 --- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A9.js +++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A9.js @@ -10,18 +10,19 @@ description: > Checknig if deleting of the Object.prototype.toLocaleString.length property fails ---*/ +assert( + !!Object.prototype.toLocaleString.hasOwnProperty('length'), + 'The value of !!Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true' +); -//CHECK#0 -if (!(Object.prototype.toLocaleString.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Object.prototype.toLocaleString has length property'); -} +assert( + !!delete Object.prototype.toLocaleString.length, + 'The value of !!delete Object.prototype.toLocaleString.length is expected to be true' +); -//CHECK#1 -if (!delete Object.prototype.toLocaleString.length) { - throw new Test262Error('#1: The Object.prototype.toLocaleString.length property does not have the attributes DontDelete'); -} +assert( + !Object.prototype.toLocaleString.hasOwnProperty('length'), + 'The value of !Object.prototype.toLocaleString.hasOwnProperty("length") is expected to be true' +); -//CHECK#2 -if (Object.prototype.toLocaleString.hasOwnProperty('length')) { - throw new Test262Error('#2: The Object.prototype.toLocaleString.length property does not have the attributes DontDelete'); -} +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A10.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A10.js index 87bf53f3a3..f408a7e8c8 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A10.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A10.js @@ -9,11 +9,10 @@ description: > fails includes: [propertyHelper.js] ---*/ - -//CHECK#1 -if (!(Object.prototype.valueOf.hasOwnProperty('length'))) { - throw new Test262Error('#1: the Object.prototype.valueOf has length property.'); -} +assert( + !!Object.prototype.valueOf.hasOwnProperty('length'), + 'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true' +); var obj = Object.prototype.valueOf.length; @@ -21,7 +20,10 @@ verifyNotWritable(Object.prototype.valueOf, "length", null, function() { return "shifted"; }); -//CHECK#2 -if (Object.prototype.valueOf.length !== obj) { - throw new Test262Error('#2: the Object.prototype.valueOf length property has the attributes ReadOnly.'); -} +assert.sameValue( + Object.prototype.valueOf.length, + obj, + 'The value of Object.prototype.valueOf.length is expected to equal the value of obj' +); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A11.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A11.js index a458389c8f..b114fb40bc 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A11.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A11.js @@ -6,13 +6,13 @@ info: The length property of the valueOf method is 0 es5id: 15.2.4.4_A11 description: Checking the Object.prototype.valueOf.length ---*/ +assert( + !!Object.prototype.valueOf.hasOwnProperty("length"), + 'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true' +); -//CHECK#1 -if (!(Object.prototype.valueOf.hasOwnProperty("length"))) { - throw new Test262Error('#1: The length property of the toObject method is 0'); -} - -//CHECK#2 -if (Object.prototype.valueOf.length !== 0) { - throw new Test262Error('#2: The length property of the toObject method is 0'); -} +assert.sameValue( + Object.prototype.valueOf.length, + 0, + 'The value of Object.prototype.valueOf.length is expected to be 0' +); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A12.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A12.js index b09d95dea9..82752e7072 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A12.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A12.js @@ -11,4 +11,4 @@ description: Checking Object.prototype.valueOf invoked by the 'call' property. assert.throws(TypeError, function() { Object.prototype.valueOf.call(undefined); -}); +}, 'Object.prototype.valueOf.call(undefined) throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A13.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A13.js index 4e79dddcd6..a7f0f45c07 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A13.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A13.js @@ -11,4 +11,4 @@ description: Checking Object.prototype.valueOf invoked by the 'call' property. assert.throws(TypeError, function() { Object.prototype.valueOf.call(null); -}); +}, 'Object.prototype.valueOf.call(null) throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A14.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A14.js index bff652786d..a9a6553c8c 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A14.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A14.js @@ -11,4 +11,4 @@ description: Checking Object.prototype.valueOf invoked by the 'call' property. assert.throws(TypeError, function() { (1, Object.prototype.valueOf)(); -}); +}, '(1, Object.prototype.valueOf)() throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A15.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A15.js index 147a31aee4..11d23d83c4 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A15.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A15.js @@ -9,8 +9,7 @@ es5id: 15.2.4.4_A15 description: Checking Object.prototype.valueOf when called as a global function. ---*/ -var v = Object.prototype.valueOf; - assert.throws(TypeError, function() { - v(); -}); + const valueOf = Object.prototype.valueOf; + valueOf(); +}, '`const valueOf = Object.prototype.valueOf; valueOf()` throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T1.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T1.js index 8b92b63bf5..3b840882ac 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T1.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T1.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T1 description: "\"this\" value is a number" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object(1.1); -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== 1.1) { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), 1.1, 'obj.valueOf() must return 1.1'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T2.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T2.js index f9957da53a..59a584892c 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T2.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T2.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T2 description: "\"this\" value is a boolean" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object(true); -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== true) { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), true, 'obj.valueOf() must return true'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T3.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T3.js index 0696660a84..a3a0913970 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T3.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T3.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T3 description: "\"this\" value is a string" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object("greenfield"); -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== "greenfield") { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), "greenfield", 'obj.valueOf() must return "greenfield"'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T4.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T4.js index 85e4c711be..fefcecab42 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T4.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T4.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T4 description: "\"this\" value is an object" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object; -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== obj) { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), obj, 'obj.valueOf() returns obj'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T5.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T5.js index b18598e28b..403bb0b7af 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T5.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T5.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T5 description: "\"this\" value is \"null\"" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object(null); -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== obj) { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), obj, 'obj.valueOf() returns obj'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T6.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T6.js index b37d43f01f..4436cec334 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T6.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T6.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T6 description: "\"this\" value is \"undefined\"" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object(undefined); -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== obj) { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), obj, 'obj.valueOf() returns obj'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T7.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T7.js index 6c8a26d36e..5e224d37bd 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T7.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A1_T7.js @@ -6,20 +6,13 @@ info: The valueOf method returns its "this" value es5id: 15.2.4.4_A1_T7 description: "\"this\" value is \"void 0\"" ---*/ - -//CHECK#1 -if (typeof Object.prototype.valueOf !== "function") { - throw new Test262Error('#1: valueOf method defined'); -} +assert.sameValue( + typeof Object.prototype.valueOf, + "function", + 'The value of `typeof Object.prototype.valueOf` is expected to be "function"' +); var obj = new Object(void 0); -//CHECK#2 -if (typeof obj.valueOf !== "function") { - throw new Test262Error('#2: valueOf method accessed'); -} - -//CHECK#3 -if (obj.valueOf() !== obj) { - throw new Test262Error('#3: The valueOf method returns its this value'); -} +assert.sameValue(typeof obj.valueOf, "function", 'The value of `typeof obj.valueOf` is expected to be "function"'); +assert.sameValue(obj.valueOf(), obj, 'obj.valueOf() returns obj'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A6.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A6.js index bf374ff792..1b37ab34ce 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A6.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A6.js @@ -8,9 +8,8 @@ description: > Checking if obtaining the prototype property of Object.prototype.valueOf fails ---*/ - -//CHECK#1 -if (Object.prototype.valueOf.prototype !== undefined) { - throw new Test262Error('#1: Object.prototype.valueOf has not prototype property' + Object.prototype.valueOf.prototype); -} -// +assert.sameValue( + Object.prototype.valueOf.prototype, + undefined, + 'The value of Object.prototype.valueOf.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js index 2a6eb9c405..f8744b6aef 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js @@ -7,8 +7,6 @@ es5id: 15.2.4.4_A7 description: Checking if creating "new Object.prototype.valueOf" fails ---*/ -var FACTORY = Object.prototype.valueOf; - assert.throws(TypeError, function() { - new FACTORY; -}); + new Object.prototype.valueOf(); +}, '`new Object.prototype.valueOf()` throws a TypeError exception'); diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A8.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A8.js index 85d4bd9b79..fe662ccc08 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A8.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A8.js @@ -8,21 +8,19 @@ description: > Checking if enumerating the Object.prototype.valueOf.length property fails ---*/ +assert( + !!Object.prototype.valueOf.hasOwnProperty('length'), + 'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true' +); -//CHECK#0 -if (!(Object.prototype.valueOf.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Object.prototype.valueOf has length property.'); -} +assert( + !Object.prototype.valueOf.propertyIsEnumerable('length'), + 'The value of !Object.prototype.valueOf.propertyIsEnumerable("length") is expected to be true' +); - -// CHECK#1 -if (Object.prototype.valueOf.propertyIsEnumerable('length')) { - throw new Test262Error('#1: the Object.prototype.valueOf.length property has the attributes DontEnum'); -} - -// CHECK#2 for (var p in Object.prototype.valueOf) { - if (p === "length") - throw new Test262Error('#2: the Object.prototype.valueOf.length property has the attributes DontEnum'); + assert.notSameValue(p, "length", 'The value of p is not "length"'); } // + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A9.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A9.js index a5d2960c29..b182332c66 100644 --- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A9.js +++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A9.js @@ -10,18 +10,19 @@ description: > Checknig if deleting of the Object.prototype.valueOf.length property fails ---*/ +assert( + !!Object.prototype.valueOf.hasOwnProperty('length'), + 'The value of !!Object.prototype.valueOf.hasOwnProperty("length") is expected to be true' +); -//CHECK#0 -if (!(Object.prototype.valueOf.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Object.prototype.valueOf has length property'); -} +assert( + !!delete Object.prototype.valueOf.length, + 'The value of !!delete Object.prototype.valueOf.length is expected to be true' +); -//CHECK#1 -if (!delete Object.prototype.valueOf.length) { - throw new Test262Error('#1: The Object.prototype.valueOf.length property does not have the attributes DontDelete'); -} +assert( + !Object.prototype.valueOf.hasOwnProperty('length'), + 'The value of !Object.prototype.valueOf.hasOwnProperty("length") is expected to be true' +); -//CHECK#2 -if (Object.prototype.valueOf.hasOwnProperty('length')) { - throw new Test262Error('#2: The Object.prototype.valueOf.length property does not have the attributes DontDelete'); -} +// TODO: Convert to verifyProperty() format.