From e6556eeaed6634768157bdc76591d9ebaeee5991 Mon Sep 17 00:00:00 2001 From: rwaldron Date: Wed, 11 Aug 2021 10:53:01 -0400 Subject: [PATCH 1/2] Removed duplicate of test/built-ins/Boolean/prototype/S15.6.3.1_A1.js --- .../built-ins/Boolean/prototype/S15.6.4_A1.js | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 test/built-ins/Boolean/prototype/S15.6.4_A1.js diff --git a/test/built-ins/Boolean/prototype/S15.6.4_A1.js b/test/built-ins/Boolean/prototype/S15.6.4_A1.js deleted file mode 100644 index addd15d0a0..0000000000 --- a/test/built-ins/Boolean/prototype/S15.6.4_A1.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: | - The Boolean prototype object is itself a Boolean object - (its [[Class]] is "Boolean") whose value is false -esid: sec-properties-of-the-boolean-prototype-object -description: Checking type and value of Boolean.prototype ----*/ - -//CHECK#1 -if (typeof Boolean.prototype !== "object") { - throw new Test262Error('#1: typeof Boolean.prototype === "object"'); -} - -//CHECK#2 -if (Boolean.prototype != false) { - throw new Test262Error('#2: Boolean.prototype == false'); -} - -delete Boolean.prototype.toString; - -if (Boolean.prototype.toString() !== "[object Boolean]") { - throw new Test262Error('#3: The [[Class]] property of the Boolean prototype object is set to "Boolean"'); -} From 20eb6b0878a4e9c6928c129af0c40ca4582e9113 Mon Sep 17 00:00:00 2001 From: rwaldron Date: Wed, 11 Aug 2021 11:07:49 -0400 Subject: [PATCH 2/2] Transform legacy format to harness assertions --- test/built-ins/Boolean/S15.6.1.1_A1_T1.js | 30 ++--- test/built-ins/Boolean/S15.6.1.1_A1_T2.js | 42 ++----- test/built-ins/Boolean/S15.6.1.1_A1_T3.js | 54 +++----- test/built-ins/Boolean/S15.6.1.1_A1_T4.js | 58 ++++----- test/built-ins/Boolean/S15.6.1.1_A1_T5.js | 59 ++++----- test/built-ins/Boolean/S15.6.1.1_A2.js | 12 +- test/built-ins/Boolean/S15.6.2.1_A1.js | 43 ++----- test/built-ins/Boolean/S15.6.2.1_A2.js | 24 ++-- test/built-ins/Boolean/S15.6.2.1_A3.js | 19 +-- test/built-ins/Boolean/S15.6.2.1_A4.js | 5 +- test/built-ins/Boolean/S15.6.3_A1.js | 5 +- test/built-ins/Boolean/S15.6.3_A2.js | 9 +- test/built-ins/Boolean/S15.6.3_A3.js | 12 +- test/built-ins/Boolean/S9.2_A1_T1.js | 23 +--- test/built-ins/Boolean/S9.2_A2_T1.js | 6 +- test/built-ins/Boolean/S9.2_A3_T1.js | 12 +- test/built-ins/Boolean/S9.2_A4_T1.js | 18 +-- test/built-ins/Boolean/S9.2_A4_T3.js | 48 ++----- test/built-ins/Boolean/S9.2_A5_T1.js | 6 +- test/built-ins/Boolean/S9.2_A5_T3.js | 12 +- test/built-ins/Boolean/S9.2_A6_T1.js | 118 ++++-------------- .../Boolean/prototype/S15.6.3.1_A1.js | 22 ++-- .../Boolean/prototype/S15.6.3.1_A2.js | 4 +- .../Boolean/prototype/S15.6.3.1_A3.js | 12 +- .../Boolean/prototype/S15.6.3.1_A4.js | 12 +- .../built-ins/Boolean/prototype/S15.6.4_A2.js | 8 +- .../prototype/constructor/S15.6.4.1_A1.js | 10 +- .../prototype/toString/S15.6.4.2_A1_T1.js | 45 ++----- .../prototype/toString/S15.6.4.2_A1_T2.js | 50 +++----- .../prototype/toString/S15.6.4.2_A2_T1.js | 24 +--- .../prototype/toString/S15.6.4.2_A2_T2.js | 28 ++--- .../prototype/toString/S15.6.4.2_A2_T3.js | 28 ++--- .../prototype/toString/S15.6.4.2_A2_T4.js | 29 ++--- .../prototype/toString/S15.6.4.2_A2_T5.js | 28 ++--- .../prototype/valueOf/S15.6.4.3_A1_T1.js | 39 ++---- .../prototype/valueOf/S15.6.4.3_A1_T2.js | 39 ++---- .../prototype/valueOf/S15.6.4.3_A2_T1.js | 30 ++--- .../prototype/valueOf/S15.6.4.3_A2_T2.js | 30 ++--- .../prototype/valueOf/S15.6.4.3_A2_T3.js | 30 ++--- .../prototype/valueOf/S15.6.4.3_A2_T4.js | 30 ++--- .../prototype/valueOf/S15.6.4.3_A2_T5.js | 30 ++--- 41 files changed, 336 insertions(+), 807 deletions(-) diff --git a/test/built-ins/Boolean/S15.6.1.1_A1_T1.js b/test/built-ins/Boolean/S15.6.1.1_A1_T1.js index 9b03b00378..5deacc29d2 100644 --- a/test/built-ins/Boolean/S15.6.1.1_A1_T1.js +++ b/test/built-ins/Boolean/S15.6.1.1_A1_T1.js @@ -10,23 +10,17 @@ description: > Used values 1, new String("1"), new Object(1) and called without argument ---*/ +assert.sameValue(typeof Boolean(), "boolean", 'The value of `typeof Boolean()` is expected to be "boolean"'); +assert.sameValue(typeof Boolean(1), "boolean", 'The value of `typeof Boolean(1)` is expected to be "boolean"'); -//CHECK#1 -if (typeof Boolean() !== "boolean") { - throw new Test262Error('#1: typeof Boolean() should be "boolean", actual is "' + typeof Boolean() + '"'); -} +assert.sameValue( + typeof Boolean(new String("1")), + "boolean", + 'The value of `typeof Boolean(new String("1"))` is expected to be "boolean"' +); -//CHECK#2 -if (typeof Boolean(1) !== "boolean") { - throw new Test262Error('#2: typeof Boolean(1) should be "boolean", actual is "' + typeof Boolean(1) + '"'); -} - -//CHECK#3 -if (typeof Boolean(new String("1")) !== "boolean") { - throw new Test262Error('#3: typeof Boolean(new String("1")) should be "boolean", actual is "' + typeof Boolean(new String("1")) + '"'); -} - -//CHECK#4 -if (typeof Boolean(new Object(1)) !== "boolean") { - throw new Test262Error('#4: typeof Boolean(new Object(1)) should be "boolean", actual is "' + typeof Boolean(new Object(1)) + '"'); -} +assert.sameValue( + typeof Boolean(new Object(1)), + "boolean", + 'The value of `typeof Boolean(new Object(1))` is expected to be "boolean"' +); diff --git a/test/built-ins/Boolean/S15.6.1.1_A1_T2.js b/test/built-ins/Boolean/S15.6.1.1_A1_T2.js index aecde0e22f..04d0e849f3 100644 --- a/test/built-ins/Boolean/S15.6.1.1_A1_T2.js +++ b/test/built-ins/Boolean/S15.6.1.1_A1_T2.js @@ -8,35 +8,17 @@ info: | esid: sec-terms-and-definitions-boolean-value description: Used various number values as argument ---*/ +assert.sameValue(typeof Boolean(0), "boolean", 'The value of `typeof Boolean(0)` is expected to be "boolean"'); +assert.sameValue(Boolean(0), false, 'Boolean(0) must return false'); +assert.sameValue(typeof Boolean(-1), "boolean", 'The value of `typeof Boolean(-1)` is expected to be "boolean"'); +assert.sameValue(Boolean(-1), true, 'Boolean(-1) must return true'); -//CHECK#1 -if (typeof Boolean(0) !== "boolean") { - throw new Test262Error('#1.1: typeof Boolean(0) should be "boolean", actual is "' + typeof Boolean(0) + '"'); -} -if (Boolean(0) !== false) { - throw new Test262Error('#1.2: Boolean(0) should be false, actual is ' + Boolean(0)); -} +assert.sameValue( + typeof Boolean(-Infinity), + "boolean", + 'The value of `typeof Boolean(-Infinity)` is expected to be "boolean"' +); -//CHECK#2 -if (typeof Boolean(-1) !== "boolean") { - throw new Test262Error('#2.1: typeof Boolean(-1) should be "boolean", actual is "' + typeof Boolean(-1) + '"'); -} -if (Boolean(-1) !== true) { - throw new Test262Error('#2.2: Boolean(-1) should be true, actual is ' + Boolean(-1)); -} - -//CHECK#3 -if (typeof Boolean(-Infinity) !== "boolean") { - throw new Test262Error('#3.1: typeof Boolean(-Infinity) should be "boolean", actual is "' + typeof Boolean(-Infinity) + '"'); -} -if (Boolean(-Infinity) !== true) { - throw new Test262Error('#3.2: Boolean(-Infinity) should be true, actual is ' + Boolean(-Infinity)); -} - -//CHECK#4 -if (typeof Boolean(NaN) !== "boolean") { - throw new Test262Error('#4.1: typeof Boolean(NaN) should be "boolean", actual is "' + typeof Boolean(NaN) + '"'); -} -if (Boolean(NaN) !== false) { - throw new Test262Error('#4.2: Boolean(NaN) should be false, actual is ' + Boolean(NaN)); -} +assert.sameValue(Boolean(-Infinity), true, 'Boolean(-Infinity) must return true'); +assert.sameValue(typeof Boolean(NaN), "boolean", 'The value of `typeof Boolean(NaN)` is expected to be "boolean"'); +assert.sameValue(Boolean(NaN), false, 'Boolean(NaN) must return false'); diff --git a/test/built-ins/Boolean/S15.6.1.1_A1_T3.js b/test/built-ins/Boolean/S15.6.1.1_A1_T3.js index 54801ae1cc..1c9194c8cd 100644 --- a/test/built-ins/Boolean/S15.6.1.1_A1_T3.js +++ b/test/built-ins/Boolean/S15.6.1.1_A1_T3.js @@ -1,6 +1,5 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- info: | Returns a boolean value (not a Boolean object) computed by @@ -9,42 +8,25 @@ esid: sec-terms-and-definitions-boolean-value description: Used various string values as argument ---*/ -//CHECK#1 -if (typeof Boolean("0") !== "boolean") { - throw new Test262Error('#1.1: typeof Boolean("0") should be "boolean", actual is "' + typeof Boolean("0") + '"'); -} -if (Boolean("0") !== true) { - throw new Test262Error('#1.2: Boolean("0") should be true'); -} +assert.sameValue(typeof Boolean("0"), "boolean", 'The value of `typeof Boolean("0")` is expected to be "boolean"'); +assert.sameValue(Boolean("0"), true, 'Boolean("0") must return true'); +assert.sameValue(typeof Boolean("-1"), "boolean", 'The value of `typeof Boolean("-1")` is expected to be "boolean"'); +assert.sameValue(Boolean("-1"), true, 'Boolean("-1") must return true'); +assert.sameValue(typeof Boolean("1"), "boolean", 'The value of `typeof Boolean("1")` is expected to be "boolean"'); +assert.sameValue(Boolean("1"), true, 'Boolean("1") must return true'); -//CHECK#2 -if (typeof Boolean("-1") !== "boolean") { - throw new Test262Error('#2.1: typeof Boolean("-1") should be "boolean", actual is "' + typeof Boolean("-1") + '"'); -} -if (Boolean("-1") !== true) { - throw new Test262Error('#2.2: Boolean("-1") should be true'); -} +assert.sameValue( + typeof Boolean("false"), + "boolean", + 'The value of `typeof Boolean("false")` is expected to be "boolean"' +); -//CHECK#3 -if (typeof Boolean("1") !== "boolean") { - throw new Test262Error('#3.1: typeof Boolean("1") should be "boolean", actual is "' + typeof Boolean("1") + '"'); -} -if (Boolean("1") !== true) { - throw new Test262Error('#3.2: Boolean("1") should be true'); -} +assert.sameValue(Boolean("false"), true, 'Boolean("false") must return true'); -//CHECK#4 -if (typeof Boolean("false") !== "boolean") { - throw new Test262Error('#4.1: typeof Boolean("false") should be "boolean", actual is "' + typeof Boolean("false") + '"'); -} -if (Boolean("false") !== true) { - throw new Test262Error('#4.2: Boolean("false") should be true'); -} +assert.sameValue( + typeof Boolean("true"), + "boolean", + 'The value of `typeof Boolean("true")` is expected to be "boolean"' +); -//CHECK#5 -if (typeof Boolean("true") !== "boolean") { - throw new Test262Error('#5.1: typeof Boolean("true") should be "boolean", actual is "' + typeof Boolean("true") + '"'); -} -if (Boolean("true") !== true) { - throw new Test262Error('#5.2: Boolean("true") should be true'); -} +assert.sameValue(Boolean("true"), true, 'Boolean("true") must return true'); diff --git a/test/built-ins/Boolean/S15.6.1.1_A1_T4.js b/test/built-ins/Boolean/S15.6.1.1_A1_T4.js index 083f7edc2e..9730be4715 100644 --- a/test/built-ins/Boolean/S15.6.1.1_A1_T4.js +++ b/test/built-ins/Boolean/S15.6.1.1_A1_T4.js @@ -9,43 +9,31 @@ esid: sec-terms-and-definitions-boolean-value description: Used various undefined values and null as argument ---*/ -//CHECK#1 -if (typeof Boolean(undefined) !== "boolean") { - throw new Test262Error('#1.1: typeof Boolean(undefined) should be "boolean", actual is "' + typeof Boolean(undefined) + '"'); -} -if (Boolean(undefined) !== false) { - throw new Test262Error('#1.2: Boolean(undefined) should be false'); -} +assert.sameValue( + typeof Boolean(undefined), + "boolean", + 'The value of `typeof Boolean(undefined)` is expected to be "boolean"' +); -//CHECK#2 -if (typeof Boolean(void 0) !== "boolean") { - throw new Test262Error('#2.1: typeof Boolean(void 0) should be "boolean", actual is "' + typeof Boolean(void 0) + '"'); -} -if (Boolean(void 0) !== false) { - throw new Test262Error('#2.2: Boolean(void 0) should be false'); -} +assert.sameValue(Boolean(undefined), false, 'Boolean(undefined) must return false'); -//CHECK#3 -if (typeof Boolean(function() {}()) !== "boolean") { - throw new Test262Error('#3.1: typeof Boolean(function(){}()) should be "boolean", actual is "' + typeof Boolean(function() {}()) + '"'); -} -if (Boolean(function() {}()) !== false) { - throw new Test262Error('#3.2: Boolean(function(){}()) should be false'); -} +assert.sameValue( + typeof Boolean(void 0), + "boolean", + 'The value of `typeof Boolean(void 0)` is expected to be "boolean"' +); -//CHECK#4 -if (typeof Boolean(null) !== "boolean") { - throw new Test262Error('#4.1: typeof Boolean(null) should be "boolean", actual is "' + typeof Boolean(null) + '"'); -} -if (Boolean(null) !== false) { - throw new Test262Error('#4.2: Boolean(null) should be false'); -} +assert.sameValue(Boolean(void 0), false, 'Boolean(void 0) must return false'); -//CHECK#5 -if (typeof Boolean(x) !== "boolean") { - throw new Test262Error('#5.1: var x; typeof Boolean(x) should be "boolean", actual is "' + typeof Boolean(x) + '"'); -} -if (Boolean(x) !== false) { - throw new Test262Error('#5.2: var x; Boolean(x) should be false'); -} +assert.sameValue( + typeof Boolean(function() {}()), + "boolean", + 'The value of `typeof Boolean(function() {}())` is expected to be "boolean"' +); + +assert.sameValue(Boolean(function() {}()), false, 'Boolean(function() {}()) must return false'); +assert.sameValue(typeof Boolean(null), "boolean", 'The value of `typeof Boolean(null)` is expected to be "boolean"'); +assert.sameValue(Boolean(null), false, 'Boolean(null) must return false'); +assert.sameValue(typeof Boolean(x), "boolean", 'The value of `typeof Boolean(x)` is expected to be "boolean"'); +assert.sameValue(Boolean(x), false, 'Boolean() must return false'); var x; diff --git a/test/built-ins/Boolean/S15.6.1.1_A1_T5.js b/test/built-ins/Boolean/S15.6.1.1_A1_T5.js index 5eb9177f3b..52cf730836 100644 --- a/test/built-ins/Boolean/S15.6.1.1_A1_T5.js +++ b/test/built-ins/Boolean/S15.6.1.1_A1_T5.js @@ -11,42 +11,31 @@ description: Used various assigning values to any variable as argument var x; -//CHECK#1 -if (typeof Boolean(x = 0) !== "boolean") { - throw new Test262Error('#1.1: typeof Boolean(x=0) should be "boolean", actual is "' + typeof Boolean(x = 0) + '"'); -} -if (Boolean(x = 0) !== false) { - throw new Test262Error('#1.2: Boolean(x=0) should be false'); -} +assert.sameValue(typeof Boolean(x = 0), "boolean", 'The value of `typeof Boolean(x = 0)` is expected to be "boolean"'); +assert.sameValue(Boolean(x = 0), false, 'Boolean(x = 0) must return false'); +assert.sameValue(typeof Boolean(x = 1), "boolean", 'The value of `typeof Boolean(x = 1)` is expected to be "boolean"'); +assert.sameValue(Boolean(x = 1), true, 'Boolean(x = 1) must return true'); -//CHECK#2 -if (typeof Boolean(x = 1) !== "boolean") { - throw new Test262Error('#2.1: typeof Boolean(x=1) should be "boolean", actual is "' + typeof Boolean(x = 1) + '"'); -} -if (Boolean(x = 1) !== true) { - throw new Test262Error('#2.2: Boolean(x=1) should be true'); -} +assert.sameValue( + typeof Boolean(x = false), + "boolean", + 'The value of `typeof Boolean(x = false)` is expected to be "boolean"' +); -//CHECK#3 -if (typeof Boolean(x = false) !== "boolean") { - throw new Test262Error('#3.1: typeof Boolean(x=false) should be "boolean", actual is "' + typeof Boolean(x = false) + '"'); -} -if (Boolean(x = false) !== false) { - throw new Test262Error('#3.2: Boolean(x=false) should be false'); -} +assert.sameValue(Boolean(x = false), false, 'Boolean(x = false) must return false'); -//CHECK#4 -if (typeof Boolean(x = true) !== "boolean") { - throw new Test262Error('#4.1: typeof Boolean(x=true) should be "boolean", actual is "' + typeof Boolean(x = true) + '"'); -} -if (Boolean(x = true) !== true) { - throw new Test262Error('#4.2: Boolean(x=true) should be true'); -} +assert.sameValue( + typeof Boolean(x = true), + "boolean", + 'The value of `typeof Boolean(x = true)` is expected to be "boolean"' +); -//CHECK#5 -if (typeof Boolean(x = null) !== "boolean") { - throw new Test262Error('#5.1: typeof Boolean(x=null) should be "boolean", actual is "' + typeof Boolean(x = null) + '"'); -} -if (Boolean(x = null) !== false) { - throw new Test262Error('#5.2: Boolean(x=null) should be false'); -} +assert.sameValue(Boolean(x = true), true, 'Boolean(x = true) must return true'); + +assert.sameValue( + typeof Boolean(x = null), + "boolean", + 'The value of `typeof Boolean(x = null)` is expected to be "boolean"' +); + +assert.sameValue(Boolean(x = null), false, 'Boolean(x = null) must return false'); diff --git a/test/built-ins/Boolean/S15.6.1.1_A2.js b/test/built-ins/Boolean/S15.6.1.1_A2.js index 53fbc9f691..b52fe3a4d1 100644 --- a/test/built-ins/Boolean/S15.6.1.1_A2.js +++ b/test/built-ins/Boolean/S15.6.1.1_A2.js @@ -6,13 +6,5 @@ info: Boolean() returns false esid: sec-terms-and-definitions-boolean-value description: Call Boolean() and check result ---*/ - -//CHECK#1 -if (typeof Boolean() !== "boolean") { - throw new Test262Error('#1: typeof Boolean() should be "boolean", actual is "' + typeof Boolean() + '"'); -} - -//CHECK#2 -if (Boolean() !== false) { - throw new Test262Error('#2: Boolean() should be false'); -} +assert.sameValue(typeof Boolean(), "boolean", 'The value of `typeof Boolean()` is expected to be "boolean"'); +assert.sameValue(Boolean(), false, 'Boolean() must return false'); diff --git a/test/built-ins/Boolean/S15.6.2.1_A1.js b/test/built-ins/Boolean/S15.6.2.1_A1.js index f0ccd8a217..1d61077272 100644 --- a/test/built-ins/Boolean/S15.6.2.1_A1.js +++ b/test/built-ins/Boolean/S15.6.2.1_A1.js @@ -9,46 +9,19 @@ esid: sec-boolean-constructor description: Checking type of the newly created object and it value ---*/ -//CHECK#1 -if (typeof new Boolean() !== "object") { - throw new Test262Error("#1: typeof new Boolean() === 'object'"); -} +assert.sameValue(typeof new Boolean(), "object", 'The value of `typeof new Boolean()` is expected to be "object"'); +assert.notSameValue(new Boolean(), undefined, 'new Boolean() is expected to not equal ``undefined``'); -//CHECK#2 -if (new Boolean() === undefined) { - throw new Test262Error("#2: new Boolean() should not be undefined"); -} - -//CHECK#3 var x3 = new Boolean(); -if (typeof x3 !== "object") { - throw new Test262Error("#3: typeof new Boolean() !== 'object'"); -} +assert.sameValue(typeof x3, "object", 'The value of `typeof x3` is expected to be "object"'); -//CHECK#4 var x4 = new Boolean(); -if (x4 === undefined) { - throw new Test262Error("#4: new Boolean() should not be undefined"); -} +assert.notSameValue(x4, undefined, 'The value of x4 is expected to not equal ``undefined``'); +assert.sameValue(typeof new Boolean(1), "object", 'The value of `typeof new Boolean(1)` is expected to be "object"'); +assert.notSameValue(new Boolean(1), undefined, 'new Boolean(1) is expected to not equal ``undefined``'); -//CHECK#5 -if (typeof new Boolean(1) !== "object") { - throw new Test262Error("#5: typeof new Boolean(10) === 'object'"); -} - -//CHECK#6 -if (new Boolean(1) === undefined) { - throw new Test262Error("#6: new Boolean(1) should not be undefined"); -} - -//CHECK#7 var x7 = new Boolean(1); -if (typeof x7 !== "object") { - throw new Test262Error("#7: typeof new Boolean(1) !== 'object'"); -} +assert.sameValue(typeof x7, "object", 'The value of `typeof x7` is expected to be "object"'); -//CHECK#8 var x8 = new Boolean(1); -if (x8 === undefined) { - throw new Test262Error("#8: new Boolean(1) should not be undefined"); -} +assert.notSameValue(x8, undefined, 'The value of x8 is expected to not equal ``undefined``'); diff --git a/test/built-ins/Boolean/S15.6.2.1_A2.js b/test/built-ins/Boolean/S15.6.2.1_A2.js index c45df404b2..5e6faed393 100644 --- a/test/built-ins/Boolean/S15.6.2.1_A2.js +++ b/test/built-ins/Boolean/S15.6.2.1_A2.js @@ -12,18 +12,20 @@ description: Checking prototype property of the newly created object // CHECK#1 var x1 = new Boolean(1); -if (typeof x1.constructor.prototype !== "object") { - throw new Test262Error('#1: typeof x1.constructor.prototype === "object"'); -} -//CHECK#2 +assert.sameValue( + typeof x1.constructor.prototype, + "object", + 'The value of `typeof x1.constructor.prototype` is expected to be "object"' +); + var x2 = new Boolean(2); -if (!Boolean.prototype.isPrototypeOf(x2)) { - throw new Test262Error('#2: Boolean.prototype.isPrototypeOf(x2)'); -} +assert(Boolean.prototype.isPrototypeOf(x2), 'Boolean.prototype.isPrototypeOf(x2) must return true'); -//CHECK#3 var x3 = new Boolean(3); -if (Boolean.prototype !== x3.constructor.prototype) { - throw new Test262Error('#3: Boolean.prototype === x3.constructor.prototype'); -} + +assert.sameValue( + Boolean.prototype, + x3.constructor.prototype, + 'The value of Boolean.prototype is expected to equal the value of x3.constructor.prototype' +); diff --git a/test/built-ins/Boolean/S15.6.2.1_A3.js b/test/built-ins/Boolean/S15.6.2.1_A3.js index d7cf2dcd51..86b3138672 100644 --- a/test/built-ins/Boolean/S15.6.2.1_A3.js +++ b/test/built-ins/Boolean/S15.6.2.1_A3.js @@ -11,24 +11,13 @@ description: Checking value of the newly created object // CHECK#1 var x1 = new Boolean(1); -if (x1.valueOf() !== true) { - throw new Test262Error('#1: var x1 = new Boolean(1); x1.valueOf() === true'); -} +assert.sameValue(x1.valueOf(), true, 'x1.valueOf() must return true'); -//CHECK#2 var x2 = new Boolean(); -if (x2.valueOf() !== false) { - throw new Test262Error('#2: var x2 = new Boolean(); x2.valueOf() === false'); -} +assert.sameValue(x2.valueOf(), false, 'x2.valueOf() must return false'); -//CHECK#3 var x2 = new Boolean(0); -if (x2.valueOf() !== false) { - throw new Test262Error('#3: var x2 = new Boolean(0); x2.valueOf() === false'); -} +assert.sameValue(x2.valueOf(), false, 'x2.valueOf() must return false'); -//CHECK#4 var x2 = new Boolean(new Object()); -if (x2.valueOf() !== true) { - throw new Test262Error('#4: var x2 = new Boolean(new Object()); x2.valueOf() === true'); -} +assert.sameValue(x2.valueOf(), true, 'x2.valueOf() must return true'); diff --git a/test/built-ins/Boolean/S15.6.2.1_A4.js b/test/built-ins/Boolean/S15.6.2.1_A4.js index 82aa244fae..bfe2ef891a 100644 --- a/test/built-ins/Boolean/S15.6.2.1_A4.js +++ b/test/built-ins/Boolean/S15.6.2.1_A4.js @@ -13,7 +13,4 @@ delete Boolean.prototype.toString; var obj = new Boolean(); -//CHECK#1 -if (obj.toString() !== "[object Boolean]") { - throw new Test262Error('#1: The [[Class]] property of the newly constructed object is set to "Boolean"'); -} +assert.sameValue(obj.toString(), "[object Boolean]", 'obj.toString() must return "[object Boolean]"'); diff --git a/test/built-ins/Boolean/S15.6.3_A1.js b/test/built-ins/Boolean/S15.6.3_A1.js index a80531708b..8d2d2ce33a 100644 --- a/test/built-ins/Boolean/S15.6.3_A1.js +++ b/test/built-ins/Boolean/S15.6.3_A1.js @@ -6,7 +6,4 @@ info: The Boolean constructor has the property "prototype" esid: sec-boolean.prototype description: Checking existence of the property "prototype" ---*/ - -if (!Boolean.hasOwnProperty("prototype")) { - throw new Test262Error('#1: The Boolean constructor has the property "prototype"'); -} +assert(Boolean.hasOwnProperty("prototype"), 'Boolean.hasOwnProperty("prototype") must return true'); diff --git a/test/built-ins/Boolean/S15.6.3_A2.js b/test/built-ins/Boolean/S15.6.3_A2.js index 0ebd6d55e6..64cd69e662 100644 --- a/test/built-ins/Boolean/S15.6.3_A2.js +++ b/test/built-ins/Boolean/S15.6.3_A2.js @@ -8,8 +8,7 @@ info: | esid: sec-boolean.prototype description: Checking prototype of the Boolean constructor ---*/ - -//CHECK#1 -if (!(Function.prototype.isPrototypeOf(Boolean))) { - throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Boolean constructor is the Function prototype object.'); -} +assert( + Function.prototype.isPrototypeOf(Boolean), + 'Function.prototype.isPrototypeOf(Boolean) must return true' +); diff --git a/test/built-ins/Boolean/S15.6.3_A3.js b/test/built-ins/Boolean/S15.6.3_A3.js index 16cbe9b8ff..d13bf27daa 100644 --- a/test/built-ins/Boolean/S15.6.3_A3.js +++ b/test/built-ins/Boolean/S15.6.3_A3.js @@ -6,13 +6,5 @@ info: Boolean constructor has length property whose value is 1 esid: sec-boolean.prototype description: Checking Boolean.length property ---*/ - -//CHECK#1 -if (!Boolean.hasOwnProperty("length")) { - throw new Test262Error('#1: Boolean constructor has length property'); -} - -//CHECK#2 -if (Boolean.length !== 1) { - throw new Test262Error('#2: Boolean constructor length property value is 1'); -} +assert(Boolean.hasOwnProperty("length"), 'Boolean.hasOwnProperty("length") must return true'); +assert.sameValue(Boolean.length, 1, 'The value of Boolean.length is expected to be 1'); diff --git a/test/built-ins/Boolean/S9.2_A1_T1.js b/test/built-ins/Boolean/S9.2_A1_T1.js index fd7011c5ae..298fdbdaeb 100644 --- a/test/built-ins/Boolean/S9.2_A1_T1.js +++ b/test/built-ins/Boolean/S9.2_A1_T1.js @@ -9,22 +9,7 @@ description: > transformation ---*/ -// CHECK#1 -if (Boolean(undefined) !== false) { - throw new Test262Error('#1: Boolean(undefined) === false. Actual: ' + (Boolean(undefined))); -} - -// CHECK#2 -if (Boolean(void 0) !== false) { - throw new Test262Error('#2: Boolean(undefined) === false. Actual: ' + (Boolean(undefined))); -} - -// CHECK#3 -if (Boolean(eval("var x")) !== false) { - throw new Test262Error('#3: Boolean(eval("var x")) === false. Actual: ' + (Boolean(eval("var x")))); -} - -// CHECK#4 -if (Boolean() !== false) { - throw new Test262Error('#4: Boolean() === false. Actual: ' + (Boolean())); -} +assert.sameValue(Boolean(undefined), false, 'Boolean(undefined) must return false'); +assert.sameValue(Boolean(void 0), false, 'Boolean(void 0) must return false'); +assert.sameValue(Boolean(eval("var x")), false, 'Boolean(eval("var x")) must return false'); +assert.sameValue(Boolean(), false, 'Boolean() must return false'); diff --git a/test/built-ins/Boolean/S9.2_A2_T1.js b/test/built-ins/Boolean/S9.2_A2_T1.js index 04862a012e..14a4d7c69e 100644 --- a/test/built-ins/Boolean/S9.2_A2_T1.js +++ b/test/built-ins/Boolean/S9.2_A2_T1.js @@ -6,8 +6,4 @@ info: Result of boolean conversion from null value is false esid: sec-toboolean description: null convert to Boolean by explicit transformation ---*/ - -// CHECK#1 -if (Boolean(null) !== false) { - throw new Test262Error('#1: Boolean(null) === false. Actual: ' + (Boolean(null))); -} +assert.sameValue(Boolean(null), false, 'Boolean(null) must return false'); diff --git a/test/built-ins/Boolean/S9.2_A3_T1.js b/test/built-ins/Boolean/S9.2_A3_T1.js index 0f961dba9c..424504c39c 100644 --- a/test/built-ins/Boolean/S9.2_A3_T1.js +++ b/test/built-ins/Boolean/S9.2_A3_T1.js @@ -6,13 +6,5 @@ info: Result of boolean conversion from boolean value is no conversion esid: sec-toboolean description: true and false convert to Boolean by explicit transformation ---*/ - -// CHECK#1 -if (Boolean(true) !== true) { - throw new Test262Error('#1: Boolean(true) === true. Actual: ' + (Boolean(true))); -} - -// CHECK#2 -if (Boolean(false) !== false) { - throw new Test262Error('#2: Boolean(false) === false. Actual: ' + (Boolean(false))); -} +assert.sameValue(Boolean(true), true, 'Boolean(true) must return true'); +assert.sameValue(Boolean(false), false, 'Boolean(false) must return false'); diff --git a/test/built-ins/Boolean/S9.2_A4_T1.js b/test/built-ins/Boolean/S9.2_A4_T1.js index 617c739995..79ee97c1d1 100644 --- a/test/built-ins/Boolean/S9.2_A4_T1.js +++ b/test/built-ins/Boolean/S9.2_A4_T1.js @@ -8,18 +8,6 @@ info: | esid: sec-toboolean description: +0, -0 and NaN convert to Boolean by explicit transformation ---*/ - -// CHECK#1 -if (Boolean(+0) !== false) { - throw new Test262Error('#1: Boolean(+0) === false. Actual: ' + (Boolean(+0))); -} - -// CHECK#2 -if (Boolean(-0) !== false) { - throw new Test262Error('#2: Boolean(-0) === false. Actual: ' + (Boolean(-0))); -} - -// CHECK#3 -if (Boolean(Number.NaN) !== false) { - throw new Test262Error('#3: Boolean(Number.NaN) === false. Actual: ' + (Boolean(Number.NaN))); -} +assert.sameValue(Boolean(+0), false, 'Boolean(+0) must return false'); +assert.sameValue(Boolean(-0), false, 'Boolean(-0) must return false'); +assert.sameValue(Boolean(Number.NaN), false, 'Boolean(Number.NaN) must return false'); diff --git a/test/built-ins/Boolean/S9.2_A4_T3.js b/test/built-ins/Boolean/S9.2_A4_T3.js index 894e289603..267c7bf8d4 100644 --- a/test/built-ins/Boolean/S9.2_A4_T3.js +++ b/test/built-ins/Boolean/S9.2_A4_T3.js @@ -11,43 +11,11 @@ description: > Number.MAX_VALUE, Number.MIN_VALUE and some numbers convert to Boolean by explicit transformation ---*/ - -// CHECK#1 -if (Boolean(Number.POSITIVE_INFINITY) !== true) { - throw new Test262Error('#1: Boolean(+Infinity) === true. Actual: ' + (Boolean(+Infinity))); -} - -// CHECK#2; -if (Boolean(Number.NEGATIVE_INFINITY) !== true) { - throw new Test262Error('#2: Boolean(-Infinity) === true. Actual: ' + (Boolean(-Infinity))); -} - -// CHECK#3 -if (Boolean(Number.MAX_VALUE) !== true) { - throw new Test262Error('#3: Boolean(Number.MAX_VALUE) === true. Actual: ' + (Boolean(Number.MAX_VALUE))); -} - -// CHECK#4 -if (Boolean(Number.MIN_VALUE) !== true) { - throw new Test262Error('#4: Boolean(Number.MIN_VALUE) === true. Actual: ' + (Boolean(Number.MIN_VALUE))); -} - -// CHECK#5 -if (Boolean(13) !== true) { - throw new Test262Error('#5: Boolean(13) === true. Actual: ' + (Boolean(13))); -} - -// CHECK#6 -if (Boolean(-13) !== true) { - throw new Test262Error('#6: Boolean(-13) === true. Actual: ' + (Boolean(-13))); -} - -// CHECK#7 -if (Boolean(1.3) !== true) { - throw new Test262Error('#7: Boolean(1.3) === true. Actual: ' + (Boolean(1.3))); -} - -// CHECK#8 -if (Boolean(-1.3) !== true) { - throw new Test262Error('#8: Boolean(-1.3) === true. Actual: ' + (Boolean(-1.3))); -} +assert.sameValue(Boolean(Number.POSITIVE_INFINITY), true, 'Boolean(Number.POSITIVE_INFINITY) must return true'); +assert.sameValue(Boolean(Number.NEGATIVE_INFINITY), true, 'Boolean(Number.NEGATIVE_INFINITY) must return true'); +assert.sameValue(Boolean(Number.MAX_VALUE), true, 'Boolean(Number.MAX_VALUE) must return true'); +assert.sameValue(Boolean(Number.MIN_VALUE), true, 'Boolean(Number.MIN_VALUE) must return true'); +assert.sameValue(Boolean(13), true, 'Boolean(13) must return true'); +assert.sameValue(Boolean(-13), true, 'Boolean(-13) must return true'); +assert.sameValue(Boolean(1.3), true, 'Boolean(1.3) must return true'); +assert.sameValue(Boolean(-1.3), true, 'Boolean(-1.3) must return true'); diff --git a/test/built-ins/Boolean/S9.2_A5_T1.js b/test/built-ins/Boolean/S9.2_A5_T1.js index 0b475d9c07..1bf51f9268 100644 --- a/test/built-ins/Boolean/S9.2_A5_T1.js +++ b/test/built-ins/Boolean/S9.2_A5_T1.js @@ -8,8 +8,4 @@ info: | esid: sec-toboolean description: "\"\" is converted to Boolean by explicit transformation" ---*/ - -// CHECK#1 -if (Boolean("") !== false) { - throw new Test262Error('#1: Boolean("") === false. Actual: ' + (Boolean(""))); -} +assert.sameValue(Boolean(""), false, 'Boolean("") must return false'); diff --git a/test/built-ins/Boolean/S9.2_A5_T3.js b/test/built-ins/Boolean/S9.2_A5_T3.js index 5e72451d04..74b275f82a 100644 --- a/test/built-ins/Boolean/S9.2_A5_T3.js +++ b/test/built-ins/Boolean/S9.2_A5_T3.js @@ -8,13 +8,5 @@ info: | esid: sec-toboolean description: Any nonempty string convert to Boolean by explicit transformation ---*/ - -// CHECK#1 -if (Boolean(" ") !== true) { - throw new Test262Error('#1: Boolean(" ") === true. Actual: ' + (Boolean(" "))); -} - -// CHECK#2 -if (Boolean("Nonempty String") !== true) { - throw new Test262Error('#2: Boolean("Nonempty String") === true. Actual: ' + (Boolean("Nonempty String"))); -} +assert.sameValue(Boolean(" "), true, 'Boolean(" ") must return true'); +assert.sameValue(Boolean("Nonempty String"), true, 'Boolean("Nonempty String") must return true'); diff --git a/test/built-ins/Boolean/S9.2_A6_T1.js b/test/built-ins/Boolean/S9.2_A6_T1.js index 07313fae0d..be713cceb5 100644 --- a/test/built-ins/Boolean/S9.2_A6_T1.js +++ b/test/built-ins/Boolean/S9.2_A6_T1.js @@ -7,97 +7,33 @@ esid: sec-toboolean description: Different objects convert to Boolean by explicit transformation ---*/ -// CHECK#1 -if (Boolean(new Object()) !== true) { - throw new Test262Error('#1: Boolean(new Object()) === true. Actual: ' + (Boolean(new Object()))); -} +assert.sameValue(Boolean(new Object()), true, 'Boolean(new Object()) must return true'); +assert.sameValue(Boolean(new String("")), true, 'Boolean(new String("")) must return true'); +assert.sameValue(Boolean(new String()), true, 'Boolean(new String()) must return true'); +assert.sameValue(Boolean(new Boolean(true)), true, 'Boolean(new Boolean(true)) must return true'); +assert.sameValue(Boolean(new Boolean(false)), true, 'Boolean(new Boolean(false)) must return true'); +assert.sameValue(Boolean(new Boolean()), true, 'Boolean(new Boolean()) must return true'); +assert.sameValue(Boolean(new Array()), true, 'Boolean(new Array()) must return true'); +assert.sameValue(Boolean(new Number()), true, 'Boolean(new Number()) must return true'); +assert.sameValue(Boolean(new Number(-0)), true, 'Boolean(new Number(-0)) must return true'); +assert.sameValue(Boolean(new Number(0)), true, 'Boolean(new Number(0)) must return true'); +assert.sameValue(Boolean(new Number()), true, 'Boolean(new Number()) must return true'); +assert.sameValue(Boolean(new Number(Number.NaN)), true, 'Boolean(new Number(Number.NaN)) must return true'); +assert.sameValue(Boolean(new Number(-1)), true, 'Boolean(new Number(-1)) must return true'); +assert.sameValue(Boolean(new Number(1)), true, 'Boolean(new Number(1)) must return true'); -// CHECK#2 -if (Boolean(new String("")) !== true) { - throw new Test262Error('#2: Boolean(new String("")) === true. Actual: ' + (Boolean(new String("")))); -} +assert.sameValue( + Boolean(new Number(Number.POSITIVE_INFINITY)), + true, + 'Boolean(new Number(Number.POSITIVE_INFINITY)) must return true' +); -// CHECK#3 -if (Boolean(new String()) !== true) { - throw new Test262Error('#3: Boolean(new String()) === true. Actual: ' + (Boolean(new String()))); -} +assert.sameValue( + Boolean(new Number(Number.NEGATIVE_INFINITY)), + true, + 'Boolean(new Number(Number.NEGATIVE_INFINITY)) must return true' +); -// CHECK#4 -if (Boolean(new Boolean(true)) !== true) { - throw new Test262Error('#4: Boolean(new Boolean(true)) === true. Actual: ' + (Boolean(new Boolean(true)))); -} - -// CHECK#5 -if (Boolean(new Boolean(false)) !== true) { - throw new Test262Error('#5: Boolean(new Boolean(false)) === true. Actual: ' + (Boolean(new Boolean(false)))); -} - -// CHECK#6 -if (Boolean(new Boolean()) !== true) { - throw new Test262Error('#6: Boolean(new Boolean()) === true. Actual: ' + (Boolean(new Boolean()))); -} - -// CHECK#7 -if (Boolean(new Array()) !== true) { - throw new Test262Error('#7: Boolean(new Array()) === true. Actual: ' + (Boolean(new Array()))); -} - -// CHECK#8 -if (Boolean(new Number()) !== true) { - throw new Test262Error('#8: Boolean(new Number()) === true. Actual: ' + (Boolean(new Number()))); -} - -// CHECK#9 -if (Boolean(new Number(-0)) !== true) { - throw new Test262Error('#9: Boolean(new Number(-0)) === true. Actual: ' + (Boolean(new Number(-0)))); -} - -// CHECK#10 -if (Boolean(new Number(0)) !== true) { - throw new Test262Error('#10: Boolean(new Number(0)) === true. Actual: ' + (Boolean(new Number(0)))); -} - -// CHECK#11 -if (Boolean(new Number()) !== true) { - throw new Test262Error('#11: Boolean(new Number()) === true. Actual: ' + (Boolean(new Number()))); -} - -// CHECK#12 -if (Boolean(new Number(Number.NaN)) !== true) { - throw new Test262Error('#12: Boolean(new Number(Number.NaN)) === true. Actual: ' + (Boolean(new Number(Number.NaN)))); -} - -// CHECK#13 -if (Boolean(new Number(-1)) !== true) { - throw new Test262Error('#13: Boolean(new Number(-1)) === true. Actual: ' + (Boolean(new Number(-1)))); -} - -// CHECK#14 -if (Boolean(new Number(1)) !== true) { - throw new Test262Error('#14: Boolean(new Number(1)) === true. Actual: ' + (Boolean(new Number(1)))); -} - -// CHECK#15 -if (Boolean(new Number(Number.POSITIVE_INFINITY)) !== true) { - throw new Test262Error('#15: Boolean(new Number(Number.POSITIVE_INFINITY)) === true. Actual: ' + (Boolean(new Number(Number.POSITIVE_INFINITY)))); -} - -// CHECK#16 -if (Boolean(new Number(Number.NEGATIVE_INFINITY)) !== true) { - throw new Test262Error('#16: Boolean(new Number(Number.NEGATIVE_INFINITY)) === true. Actual: ' + (Boolean(new Number(Number.NEGATIVE_INFINITY)))); -} - -// CHECK#17 -if (Boolean(new Function()) !== true) { - throw new Test262Error('#17: Boolean(new Function()) === true. Actual: ' + (Boolean(new Function()))); -} - -// CHECK#18 -if (Boolean(new Date()) !== true) { - throw new Test262Error('#18: Boolean(new Date()) === true. Actual: ' + (Boolean(new Date()))); -} - -// CHECK#19 -if (Boolean(new Date(0)) !== true) { - throw new Test262Error('#19: Boolean(new Date(0)) === true. Actual: ' + (Boolean(new Date(0)))); -} +assert.sameValue(Boolean(new Function()), true, 'Boolean(new Function()) must return true'); +assert.sameValue(Boolean(new Date()), true, 'Boolean(new Date()) must return true'); +assert.sameValue(Boolean(new Date(0)), true, 'Boolean(new Date(0)) must return true'); diff --git a/test/built-ins/Boolean/prototype/S15.6.3.1_A1.js b/test/built-ins/Boolean/prototype/S15.6.3.1_A1.js index 3c2643eaa5..30be0fb71c 100644 --- a/test/built-ins/Boolean/prototype/S15.6.3.1_A1.js +++ b/test/built-ins/Boolean/prototype/S15.6.3.1_A1.js @@ -9,18 +9,18 @@ esid: sec-boolean.prototype description: Checking Boolean.prototype property ---*/ -//CHECK#1 -if (typeof Boolean.prototype !== "object") { - throw new Test262Error('#1: typeof Boolean.prototype === "object"'); -} +assert.sameValue( + typeof Boolean.prototype, + "object", + 'The value of `typeof Boolean.prototype` is expected to be "object"' +); -//CHECK#2 -if (Boolean.prototype != false) { - throw new Test262Error('#2: Boolean.prototype == false'); -} +assert(Boolean.prototype == false, 'The value of Boolean.prototype is expected to be false'); delete Boolean.prototype.toString; -if (Boolean.prototype.toString() !== "[object Boolean]") { - throw new Test262Error('#3: The [[Class]] property of the Boolean prototype object is set to "Boolean"'); -} +assert.sameValue( + Boolean.prototype.toString(), + "[object Boolean]", + 'Boolean.prototype.toString() must return "[object Boolean]"' +); diff --git a/test/built-ins/Boolean/prototype/S15.6.3.1_A2.js b/test/built-ins/Boolean/prototype/S15.6.3.1_A2.js index 3763855612..e4fa59c976 100644 --- a/test/built-ins/Boolean/prototype/S15.6.3.1_A2.js +++ b/test/built-ins/Boolean/prototype/S15.6.3.1_A2.js @@ -11,6 +11,4 @@ includes: [propertyHelper.js] // CHECK#1 var x = Boolean.prototype; verifyNotWritable(Boolean, "prototype", null, 1); -if (Boolean.prototype !== x) { - throw new Test262Error('#1: Boolean.prototype has the attribute ReadOnly'); -} +assert.sameValue(Boolean.prototype, x, 'The value of Boolean.prototype is expected to equal the value of x'); diff --git a/test/built-ins/Boolean/prototype/S15.6.3.1_A3.js b/test/built-ins/Boolean/prototype/S15.6.3.1_A3.js index 96c9b1ee15..fd9214cd59 100644 --- a/test/built-ins/Boolean/prototype/S15.6.3.1_A3.js +++ b/test/built-ins/Boolean/prototype/S15.6.3.1_A3.js @@ -6,16 +6,12 @@ info: Boolean.prototype has the attribute DontDelete esid: sec-boolean.prototype description: Checking if deleting the Boolean.prototype property fails includes: [propertyHelper.js] +flags: [onlyStrict] ---*/ // CHECK#1 verifyNotConfigurable(Boolean, "prototype"); -try { - if (delete Boolean.prototype !== false) { - throw new Test262Error('#1: Boolean.prototype has the attribute DontDelete'); - } -} catch (e) { - if (e instanceof Test262Error) throw e; - assert(e instanceof TypeError); -} +assert.throws(TypeError, () => { + delete Boolean.prototype; +}); diff --git a/test/built-ins/Boolean/prototype/S15.6.3.1_A4.js b/test/built-ins/Boolean/prototype/S15.6.3.1_A4.js index b55ee7d637..e3fb901a15 100644 --- a/test/built-ins/Boolean/prototype/S15.6.3.1_A4.js +++ b/test/built-ins/Boolean/prototype/S15.6.3.1_A4.js @@ -7,13 +7,11 @@ esid: sec-boolean.prototype description: Checking if enumerating the Boolean.prototype property fails ---*/ -//CHECK#1 for (x in Boolean) { - if (x === "prototype") { - throw new Test262Error('#1: Boolean.prototype has the attribute DontEnum'); - } + assert.notSameValue(x, "prototype", 'The value of x is not "prototype"'); } -if (Boolean.propertyIsEnumerable('prototype')) { - throw new Test262Error('#2: Boolean.prototype has the attribute DontEnum'); -} +assert( + !Boolean.propertyIsEnumerable('prototype'), + 'The value of !Boolean.propertyIsEnumerable(\'prototype\') is expected to be true' +); diff --git a/test/built-ins/Boolean/prototype/S15.6.4_A2.js b/test/built-ins/Boolean/prototype/S15.6.4_A2.js index 3e1ba3602c..16b500e66c 100644 --- a/test/built-ins/Boolean/prototype/S15.6.4_A2.js +++ b/test/built-ins/Boolean/prototype/S15.6.4_A2.js @@ -9,7 +9,7 @@ esid: sec-properties-of-the-boolean-prototype-object description: Checking Object.prototype.isPrototypeOf(Boolean.prototype) ---*/ -//CHECK#1 -if (!Object.prototype.isPrototypeOf(Boolean.prototype)) { - throw new Test262Error('#1: Object prototype object is the prototype of Boolean prototype object'); -} +assert( + Object.prototype.isPrototypeOf(Boolean.prototype), + 'Object.prototype.isPrototypeOf(Boolean.prototype) must return true' +); diff --git a/test/built-ins/Boolean/prototype/constructor/S15.6.4.1_A1.js b/test/built-ins/Boolean/prototype/constructor/S15.6.4.1_A1.js index 2688193fba..319e158678 100644 --- a/test/built-ins/Boolean/prototype/constructor/S15.6.4.1_A1.js +++ b/test/built-ins/Boolean/prototype/constructor/S15.6.4.1_A1.js @@ -8,8 +8,8 @@ info: | esid: sec-boolean-constructor description: Compare Boolean.prototype.constructor with Boolean ---*/ - -//CHECK#1 -if (Boolean.prototype.constructor !== Boolean) { - throw new Test262Error('#1: Boolean.prototype.constructor === Boolean'); -} +assert.sameValue( + Boolean.prototype.constructor, + Boolean, + 'The value of Boolean.prototype.constructor is expected to equal the value of Boolean' +); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T1.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T1.js index 1be7ad201c..112d2758fd 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T1.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T1.js @@ -10,38 +10,15 @@ info: | es5id: 15.6.4.2_A1_T1 description: no arguments ---*/ +assert.sameValue(Boolean.prototype.toString(), "false", 'Boolean.prototype.toString() must return "false"'); +assert.sameValue((new Boolean()).toString(), "false", '(new Boolean()).toString() must return "false"'); +assert.sameValue((new Boolean(false)).toString(), "false", '(new Boolean(false)).toString() must return "false"'); +assert.sameValue((new Boolean(true)).toString(), "true", '(new Boolean(true)).toString() must return "true"'); +assert.sameValue((new Boolean(1)).toString(), "true", '(new Boolean(1)).toString() must return "true"'); +assert.sameValue((new Boolean(0)).toString(), "false", '(new Boolean(0)).toString() must return "false"'); -//CHECK#1 -if (Boolean.prototype.toString() !== "false") { - throw new Test262Error('#1: Boolean.prototype.toString() === "false"'); -} - -//CHECK#2 -if ((new Boolean()).toString() !== "false") { - throw new Test262Error('#2: (new Boolean()).toString() === "false"'); -} - -//CHECK#3 -if ((new Boolean(false)).toString() !== "false") { - throw new Test262Error('#3: (new Boolean(false)).toString() === "false"'); -} - -//CHECK#4 -if ((new Boolean(true)).toString() !== "true") { - throw new Test262Error('#4: (new Boolean(true)).toString() === "true"'); -} - -//CHECK#5 -if ((new Boolean(1)).toString() !== "true") { - throw new Test262Error('#5: (new Boolean(1)).toString() === "true"'); -} - -//CHECK#6 -if ((new Boolean(0)).toString() !== "false") { - throw new Test262Error('#6: (new Boolean(0)).toString() === "false"'); -} - -//CHECK#7 -if ((new Boolean(new Object())).toString() !== "true") { - throw new Test262Error('#7: (new Boolean(new Object())).toString() === "true"'); -} +assert.sameValue( + (new Boolean(new Object())).toString(), + "true", + '(new Boolean(new Object())).toString() must return "true"' +); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js index 63a3ccc43c..aa9ee8aa7e 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js @@ -10,38 +10,26 @@ info: | es5id: 15.6.4.2_A1_T2 description: with some argument ---*/ +assert.sameValue(Boolean.prototype.toString(true), "false", 'Boolean.prototype.toString(true) must return "false"'); +assert.sameValue((new Boolean()).toString(true), "false", '(new Boolean()).toString(true) must return "false"'); -//CHECK#1 -if (Boolean.prototype.toString(true) !== "false") { - throw new Test262Error('#1: Boolean.prototype.toString(true) === "false"'); -} +assert.sameValue( + (new Boolean(false)).toString(true), + "false", + '(new Boolean(false)).toString(true) must return "false"' +); -//CHECK#2 -if ((new Boolean()).toString(true) !== "false") { - throw new Test262Error('#2: (new Boolean()).toString(true) === "false"'); -} +assert.sameValue( + (new Boolean(true)).toString(false), + "true", + '(new Boolean(true)).toString(false) must return "true"' +); -//CHECK#3 -if ((new Boolean(false)).toString(true) !== "false") { - throw new Test262Error('#3: (new Boolean(false)).toString(true) === "false"'); -} +assert.sameValue((new Boolean(1)).toString(false), "true", '(new Boolean(1)).toString(false) must return "true"'); +assert.sameValue((new Boolean(0)).toString(true), "false", '(new Boolean(0)).toString(true) must return "false"'); -//CHECK#4 -if ((new Boolean(true)).toString(false) !== "true") { - throw new Test262Error('#4: (new Boolean(true)).toString(false) === "true"'); -} - -//CHECK#5 -if ((new Boolean(1)).toString(false) !== "true") { - throw new Test262Error('#5: (new Boolean(1)).toString(false) === "true"'); -} - -//CHECK#6 -if ((new Boolean(0)).toString(true) !== "false") { - throw new Test262Error('#6: (new Boolean(0)).toString(true) === "false"'); -} - -//CHECK#7 -if ((new Boolean(new Object())).toString(false) !== "true") { - throw new Test262Error('#7: (new Boolean(new Object())).toString(false) === "true"'); -} +assert.sameValue( + (new Boolean(new Object())).toString(false), + "true", + '(new Boolean(new Object())).toString(false) must return "true"' +); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T1.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T1.js index a7e1e4ce8d..ed04c02d31 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T1.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T1.js @@ -11,28 +11,16 @@ es5id: 15.6.4.2_A2_T1 description: transferring to the String objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new String(); s1.toString = Boolean.prototype.toString; var v1 = s1.toString(); - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + throw new Test262Error(); +}); -//CHECK#2 -try { +assert.throws(TypeError, () => { var s2 = new String(); s2.myToString = Boolean.prototype.toString; var v2 = s2.myToString(); - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T2.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T2.js index 583d633ecb..730be0568b 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T2.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T2.js @@ -11,28 +11,16 @@ es5id: 15.6.4.2_A2_T2 description: transferring to the Number objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new Number(); s1.toString = Boolean.prototype.toString; - var v1 = s1.toString(); - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.toString(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new Number(); s2.myToString = Boolean.prototype.toString; - var v2 = s2.myToString(); - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myToString(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T3.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T3.js index 2bb3bad3ad..46a5642c22 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T3.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T3.js @@ -11,28 +11,16 @@ es5id: 15.6.4.2_A2_T3 description: transferring to the Date objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new Date(); s1.toString = Boolean.prototype.toString; - var v1 = s1.toString(); - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.toString(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new Date(); s2.myToString = Boolean.prototype.toString; - var v2 = s2.myToString(); - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myToString(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T4.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T4.js index 659c144f29..344248541a 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T4.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T4.js @@ -11,28 +11,17 @@ es5id: 15.6.4.2_A2_T4 description: transferring to the Object objects ---*/ -//CHECK#1 -try { + +assert.throws(TypeError, () => { var s1 = new Object(); s1.toString = Boolean.prototype.toString; - var v1 = s1.toString(); - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.toString(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new Object(); s2.myToString = Boolean.prototype.toString; - var v2 = s2.myToString(); - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myToString(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T5.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T5.js index b7a7dcf73d..3b5cf9ad7a 100644 --- a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T5.js +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A2_T5.js @@ -11,32 +11,20 @@ es5id: 15.6.4.2_A2_T5 description: transferring to the other objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = { x: 1 }; s1.toString = Boolean.prototype.toString; - var v1 = s1.toString(); - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.toString(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = { x: 1 }; s2.myToString = Boolean.prototype.toString; - var v2 = s2.myToString(); - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myToString(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T1.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T1.js index d17eec52eb..9976f705c2 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T1.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T1.js @@ -6,33 +6,14 @@ info: Boolean.prototype.valueOf() returns this boolean value esid: sec-boolean.prototype.valueof description: no arguments ---*/ +assert.sameValue(Boolean.prototype.valueOf(), false, 'Boolean.prototype.valueOf() must return false'); +assert.sameValue((new Boolean()).valueOf(), false, '(new Boolean()).valueOf() must return false'); +assert.sameValue((new Boolean(0)).valueOf(), false, '(new Boolean(0)).valueOf() must return false'); +assert.sameValue((new Boolean(-1)).valueOf(), true, '(new Boolean(-1)).valueOf() must return true'); +assert.sameValue((new Boolean(1)).valueOf(), true, '(new Boolean(1)).valueOf() must return true'); -//CHECK#1 -if (Boolean.prototype.valueOf() !== false) { - throw new Test262Error('#1: Boolean.prototype.valueOf() === false'); -} - -//CHECK#2 -if ((new Boolean()).valueOf() !== false) { - throw new Test262Error('#2: (new Boolean()).valueOf() === false'); -} - -//CHECK#3 -if ((new Boolean(0)).valueOf() !== false) { - throw new Test262Error('#3: (new Boolean(0)).valueOf() === false'); -} - -//CHECK#4 -if ((new Boolean(-1)).valueOf() !== true) { - throw new Test262Error('#4: (new Boolean(-1)).valueOf() === true'); -} - -//CHECK#5 -if ((new Boolean(1)).valueOf() !== true) { - throw new Test262Error('#5: (new Boolean(1)).valueOf() === true'); -} - -//CHECK#6 -if ((new Boolean(new Object())).valueOf() !== true) { - throw new Test262Error('#6: (new Boolean(new Object())).valueOf() === true'); -} +assert.sameValue( + (new Boolean(new Object())).valueOf(), + true, + '(new Boolean(new Object())).valueOf() must return true' +); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T2.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T2.js index 2c2b8b23aa..7335754afb 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T2.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T2.js @@ -6,33 +6,14 @@ info: Boolean.prototype.valueOf() returns this boolean value esid: sec-boolean.prototype.valueof description: calling with argument ---*/ +assert.sameValue(Boolean.prototype.valueOf(true), false, 'Boolean.prototype.valueOf(true) must return false'); +assert.sameValue((new Boolean()).valueOf(true), false, '(new Boolean()).valueOf(true) must return false'); +assert.sameValue((new Boolean(0)).valueOf(true), false, '(new Boolean(0)).valueOf(true) must return false'); +assert.sameValue((new Boolean(-1)).valueOf(false), true, '(new Boolean(-1)).valueOf(false) must return true'); +assert.sameValue((new Boolean(1)).valueOf(false), true, '(new Boolean(1)).valueOf(false) must return true'); -//CHECK#1 -if (Boolean.prototype.valueOf(true) !== false) { - throw new Test262Error('#1: Boolean.prototype.valueOf(true) === false'); -} - -//CHECK#2 -if ((new Boolean()).valueOf(true) !== false) { - throw new Test262Error('#2: (new Boolean()).valueOf(true) === false'); -} - -//CHECK#3 -if ((new Boolean(0)).valueOf(true) !== false) { - throw new Test262Error('#3: (new Boolean(0)).valueOf(true) === false'); -} - -//CHECK#4 -if ((new Boolean(-1)).valueOf(false) !== true) { - throw new Test262Error('#4: (new Boolean(-1)).valueOf(false) === true'); -} - -//CHECK#5 -if ((new Boolean(1)).valueOf(false) !== true) { - throw new Test262Error('#5: (new Boolean(1)).valueOf(false) === true'); -} - -//CHECK#6 -if ((new Boolean(new Object())).valueOf(false) !== true) { - throw new Test262Error('#6: (new Boolean(new Object())).valueOf(false) === true'); -} +assert.sameValue( + (new Boolean(new Object())).valueOf(false), + true, + '(new Boolean(new Object())).valueOf(false) must return true' +); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T1.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T1.js index 72ba9dd6c4..e0ec51781c 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T1.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T1.js @@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof description: transferring to the String objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new String(); s1.valueOf = Boolean.prototype.valueOf; - var v1 = s1.valueOf(); - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.valueOf(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new String(); - s2.myValueOf = Boolean.prototype.valueOf; - var v2 = s2.myValueOf(); - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myvalueOf = Boolean.prototype.valueOf; + s2.myvalueOf(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T2.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T2.js index 85be0f0bb1..f7d2e4aa84 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T2.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T2.js @@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof description: transferring to the Number objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new Number(); s1.valueOf = Boolean.prototype.valueOf; - var v1 = s1.valueOf(); - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.valueOf(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new Number(); - s2.myValueOf = Boolean.prototype.valueOf; - var v2 = s2.myValueOf(); - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myvalueOf = Boolean.prototype.valueOf; + s2.myvalueOf(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T3.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T3.js index f6ac9d7376..5f1c8a1b77 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T3.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T3.js @@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof description: transferring to the Date objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new Date(); s1.valueOf = Boolean.prototype.valueOf; - var v1 = s1.valueOf(); - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.valueOf(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new Date(); - s2.myValueOf = Boolean.prototype.valueOf; - var v2 = s2.myValueOf(); - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myvalueOf = Boolean.prototype.valueOf; + s2.myvalueOf(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T4.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T4.js index 2eb35aa2b7..528c4b47bd 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T4.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T4.js @@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof description: transferring to the Object objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = new Object(); s1.valueOf = Boolean.prototype.valueOf; - var v1 = s1.valueOf(); - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.valueOf(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = new Object(); - s2.myValueOf = Boolean.prototype.valueOf; - var v2 = s2.myValueOf(); - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myvalueOf = Boolean.prototype.valueOf; + s2.myvalueOf(); + throw new Test262Error(); +}); diff --git a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T5.js b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T5.js index cbbffad489..beb240e318 100644 --- a/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T5.js +++ b/test/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A2_T5.js @@ -10,32 +10,20 @@ esid: sec-boolean.prototype.valueof description: transferring to the other objects ---*/ -//CHECK#1 -try { +assert.throws(TypeError, () => { var s1 = { x: 1 }; s1.valueOf = Boolean.prototype.valueOf; - var v1 = s1.valueOf(); - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s1.valueOf(); + throw new Test262Error(); +}); -//CHECK#1 -try { +assert.throws(TypeError, () => { var s2 = { x: 1 }; - s2.myValueOf = Boolean.prototype.valueOf; - var v2 = s2.myValueOf(); - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError'); -} -catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e); - } -} + s2.myvalueOf = Boolean.prototype.valueOf; + s2.myvalueOf(); + throw new Test262Error(); +});