From 35ce309dc7788f53a03c3a2484ece22bdc9f38f1 Mon Sep 17 00:00:00 2001 From: rwaldron Date: Wed, 11 Aug 2021 14:53:42 -0400 Subject: [PATCH] Transform legacy format to harness assertions: test/built-ins/F*/**/*.js --- test/built-ins/Function/S10.1.1_A1_T3.js | 9 ++++-- test/built-ins/Function/S15.3.1_A1_T1.js | 28 ++++--------------- test/built-ins/Function/S15.3.2.1_A1_T1.js | 5 +--- test/built-ins/Function/S15.3.2.1_A1_T10.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T11.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T12.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T13.js | 8 +++--- test/built-ins/Function/S15.3.2.1_A1_T2.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T3.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T4.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T5.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T6.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T7.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A1_T8.js | 8 +++--- test/built-ins/Function/S15.3.2.1_A1_T9.js | 11 ++------ test/built-ins/Function/S15.3.2.1_A2_T1.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A2_T2.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A2_T3.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A2_T4.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A2_T5.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A2_T6.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T1.js | 5 +--- test/built-ins/Function/S15.3.2.1_A3_T10.js | 8 +++--- test/built-ins/Function/S15.3.2.1_A3_T11.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T12.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T13.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T14.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T15.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T2.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T3.js | 10 ++----- test/built-ins/Function/S15.3.2.1_A3_T4.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T5.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T6.js | 8 +++--- test/built-ins/Function/S15.3.2.1_A3_T7.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T8.js | 12 ++------ test/built-ins/Function/S15.3.2.1_A3_T9.js | 8 +++--- test/built-ins/Function/S15.3.2_A1.js | 11 ++------ test/built-ins/Function/S15.3.3_A1.js | 5 +--- test/built-ins/Function/S15.3.3_A2_T1.js | 9 +++--- test/built-ins/Function/S15.3.3_A2_T2.js | 5 +--- test/built-ins/Function/S15.3.3_A3.js | 12 ++------ test/built-ins/Function/S15.3.5_A1_T1.js | 8 ++++-- test/built-ins/Function/S15.3.5_A1_T2.js | 8 ++++-- test/built-ins/Function/S15.3.5_A2_T1.js | 21 +++++--------- test/built-ins/Function/S15.3.5_A2_T2.js | 21 +++++--------- test/built-ins/Function/S15.3.5_A3_T1.js | 17 ++--------- test/built-ins/Function/S15.3.5_A3_T2.js | 17 ++--------- test/built-ins/Function/S15.3_A1.js | 4 +-- test/built-ins/Function/S15.3_A2_T1.js | 8 +++--- test/built-ins/Function/S15.3_A2_T2.js | 8 +++--- test/built-ins/Function/S15.3_A3_T1.js | 7 +---- test/built-ins/Function/S15.3_A3_T2.js | 10 ++----- test/built-ins/Function/S15.3_A3_T3.js | 22 +++++---------- test/built-ins/Function/S15.3_A3_T4.js | 10 ++----- test/built-ins/Function/S15.3_A3_T5.js | 21 +++----------- test/built-ins/Function/S15.3_A3_T6.js | 10 ++----- .../StrictFunction_reservedwords_with.js | 4 +-- .../StrictFunction_restricted-properties.js | 20 ++++++------- .../Function/length/S15.3.5.1_A1_T1.js | 11 ++------ .../Function/length/S15.3.5.1_A1_T2.js | 11 ++------ .../Function/length/S15.3.5.1_A1_T3.js | 11 ++------ .../Function/length/S15.3.5.1_A2_T1.js | 23 ++++----------- .../Function/length/S15.3.5.1_A2_T2.js | 16 +++-------- .../Function/length/S15.3.5.1_A2_T3.js | 16 +++-------- .../Function/length/S15.3.5.1_A3_T1.js | 18 +++++------- .../Function/length/S15.3.5.1_A3_T2.js | 18 +++++------- .../Function/length/S15.3.5.1_A3_T3.js | 18 +++++------- .../Function/length/S15.3.5.1_A4_T1.js | 12 +++----- .../Function/length/S15.3.5.1_A4_T2.js | 12 +++----- .../Function/length/S15.3.5.1_A4_T3.js | 12 +++----- .../Function/prototype/S15.3.3.1_A1.js | 12 +++----- .../Function/prototype/S15.3.3.1_A2.js | 19 +++++++------ .../Function/prototype/S15.3.3.1_A3.js | 12 ++++---- .../Function/prototype/S15.3.3.1_A4.js | 10 ++++--- .../Function/prototype/S15.3.4_A1.js | 10 +++---- .../Function/prototype/S15.3.4_A2_T1.js | 5 +--- .../Function/prototype/S15.3.4_A2_T2.js | 5 +--- .../Function/prototype/S15.3.4_A2_T3.js | 11 ++------ .../Function/prototype/S15.3.4_A3_T1.js | 11 ++++---- .../Function/prototype/S15.3.4_A3_T2.js | 5 +--- .../Function/prototype/S15.3.4_A4.js | 28 ++++++++++--------- .../Function/prototype/S15.3.4_A5.js | 2 +- .../Function/prototype/S15.3.5.2_A1_T1.js | 17 +++++------ .../Function/prototype/S15.3.5.2_A1_T2.js | 17 +++++------ .../Function/prototype/apply/S15.3.4.3_A12.js | 10 +++---- .../prototype/apply/S15.3.4.3_A1_T1.js | 12 ++------ .../prototype/apply/S15.3.4.3_A1_T2.js | 12 ++------ .../prototype/apply/S15.3.4.3_A3_T1.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T10.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T2.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T3.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T4.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T5.js | 13 ++------- .../prototype/apply/S15.3.4.3_A3_T6.js | 13 ++------- .../prototype/apply/S15.3.4.3_A3_T7.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T8.js | 5 +--- .../prototype/apply/S15.3.4.3_A3_T9.js | 5 +--- .../prototype/apply/S15.3.4.3_A5_T1.js | 11 ++------ .../prototype/apply/S15.3.4.3_A5_T2.js | 11 ++------ .../prototype/apply/S15.3.4.3_A5_T3.js | 11 ++------ .../prototype/apply/S15.3.4.3_A5_T4.js | 11 ++------ .../prototype/apply/S15.3.4.3_A5_T5.js | 5 +--- .../prototype/apply/S15.3.4.3_A5_T6.js | 5 +--- .../prototype/apply/S15.3.4.3_A5_T7.js | 5 +--- .../prototype/apply/S15.3.4.3_A5_T8.js | 5 +--- .../prototype/apply/S15.3.4.3_A7_T1.js | 5 +--- .../prototype/apply/S15.3.4.3_A7_T10.js | 14 ++++------ .../prototype/apply/S15.3.4.3_A7_T2.js | 5 +--- .../prototype/apply/S15.3.4.3_A7_T3.js | 14 ++++------ .../prototype/apply/S15.3.4.3_A7_T4.js | 14 ++++------ .../prototype/apply/S15.3.4.3_A7_T5.js | 11 ++------ .../prototype/apply/S15.3.4.3_A7_T6.js | 14 ++++------ .../prototype/apply/S15.3.4.3_A7_T7.js | 5 +--- .../prototype/apply/S15.3.4.3_A7_T8.js | 5 +--- .../prototype/apply/S15.3.4.3_A7_T9.js | 14 ++++------ .../prototype/apply/S15.3.4.3_A8_T1.js | 4 +-- .../prototype/apply/S15.3.4.3_A8_T2.js | 4 +-- .../prototype/apply/S15.3.4.3_A8_T3.js | 4 +-- .../prototype/apply/S15.3.4.3_A8_T4.js | 4 +-- .../prototype/apply/S15.3.4.3_A8_T5.js | 4 +-- .../prototype/apply/S15.3.4.3_A8_T6.js | 6 +--- .../Function/prototype/bind/S15.3.4.5_A1.js | 2 +- .../Function/prototype/bind/S15.3.4.5_A13.js | 2 +- .../Function/prototype/bind/S15.3.4.5_A14.js | 2 +- .../Function/prototype/bind/S15.3.4.5_A15.js | 2 +- .../Function/prototype/bind/S15.3.4.5_A16.js | 4 +-- .../Function/prototype/bind/S15.3.4.5_A2.js | 2 +- .../Function/prototype/bind/S15.3.4.5_A3.js | 8 +++--- .../Function/prototype/bind/S15.3.4.5_A5.js | 9 ++++-- .../Function/prototype/call/S15.3.4.4_A10.js | 20 +++++++------ .../Function/prototype/call/S15.3.4.4_A11.js | 23 ++++++++------- .../Function/prototype/call/S15.3.4.4_A12.js | 10 +++---- .../Function/prototype/call/S15.3.4.4_A13.js | 2 +- .../Function/prototype/call/S15.3.4.4_A14.js | 2 +- .../Function/prototype/call/S15.3.4.4_A15.js | 2 +- .../Function/prototype/call/S15.3.4.4_A16.js | 4 +-- .../prototype/call/S15.3.4.4_A1_T1.js | 12 ++------ .../prototype/call/S15.3.4.4_A1_T2.js | 12 ++------ .../prototype/call/S15.3.4.4_A2_T1.js | 24 ++++++++-------- .../prototype/call/S15.3.4.4_A2_T2.js | 17 ++--------- .../prototype/call/S15.3.4.4_A3_T1.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T10.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T2.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T3.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T4.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T5.js | 13 ++------- .../prototype/call/S15.3.4.4_A3_T6.js | 13 ++------- .../prototype/call/S15.3.4.4_A3_T7.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T8.js | 5 +--- .../prototype/call/S15.3.4.4_A3_T9.js | 5 +--- .../prototype/call/S15.3.4.4_A5_T1.js | 11 ++------ .../prototype/call/S15.3.4.4_A5_T2.js | 11 ++------ .../prototype/call/S15.3.4.4_A5_T3.js | 11 ++------ .../prototype/call/S15.3.4.4_A5_T4.js | 11 ++------ .../prototype/call/S15.3.4.4_A5_T5.js | 5 +--- .../prototype/call/S15.3.4.4_A5_T6.js | 5 +--- .../prototype/call/S15.3.4.4_A5_T7.js | 5 +--- .../prototype/call/S15.3.4.4_A5_T8.js | 5 +--- .../prototype/call/S15.3.4.4_A6_T1.js | 20 +++++-------- .../prototype/call/S15.3.4.4_A6_T10.js | 14 ++++------ .../prototype/call/S15.3.4.4_A6_T2.js | 6 +--- .../prototype/call/S15.3.4.4_A6_T3.js | 7 +---- .../prototype/call/S15.3.4.4_A6_T4.js | 14 ++++------ .../prototype/call/S15.3.4.4_A6_T5.js | 11 ++------ .../prototype/call/S15.3.4.4_A6_T6.js | 14 ++++------ .../prototype/call/S15.3.4.4_A6_T7.js | 5 +--- .../prototype/call/S15.3.4.4_A6_T8.js | 5 +--- .../prototype/call/S15.3.4.4_A6_T9.js | 14 ++++------ .../prototype/call/S15.3.4.4_A7_T1.js | 4 +-- .../prototype/call/S15.3.4.4_A7_T2.js | 4 +-- .../prototype/call/S15.3.4.4_A7_T3.js | 4 +-- .../prototype/call/S15.3.4.4_A7_T4.js | 4 +-- .../prototype/call/S15.3.4.4_A7_T5.js | 4 +-- .../prototype/call/S15.3.4.4_A7_T6.js | 6 +--- .../Function/prototype/call/S15.3.4.4_A9.js | 25 +++++++++-------- .../prototype/constructor/S15.3.4.1_A1_T1.js | 10 +++---- .../prototype/toString/S15.3.4.2_A10.js | 20 +++++++------ .../prototype/toString/S15.3.4.2_A11.js | 18 ++++++------ .../prototype/toString/S15.3.4.2_A12.js | 2 +- .../prototype/toString/S15.3.4.2_A13.js | 2 +- .../prototype/toString/S15.3.4.2_A14.js | 2 +- .../prototype/toString/S15.3.4.2_A16.js | 2 +- .../prototype/toString/S15.3.4.2_A6.js | 10 +++---- .../prototype/toString/S15.3.4.2_A7.js | 2 +- .../prototype/toString/S15.3.4.2_A8.js | 23 ++++++++------- .../prototype/toString/S15.3.4.2_A9.js | 25 +++++++++-------- 186 files changed, 576 insertions(+), 1289 deletions(-) diff --git a/test/built-ins/Function/S10.1.1_A1_T3.js b/test/built-ins/Function/S10.1.1_A1_T3.js index 54f7eb9eaf..4245406d95 100644 --- a/test/built-ins/Function/S10.1.1_A1_T3.js +++ b/test/built-ins/Function/S10.1.1_A1_T3.js @@ -11,9 +11,12 @@ description: > object as a constructor ---*/ -//CHECK#1 var x = new function f1() { return 1; }; -if (typeof(x.constructor) !== "function") - throw new Test262Error('#1: typeof(x.constructor)!=="function"'); + +assert.sameValue( + typeof(x.constructor), + "function", + 'The value of `typeof(x.constructor)` is expected to be "function"' +); diff --git a/test/built-ins/Function/S15.3.1_A1_T1.js b/test/built-ins/Function/S15.3.1_A1_T1.js index d956532990..0948835f2c 100644 --- a/test/built-ins/Function/S15.3.1_A1_T1.js +++ b/test/built-ins/Function/S15.3.1_A1_T1.js @@ -11,30 +11,12 @@ description: Create simple functions and check returned values var f = Function("return arguments[0];"); -//CHECK#1 -if (!(f instanceof Function)) { - throw new Test262Error('#1: f instanceof Function'); -} - -//CHECK#2 -if (f(1) !== 1) { - throw new Test262Error('#2: f(1) !== 1'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f(1), 1, 'f(1) must return 1'); var g = new Function("return arguments[0];"); -//CHECK#3 -if (!(g instanceof Function)) { - throw new Test262Error('#3: g instanceof Function'); -} - -//CHECK#4 -if (g("A") !== "A") { - throw new Test262Error('#4: g("A") !== "A"'); -} - -//CHECK#5 -if (g("A") !== f("A")) { - throw new Test262Error('#5: g("A") !== f("A")'); -} +assert(g instanceof Function, 'The result of evaluating (g instanceof Function) is expected to be true'); +assert.sameValue(g("A"), "A", 'g("A") must return "A"'); +assert.sameValue(g("A"), f("A"), 'g("A") must return the same value returned by f("A")'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T1.js b/test/built-ins/Function/S15.3.2.1_A1_T1.js index 6fc8c0cee6..a65bb2ede8 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T1.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T1.js @@ -20,12 +20,9 @@ var body = { } } -//CHECK#1 try { var f = new Function(body); throw new Test262Error('#1: When the Function constructor is called with one argument then body be that argument the following step are taken: call ToString(body)'); } catch (e) { - if (e !== 7) { - throw new Test262Error('#1.1: When the Function constructor is called with one argument then body be that argument the following step are taken: call ToString(body)'); - } + assert.sameValue(e, 7, 'The value of e is expected to be 7'); } diff --git a/test/built-ins/Function/S15.3.2.1_A1_T10.js b/test/built-ins/Function/S15.3.2.1_A1_T10.js index ede43780bc..dc57be6fa9 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T10.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T10.js @@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T10 description: Value of the function constructor argument is "null" ---*/ -//CHECK#1 try { var f = new Function(null); } catch (e) { throw new Test262Error('#1: test fails with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T11.js b/test/built-ins/Function/S15.3.2.1_A1_T11.js index 174235723a..d556c8b27a 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T11.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T11.js @@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T11 description: Value of the function constructor argument is "undefined" ---*/ -//CHECK#1 try { var f = new Function(undefined); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T12.js b/test/built-ins/Function/S15.3.2.1_A1_T12.js index efdd574425..e30b8d5076 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T12.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T12.js @@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T12 description: Value of the function constructor argument is "void 0" ---*/ -//CHECK#1 try { var f = new Function(void 0); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T13.js b/test/built-ins/Function/S15.3.2.1_A1_T13.js index 131981f350..40524f8398 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T13.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T13.js @@ -14,12 +14,12 @@ es5id: 15.3.2.1_A1_T13 description: Value of the function constructor argument is "{}" ---*/ -//CHECK#1 try { var f = new Function({}); throw new Test262Error('#1: test failed with error ' + e); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3.2.1_A1_T2.js b/test/built-ins/Function/S15.3.2.1_A1_T2.js index 6f54ecfbad..49d2d88680 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T2.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T2.js @@ -22,19 +22,11 @@ var body = { } }; -//CHECK#1 try { var f = new Function(body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== 1) { - throw new Test262Error('#3: hen the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), 1, 'f() must return 1'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T3.js b/test/built-ins/Function/S15.3.2.1_A1_T3.js index a3f6bff4cb..1d6f4ecf38 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T3.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T3.js @@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T3 description: Value of the function constructor argument is 1 ---*/ -//CHECK#1 try { var f = new Function(1); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T4.js b/test/built-ins/Function/S15.3.2.1_A1_T4.js index 5ad84eadfa..33ad6ddca5 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T4.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T4.js @@ -16,21 +16,13 @@ description: > specified with "undefined" ---*/ -//CHECK#1 try { var f = new Function(x); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); var x; diff --git a/test/built-ins/Function/S15.3.2.1_A1_T5.js b/test/built-ins/Function/S15.3.2.1_A1_T5.js index 553cba3ddb..e041679090 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T5.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T5.js @@ -18,19 +18,11 @@ description: > var body = Object("return \'A\'"); -//CHECK#1 try { var f = new Function(body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== "\u0041") { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), "\u0041", 'f() must return "u0041"'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T6.js b/test/built-ins/Function/S15.3.2.1_A1_T6.js index 8f40503c8e..3b188aff50 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T6.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T6.js @@ -16,19 +16,11 @@ description: > true;" ---*/ -//CHECK#1 try { var f = new Function("return true;"); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (!(f())) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert(f(), 'f() must return true'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T7.js b/test/built-ins/Function/S15.3.2.1_A1_T7.js index be884d91f3..5ab3c643ca 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T7.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T7.js @@ -16,19 +16,11 @@ description: Value of the function constructor argument is "Object(1)" var body = new Object(1); -//CHECK#1 try { var f = new Function(body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A1_T8.js b/test/built-ins/Function/S15.3.2.1_A1_T8.js index 063bf2d739..b55e2fb825 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T8.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T8.js @@ -16,12 +16,12 @@ description: Value of the function constructor argument is "var 1=1;" var body = "var 1=1;"; -//CHECK#1 try { var f = new Function(body); throw new Test262Error('#1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3.2.1_A1_T9.js b/test/built-ins/Function/S15.3.2.1_A1_T9.js index df2acd1434..b4848d7413 100644 --- a/test/built-ins/Function/S15.3.2.1_A1_T9.js +++ b/test/built-ins/Function/S15.3.2.1_A1_T9.js @@ -18,12 +18,5 @@ description: > var f = new Function("return arguments[0];"); -//CHECK#1 -if (!(f instanceof Function)) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument and the following steps are taken...'); -} - -//CHECK#2 -if (f("A") !== "A") { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and the following steps are taken...'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f("A"), "A", 'f("A") must return "A"'); diff --git a/test/built-ins/Function/S15.3.2.1_A2_T1.js b/test/built-ins/Function/S15.3.2.1_A2_T1.js index 59025264fd..eaaa91bc4f 100644 --- a/test/built-ins/Function/S15.3.2.1_A2_T1.js +++ b/test/built-ins/Function/S15.3.2.1_A2_T1.js @@ -11,19 +11,11 @@ description: > "arg3", "return arg1+arg2+arg3;" ---*/ -//CHECK#1 try { var f = Function("arg1", "arg2", "arg3", "return arg1+arg2+arg3;"); } catch (e) { throw new Test262Error('#1: test failed'); } -//CHECK#2 -if (!(f instanceof Function)) { - throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} - -//CHECK#3 -if (f(1, 2, 3) !== 6) { - throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f(1, 2, 3), 6, 'f(1, 2, 3) must return 6'); diff --git a/test/built-ins/Function/S15.3.2.1_A2_T2.js b/test/built-ins/Function/S15.3.2.1_A2_T2.js index 2323c609fd..baf9fb0b9c 100644 --- a/test/built-ins/Function/S15.3.2.1_A2_T2.js +++ b/test/built-ins/Function/S15.3.2.1_A2_T2.js @@ -11,19 +11,11 @@ description: > "arg3", "return arg1+arg2+arg3;" ---*/ -//CHECK#1 try { var f = Function("arg1, arg2", "arg3", "return arg1+arg2+arg3;"); } catch (e) { throw new Test262Error('#1: test failed'); } -//CHECK#2 -if (!(f instanceof Function)) { - throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} - -//CHECK#3 -if (f("AB", "BA", 1) !== "ABBA1") { - throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f("AB", "BA", 1), "ABBA1", 'f(AB, BA, 1) must return "ABBA1"'); diff --git a/test/built-ins/Function/S15.3.2.1_A2_T3.js b/test/built-ins/Function/S15.3.2.1_A2_T3.js index 5c75b000f1..a595215eee 100644 --- a/test/built-ins/Function/S15.3.2.1_A2_T3.js +++ b/test/built-ins/Function/S15.3.2.1_A2_T3.js @@ -11,19 +11,11 @@ description: > arg3", "return arg1+arg2+arg3;" ---*/ -//CHECK#1 try { var f = Function("arg1, arg2, arg3", "return arg1+arg2+arg3;"); } catch (e) { throw new Test262Error('#1: test failed'); } -//CHECK#2 -if (!(f instanceof Function)) { - throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} - -//CHECK#3 -if (f(1, 1, "ABBA") !== "2ABBA") { - throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f(1, 1, "ABBA"), "2ABBA", 'f(1, 1, ABBA) must return "2ABBA"'); diff --git a/test/built-ins/Function/S15.3.2.1_A2_T4.js b/test/built-ins/Function/S15.3.2.1_A2_T4.js index 1fd4e4b7f8..4a9db95f84 100644 --- a/test/built-ins/Function/S15.3.2.1_A2_T4.js +++ b/test/built-ins/Function/S15.3.2.1_A2_T4.js @@ -19,19 +19,11 @@ var p = { } }; -//CHECK#1 try { var f = Function(p, p, p, "return arg1+arg2+arg3;"); } catch (e) { throw new Test262Error('#1: test failed'); } -//CHECK#2 -if (!(f instanceof Function)) { - throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} - -//CHECK#3 -if (f(4, "2", "QUESTION") !== "42QUESTION") { - throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f(4, "2", "QUESTION"), "42QUESTION", 'f(4, 2, QUESTION) must return "42QUESTION"'); diff --git a/test/built-ins/Function/S15.3.2.1_A2_T5.js b/test/built-ins/Function/S15.3.2.1_A2_T5.js index fae676a25a..173df21ff8 100644 --- a/test/built-ins/Function/S15.3.2.1_A2_T5.js +++ b/test/built-ins/Function/S15.3.2.1_A2_T5.js @@ -19,19 +19,11 @@ var p = { } }; -//CHECK#1 try { var f = Function(p + "," + p, p, "return arg1+arg2+arg3;"); } catch (e) { throw new Test262Error('#1: test failed'); } -//CHECK#2 -if (!(f instanceof Function)) { - throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} - -//CHECK#3 -if (f("", 1, 2) !== "12") { - throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f("", 1, 2), "12", 'f(, 1, 2) must return "12"'); diff --git a/test/built-ins/Function/S15.3.2.1_A2_T6.js b/test/built-ins/Function/S15.3.2.1_A2_T6.js index a7a973d1ed..0615459004 100644 --- a/test/built-ins/Function/S15.3.2.1_A2_T6.js +++ b/test/built-ins/Function/S15.3.2.1_A2_T6.js @@ -19,19 +19,11 @@ var p = { } }; -//CHECK#1 try { var f = Function(p + "," + p + "," + p, "return arg1+arg2+arg3;"); } catch (e) { throw new Test262Error('#1: test failed'); } -//CHECK#2 -if (!(f instanceof Function)) { - throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} - -//CHECK#3 -if (f("", 1, p) !== "1arg4") { - throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); -} +assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true'); +assert.sameValue(f("", 1, p), "1arg4", 'f(, 1, {toString: function() {return "arg" + (++i)}}) must return "1arg4"'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T1.js b/test/built-ins/Function/S15.3.2.1_A3_T1.js index 7c7a6f05c2..0dd471b69a 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T1.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T1.js @@ -30,12 +30,9 @@ var body = { } }; -//CHECK#1 try { var f = new Function(p, body); throw new Test262Error('#1: test failed'); } catch (e) { - if (e !== 1) { - throw new Test262Error('#1.1: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))'); - } + assert.sameValue(e, 1, 'The value of e is expected to be 1'); } diff --git a/test/built-ins/Function/S15.3.2.1_A3_T10.js b/test/built-ins/Function/S15.3.2.1_A3_T10.js index 9504a28301..eefd3c1888 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T10.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T10.js @@ -25,12 +25,12 @@ var p = { } }; -//CHECK#1 try { var f = new Function(p, body); throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3.2.1_A3_T11.js b/test/built-ins/Function/S15.3.2.1_A3_T11.js index ebaf91171a..6970d807b7 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T11.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T11.js @@ -20,19 +20,11 @@ description: > var p = "a,b,c"; -//CHECK#1 try { var f = new Function(p, void 0); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T12.js b/test/built-ins/Function/S15.3.2.1_A3_T12.js index 0d4aa018e8..72d2dbe1be 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T12.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T12.js @@ -20,19 +20,11 @@ description: > var p = "a,b,c"; -//CHECK#1 try { var f = new Function(p, undefined); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T13.js b/test/built-ins/Function/S15.3.2.1_A3_T13.js index 4eb40decf6..1e53d2381d 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T13.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T13.js @@ -18,19 +18,11 @@ description: Values of the function constructor arguments are "a,b,c" and "null" var p = "a,b,c"; -//CHECK#1 try { var f = new Function(p, null); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T14.js b/test/built-ins/Function/S15.3.2.1_A3_T14.js index 903c5d2b1b..918daf42d0 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T14.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T14.js @@ -20,21 +20,13 @@ description: > var p = "a,b,c"; -//CHECK#1 try { var f = new Function(p, body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); var body; diff --git a/test/built-ins/Function/S15.3.2.1_A3_T15.js b/test/built-ins/Function/S15.3.2.1_A3_T15.js index 457f9b5328..0711dad0fe 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T15.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T15.js @@ -18,19 +18,11 @@ description: > strings ---*/ -//CHECK#1 try { var f = new Function("", ""); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== undefined) { - throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), undefined, 'f() returns undefined'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T2.js b/test/built-ins/Function/S15.3.2.1_A3_T2.js index bfc34cc8d3..0255c4cbb0 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T2.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T2.js @@ -25,19 +25,11 @@ var p = { }; var body = "return a;"; -//CHECK#1 try { var f = new Function(p, body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f(42) !== 42) { - throw new Test262Error('#3: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(42), 42, 'f(42) must return 42'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T3.js b/test/built-ins/Function/S15.3.2.1_A3_T3.js index e13742cd89..ef753a20d8 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T3.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T3.js @@ -31,17 +31,11 @@ var body = { } }; -//CHECK#1 try { var f = new Function(p, body); throw new Test262Error('#1: test failed'); } catch (e) { - if (e !== "body") { - throw new Test262Error('#1.1: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))'); - } + assert.sameValue(e, "body", 'The value of e is expected to be "body"'); } -//CHECK#2 -if (p !== 1) { - throw new Test262Error('#2: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))'); -} +assert.sameValue(p, 1, 'The value of p is expected to be 1'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T4.js b/test/built-ins/Function/S15.3.2.1_A3_T4.js index 25c48428e2..38b17db37a 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T4.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T4.js @@ -20,21 +20,13 @@ description: > var body = "return 1.1;"; -//CHECK#1 try { var f = new Function(p, body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== 1.1) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), 1.1, 'f() must return 1.1'); var p; diff --git a/test/built-ins/Function/S15.3.2.1_A3_T5.js b/test/built-ins/Function/S15.3.2.1_A3_T5.js index c74bf651f8..69df284be6 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T5.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T5.js @@ -20,19 +20,11 @@ description: > var body = "return \"A\";"; -//CHECK#1 try { var f = new Function(void 0, body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== '\u0041') { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), '\u0041', 'f() must return "u0041"'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T6.js b/test/built-ins/Function/S15.3.2.1_A3_T6.js index 10f7c9d80e..6927483a74 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T6.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T6.js @@ -20,12 +20,12 @@ description: > var body = "return true;"; -//CHECK#1 try { var f = new Function(null, body); throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3.2.1_A3_T7.js b/test/built-ins/Function/S15.3.2.1_A3_T7.js index 42b2a10b49..757317d745 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T7.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T7.js @@ -22,19 +22,11 @@ var body = "return a;"; var p = Object("a"); -//CHECK#1 try { var f = new Function(p, body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f(1) !== 1) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(1), 1, 'f(1) must return 1'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T8.js b/test/built-ins/Function/S15.3.2.1_A3_T8.js index ada275e9c3..891cfd6bcd 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T8.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T8.js @@ -20,19 +20,11 @@ description: > var body = "return this;"; -//CHECK#1 try { var f = new Function(undefined, body); } catch (e) { throw new Test262Error('#1: test failed with error ' + e); } -//CHECK#2 -if (f.constructor !== Function) { - throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); -} - -//CHECK#3 -if (f() !== this) { - throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.sameValue(f(), this, 'f() must return this'); diff --git a/test/built-ins/Function/S15.3.2.1_A3_T9.js b/test/built-ins/Function/S15.3.2.1_A3_T9.js index 76dc04d09d..0dd84aa5ff 100644 --- a/test/built-ins/Function/S15.3.2.1_A3_T9.js +++ b/test/built-ins/Function/S15.3.2.1_A3_T9.js @@ -21,12 +21,12 @@ description: > var body = "return this;"; var p = "1,1"; -//CHECK#1 try { var f = new Function(p, body); throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3.2_A1.js b/test/built-ins/Function/S15.3.2_A1.js index 96c23dbe37..34dc3a6636 100644 --- a/test/built-ins/Function/S15.3.2_A1.js +++ b/test/built-ins/Function/S15.3.2_A1.js @@ -13,12 +13,5 @@ description: > var f = new Function; -//CHECK#1 -if (f.constructor !== Function) { - throw new Test262Error('#1: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object'); -} - -//CHECK#2 -if (f === undefined) { - throw new Test262Error('#2: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object'); -} +assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function'); +assert.notSameValue(f, undefined, 'The value of f is expected to not equal ``undefined``'); diff --git a/test/built-ins/Function/S15.3.3_A1.js b/test/built-ins/Function/S15.3.3_A1.js index 026447992b..c91f366eca 100644 --- a/test/built-ins/Function/S15.3.3_A1.js +++ b/test/built-ins/Function/S15.3.3_A1.js @@ -6,7 +6,4 @@ info: The Function constructor has the property "prototype" es5id: 15.3.3_A1 description: Checking existence of the property "prototype" ---*/ - -if (!Function.hasOwnProperty("prototype")) { - throw new Test262Error('#1: The Function constructor has the property "prototype"'); -} +assert(Function.hasOwnProperty("prototype"), 'Function.hasOwnProperty("prototype") must return true'); diff --git a/test/built-ins/Function/S15.3.3_A2_T1.js b/test/built-ins/Function/S15.3.3_A2_T1.js index 71e49fdf65..05efcfa4f4 100644 --- a/test/built-ins/Function/S15.3.3_A2_T1.js +++ b/test/built-ins/Function/S15.3.3_A2_T1.js @@ -8,8 +8,7 @@ info: | es5id: 15.3.3_A2_T1 description: Checking prototype of Function ---*/ - -// CHECK# -if (!(Function.prototype.isPrototypeOf(Function))) { - throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Function constructor is the Function prototype object.'); -} +assert( + Function.prototype.isPrototypeOf(Function), + 'Function.prototype.isPrototypeOf(Function) must return true' +); diff --git a/test/built-ins/Function/S15.3.3_A2_T2.js b/test/built-ins/Function/S15.3.3_A2_T2.js index fbfe79c93e..e828ca97e4 100644 --- a/test/built-ins/Function/S15.3.3_A2_T2.js +++ b/test/built-ins/Function/S15.3.3_A2_T2.js @@ -11,7 +11,4 @@ description: Add new property to Function.prototype and check it Function.prototype.indicator = 1; -//CHECK# -if (Function.indicator != 1) { - throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Function constructor is the Function prototype object.'); -} +assert.sameValue(Function.indicator, 1, 'The value of Function.indicator is expected to be 1'); diff --git a/test/built-ins/Function/S15.3.3_A3.js b/test/built-ins/Function/S15.3.3_A3.js index a5090b2689..70f8c49d75 100644 --- a/test/built-ins/Function/S15.3.3_A3.js +++ b/test/built-ins/Function/S15.3.3_A3.js @@ -6,13 +6,5 @@ info: Function constructor has length property whose value is 1 es5id: 15.3.3_A3 description: Checking Function.length property ---*/ - -//CHECK#1 -if (!Function.hasOwnProperty("length")) { - throw new Test262Error('#1: Function constructor has length property'); -} - -//CHECK#2 -if (Function.length !== 1) { - throw new Test262Error('#2: Function constructor length property value is 1'); -} +assert(Function.hasOwnProperty("length"), 'Function.hasOwnProperty("length") must return true'); +assert.sameValue(Function.length, 1, 'The value of Function.length is expected to be 1'); diff --git a/test/built-ins/Function/S15.3.5_A1_T1.js b/test/built-ins/Function/S15.3.5_A1_T1.js index 2a4e6816f3..5f675348e9 100644 --- a/test/built-ins/Function/S15.3.5_A1_T1.js +++ b/test/built-ins/Function/S15.3.5_A1_T1.js @@ -9,6 +9,8 @@ description: For testing use variable f = new Function var f = new Function; -if (Object.prototype.toString.call(f) !== "[object Function]") { - throw new Test262Error('#1: The value of the [[Class]] property is "Function"'); -} +assert.sameValue( + Object.prototype.toString.call(f), + "[object Function]", + 'Object.prototype.toString.call(new Function) must return "[object Function]"' +); diff --git a/test/built-ins/Function/S15.3.5_A1_T2.js b/test/built-ins/Function/S15.3.5_A1_T2.js index a8e9258f51..eeb7f5a0b9 100644 --- a/test/built-ins/Function/S15.3.5_A1_T2.js +++ b/test/built-ins/Function/S15.3.5_A1_T2.js @@ -9,6 +9,8 @@ description: For testing use variable f = Function() var f = Function(); -if (Object.prototype.toString.call(f) !== "[object Function]") { - throw new Test262Error('#1: The value of the [[Class]] property is "Function"'); -} +assert.sameValue( + Object.prototype.toString.call(f), + "[object Function]", + 'Object.prototype.toString.call(Function()) must return "[object Function]"' +); diff --git a/test/built-ins/Function/S15.3.5_A2_T1.js b/test/built-ins/Function/S15.3.5_A2_T1.js index a0bcbe8fea..232d565dcb 100644 --- a/test/built-ins/Function/S15.3.5_A2_T1.js +++ b/test/built-ins/Function/S15.3.5_A2_T1.js @@ -6,18 +6,11 @@ info: Every function instance has a [[Call]] property es5id: 15.3.5_A2_T1 description: For testing call Function("var x =1; this.y=2;return \"OK\";")() ---*/ +assert.sameValue( + Function("var x =1; this.y=2;return \"OK\";")(), + "OK", + 'Function("var x =1; this.y=2;return "OK";")() must return "OK"' +); -//CHECK#1 -if (Function("var x =1; this.y=2;return \"OK\";")() !== "OK") { - throw new Test262Error('#1: Every function instance has a [[Call]] property'); -} - -//CHECK#2 -if (typeof x !== "undefined") { - throw new Test262Error('#2: Every function instance has a [[Call]] property'); -} - -//CHECK#3 -if (y !== 2) { - throw new Test262Error('#3: Every function instance has a [[Call]] property'); -} +assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"'); +assert.sameValue(y, 2, 'The value of y is expected to be 2'); diff --git a/test/built-ins/Function/S15.3.5_A2_T2.js b/test/built-ins/Function/S15.3.5_A2_T2.js index ac14569b2b..eb65da1967 100644 --- a/test/built-ins/Function/S15.3.5_A2_T2.js +++ b/test/built-ins/Function/S15.3.5_A2_T2.js @@ -8,18 +8,11 @@ description: > For testing call (new Function("arg1,arg2","var x =arg1; this.y=arg2;return arg1+arg2;"))("1",2) ---*/ +assert.sameValue( + (new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;"))("1", 2), + "12", + 'new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;")(1, 2) must return "12"' +); -//CHECK#1 -if ((new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;"))("1", 2) !== "12") { - throw new Test262Error('#1: Every function instance has a [[Call]] property'); -} - -//CHECK#2 -if (typeof x !== "undefined") { - throw new Test262Error('#2: Every function instance has a [[Call]] property'); -} - -//CHECK#3 -if (y !== 2) { - throw new Test262Error('#3: Every function instance has a [[Call]] property'); -} +assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"'); +assert.sameValue(y, 2, 'The value of y is expected to be 2'); diff --git a/test/built-ins/Function/S15.3.5_A3_T1.js b/test/built-ins/Function/S15.3.5_A3_T1.js index d46c30bb01..42eea57f8f 100644 --- a/test/built-ins/Function/S15.3.5_A3_T1.js +++ b/test/built-ins/Function/S15.3.5_A3_T1.js @@ -10,17 +10,6 @@ description: As constructor use Function("var x =1; this.y=2;return \"OK\";") var FACTORY = Function("var x =1; this.y=2;return \"OK\";"); var obj = new FACTORY; -//CHECK#1 -if (typeof obj !== "object") { - throw new Test262Error('#1: every function instance has a [[Construct]] property'); -} - -//CHECK#2 -if (obj.constructor !== FACTORY) { - throw new Test262Error('#2: every function instance has a [[Construct]] property'); -} - -//CHECK#3 -if (obj.y !== 2) { - throw new Test262Error('#3: every function instance has a [[Construct]] property'); -} +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY'); +assert.sameValue(obj.y, 2, 'The value of obj.y is expected to be 2'); diff --git a/test/built-ins/Function/S15.3.5_A3_T2.js b/test/built-ins/Function/S15.3.5_A3_T2.js index 06e3329c03..9477d80a95 100644 --- a/test/built-ins/Function/S15.3.5_A3_T2.js +++ b/test/built-ins/Function/S15.3.5_A3_T2.js @@ -12,17 +12,6 @@ description: > var FACTORY = new Function("arg1,arg2", "var x =1; this.y=arg1+arg2;return \"OK\";"); var obj = new FACTORY("1", 2); -//CHECK#1 -if (typeof obj !== "object") { - throw new Test262Error('#1: every function instance has a [[Construct]] property'); -} - -//CHECK#2 -if (obj.constructor !== FACTORY) { - throw new Test262Error('#2: every function instance has a [[Construct]] property'); -} - -//CHECK#3 -if (obj.y !== "12") { - throw new Test262Error('#3: every function instance has a [[Construct]] property'); -} +assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); +assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY'); +assert.sameValue(obj.y, "12", 'The value of obj.y is expected to be "12"'); diff --git a/test/built-ins/Function/S15.3_A1.js b/test/built-ins/Function/S15.3_A1.js index 21288b5d23..e6992272ce 100644 --- a/test/built-ins/Function/S15.3_A1.js +++ b/test/built-ins/Function/S15.3_A1.js @@ -11,6 +11,4 @@ var obj = Function; var thisobj = this.Function; -if (obj !== thisobj) { - throw new Test262Error('Function 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/Function/S15.3_A2_T1.js b/test/built-ins/Function/S15.3_A2_T1.js index bf25c6a0d7..e494626cbb 100644 --- a/test/built-ins/Function/S15.3_A2_T1.js +++ b/test/built-ins/Function/S15.3_A2_T1.js @@ -10,11 +10,11 @@ es5id: 15.3_A2_T1 description: Checking if executing "Function.call(this, "var x / = 1;")" fails ---*/ -//CHECK# try { Function.call(this, "var x / = 1;"); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1: function body must be valid'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3_A2_T2.js b/test/built-ins/Function/S15.3_A2_T2.js index 3838ba59b8..f7c584a50f 100644 --- a/test/built-ins/Function/S15.3_A2_T2.js +++ b/test/built-ins/Function/S15.3_A2_T2.js @@ -10,11 +10,11 @@ es5id: 15.3_A2_T2 description: Checking if executing "Function.call(this, "var #x = 1;")" fails ---*/ -//CHECK# try { Function.call(this, "var #x = 1;"); } catch (e) { - if (!(e instanceof SyntaxError)) { - throw new Test262Error('#1: function body must be valid'); - } + assert( + e instanceof SyntaxError, + 'The result of evaluating (e instanceof SyntaxError) is expected to be true' + ); } diff --git a/test/built-ins/Function/S15.3_A3_T1.js b/test/built-ins/Function/S15.3_A3_T1.js index 91258d0735..04796a0774 100644 --- a/test/built-ins/Function/S15.3_A3_T1.js +++ b/test/built-ins/Function/S15.3_A3_T1.js @@ -9,7 +9,6 @@ es5id: 15.3_A3_T1 description: First argument is object ---*/ -//CHECK#1 - does not throw var f = Function.call(mars, "return name;"); var mars = { name: "mars", @@ -21,12 +20,8 @@ var f = Function.call(mars, "this.godname=\"ares\"; return this.color;"); var about_mars = f(); -//CHECK#2 -if (about_mars !== undefined) { - throw new Test262Error('#2: When applied to the Function object itself, thisArg should be ignored'); -} +assert.sameValue(about_mars, undefined); -//CHECK#3 if (this.godname !== "ares" && mars.godname === undefined) { throw new Test262Error('#3: When applied to the Function object itself, thisArg should be ignored'); } diff --git a/test/built-ins/Function/S15.3_A3_T2.js b/test/built-ins/Function/S15.3_A3_T2.js index 6fe1f842d8..138900a138 100644 --- a/test/built-ins/Function/S15.3_A3_T2.js +++ b/test/built-ins/Function/S15.3_A3_T2.js @@ -14,14 +14,8 @@ var planet = "mars"; var f = Function.call("blablastring", "return this.color;"); -//CHECK#1 -if (f() !== "red") { - throw new Test262Error('#1: '); -} +assert.sameValue(f(), "red", 'f() must return "red"'); var g = Function.call(null, "return this.planet;"); -//CHECK#2 -if (g() !== "mars") { - throw new Test262Error('#2: '); -} +assert.sameValue(g(), "mars", 'g() must return "mars"'); diff --git a/test/built-ins/Function/S15.3_A3_T3.js b/test/built-ins/Function/S15.3_A3_T3.js index ceead23003..baf758003f 100644 --- a/test/built-ins/Function/S15.3_A3_T3.js +++ b/test/built-ins/Function/S15.3_A3_T3.js @@ -12,30 +12,22 @@ description: First argument is this, and this don`t have needed variable var f = Function.call(this, "return planet;"); var g = Function.call(this, "return color;"); -//CHECK#1 -if (f() !== undefined) { - throw new Test262Error('#1: '); -} +assert.sameValue(f(), undefined, 'f() returns undefined'); var planet = "mars"; -//CHECK#2 -if (f() !== "mars") { - throw new Test262Error('#2: '); -} +assert.sameValue(f(), "mars", 'f() must return "mars"'); -//CHECK#3 try { g(); throw new Test262Error('#3: '); } catch (e) { - if (!(e instanceof ReferenceError)) - throw new Test262Error('#3.1: '); + assert( + e instanceof ReferenceError, + 'The result of evaluating (e instanceof ReferenceError) is expected to be true' + ); } this.color = "red"; -//CHECK#4 -if (g() !== "red") { - throw new Test262Error('#4: '); -} +assert.sameValue(g(), "red", 'g() must return "red"'); diff --git a/test/built-ins/Function/S15.3_A3_T4.js b/test/built-ins/Function/S15.3_A3_T4.js index c9b2ac29dc..7ffeec3a38 100644 --- a/test/built-ins/Function/S15.3_A3_T4.js +++ b/test/built-ins/Function/S15.3_A3_T4.js @@ -11,14 +11,8 @@ description: First argument is this, and this have needed variable var f = Function.call(this, "return planet;"); -//CHECK#1 -if (f() !== undefined) { - throw new Test262Error('#1: '); -} +assert.sameValue(f(), undefined, 'f() returns undefined'); var planet = "mars"; -//CHECK#2 -if (f() !== "mars") { - throw new Test262Error('#2: '); -} +assert.sameValue(f(), "mars", 'f() must return "mars"'); diff --git a/test/built-ins/Function/S15.3_A3_T5.js b/test/built-ins/Function/S15.3_A3_T5.js index a57bc82ce0..9fa672b7af 100644 --- a/test/built-ins/Function/S15.3_A3_T5.js +++ b/test/built-ins/Function/S15.3_A3_T5.js @@ -14,26 +14,13 @@ description: > var f = Function.call(this, "return this.planet;"); var g = Function.call(this, "return this.color;"); -//CHECK#1 -if (f() !== undefined) { - throw new Test262Error('#2: '); -} +assert.sameValue(f(), undefined, 'f() returns undefined'); var planet = "mars"; -//CHECK#2 -if (f() !== "mars") { - throw new Test262Error('#2: '); -} - -//CHECK#3 -if (g() !== undefined) { - throw new Test262Error('#3: '); -} +assert.sameValue(f(), "mars", 'f() must return "mars"'); +assert.sameValue(g(), undefined, 'g() returns undefined'); this.color = "red"; -//CHECK#4 -if (g() !== "red") { - throw new Test262Error('#4: '); -} +assert.sameValue(g(), "red", 'g() must return "red"'); diff --git a/test/built-ins/Function/S15.3_A3_T6.js b/test/built-ins/Function/S15.3_A3_T6.js index e8b83b6684..1633897a98 100644 --- a/test/built-ins/Function/S15.3_A3_T6.js +++ b/test/built-ins/Function/S15.3_A3_T6.js @@ -13,14 +13,8 @@ description: > var f = Function.call(this, "return this.planet;"); -//CHECK#1 -if (f() !== undefined) { - throw new Test262Error('#1: '); -} +assert.sameValue(f(), undefined, 'f() returns undefined'); var planet = "mars"; -//CHECK#2 -if (f() !== "mars") { - throw new Test262Error('#2: '); -} +assert.sameValue(f(), "mars", 'f() must return "mars"'); diff --git a/test/built-ins/Function/StrictFunction_reservedwords_with.js b/test/built-ins/Function/StrictFunction_reservedwords_with.js index 0bf37a7cdc..162e2e2d88 100644 --- a/test/built-ins/Function/StrictFunction_reservedwords_with.js +++ b/test/built-ins/Function/StrictFunction_reservedwords_with.js @@ -17,5 +17,5 @@ info: | ---*/ assert.throws(SyntaxError, function() { - new Function("'use strict'; with ({}) {}"); -}); + new Function("'use strict'; with ({}) {}"); +}, '`new Function("\'use strict\'; with ({}) {}")` throws a SyntaxError exception'); diff --git a/test/built-ins/Function/StrictFunction_restricted-properties.js b/test/built-ins/Function/StrictFunction_restricted-properties.js index cd7e1d3c60..eb9309661b 100644 --- a/test/built-ins/Function/StrictFunction_restricted-properties.js +++ b/test/built-ins/Function/StrictFunction_restricted-properties.js @@ -15,37 +15,37 @@ function func() {} assert.throws(TypeError, function() { return func.caller; -}); +}, 'return func.caller throws a TypeError exception'); assert.throws(TypeError, function() { func.caller = {}; -}); +}, 'func.caller = {} throws a TypeError exception'); assert.throws(TypeError, function() { return func.arguments; -}); +}, 'return func.arguments throws a TypeError exception'); assert.throws(TypeError, function() { func.arguments = {}; -}); +}, 'func.arguments = {} throws a TypeError exception'); var newfunc = new Function('"use strict"'); -assert.sameValue(newfunc.hasOwnProperty('caller'), false, 'strict Functions created using Function constructor do not have own property "caller"'); -assert.sameValue(newfunc.hasOwnProperty('arguments'), false, 'strict Functions created using Function constructor do not have own property "arguments"'); +assert.sameValue(newfunc.hasOwnProperty('caller'), false, 'newfunc.hasOwnProperty(\'caller\') must return false'); +assert.sameValue(newfunc.hasOwnProperty('arguments'), false, 'newfunc.hasOwnProperty(\'arguments\') must return false'); assert.throws(TypeError, function() { return newfunc.caller; -}); +}, 'return newfunc.caller throws a TypeError exception'); assert.throws(TypeError, function() { newfunc.caller = {}; -}); +}, 'newfunc.caller = {} throws a TypeError exception'); assert.throws(TypeError, function() { return newfunc.arguments; -}); +}, 'return newfunc.arguments throws a TypeError exception'); assert.throws(TypeError, function() { newfunc.arguments = {}; -}); +}, 'newfunc.arguments = {} throws a TypeError exception'); diff --git a/test/built-ins/Function/length/S15.3.5.1_A1_T1.js b/test/built-ins/Function/length/S15.3.5.1_A1_T1.js index 36ff26f106..a1d00447dc 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A1_T1.js +++ b/test/built-ins/Function/length/S15.3.5.1_A1_T1.js @@ -11,12 +11,5 @@ description: Checking length property of Function("arg1,arg2,arg3", null) var f = new Function("arg1,arg2,arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} - -//CHECK#2 -if (f.length !== 3) { - throw new Test262Error('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert.sameValue(f.length, 3, 'The value of f.length is expected to be 3'); diff --git a/test/built-ins/Function/length/S15.3.5.1_A1_T2.js b/test/built-ins/Function/length/S15.3.5.1_A1_T2.js index bd3719b756..2423b595fd 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A1_T2.js +++ b/test/built-ins/Function/length/S15.3.5.1_A1_T2.js @@ -13,12 +13,5 @@ description: > var f = Function("arg1,arg2,arg3", "arg4,arg5", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} - -//CHECK#2 -if (f.length !== 5) { - throw new Test262Error('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert.sameValue(f.length, 5, 'The value of f.length is expected to be 5'); diff --git a/test/built-ins/Function/length/S15.3.5.1_A1_T3.js b/test/built-ins/Function/length/S15.3.5.1_A1_T3.js index 6c67814330..6cd2805f35 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A1_T3.js +++ b/test/built-ins/Function/length/S15.3.5.1_A1_T3.js @@ -13,12 +13,5 @@ description: > var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} - -//CHECK#2 -if (f.length !== 6) { - throw new Test262Error('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert.sameValue(f.length, 6, 'The value of f.length is expected to be 6'); diff --git a/test/built-ins/Function/length/S15.3.5.1_A2_T1.js b/test/built-ins/Function/length/S15.3.5.1_A2_T1.js index 08ea41a6da..20887b2e94 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A2_T1.js +++ b/test/built-ins/Function/length/S15.3.5.1_A2_T1.js @@ -11,22 +11,9 @@ description: > var f = new Function("arg1,arg2,arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert(delete f.length, 'The value of delete f.length is expected to be true'); +assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true'); +assert.notSameValue(f.length, 3, 'The value of f.length is not 3'); -//CHECK#2 -if (!delete f.length) { - throw new Test262Error('#2: the function.length property does not have the attributes DontDelete.'); -} - -//CHECK#3 -if (f.hasOwnProperty('length')) { - throw new Test262Error('#3: the function.length property does not have the attributes DontDelete.'); -} - -//CHECK#4 -if (f.length === 3) { - throw new Test262Error('#4: the length property does not have the attributes { DontDelete }'); -} +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A2_T2.js b/test/built-ins/Function/length/S15.3.5.1_A2_T2.js index 24d902eba2..442ccf93db 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A2_T2.js +++ b/test/built-ins/Function/length/S15.3.5.1_A2_T2.js @@ -11,19 +11,11 @@ description: > var f = Function("arg1,arg2,arg3", "arg4,arg5", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); delete f.length; -//CHECK#2 -if (f.hasOwnProperty('length')) { - throw new Test262Error('#2: the function.length property does not have the attributes DontDelete.'); -} +assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true'); +assert.notSameValue(f.length, 5, 'The value of f.length is not 5'); -//CHECK#3 -if (f.length === 5) { - throw new Test262Error('#3: the length property does not have the attributes { DontDelete }'); -} +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A2_T3.js b/test/built-ins/Function/length/S15.3.5.1_A2_T3.js index 4c00cbc275..bbc4e31af8 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A2_T3.js +++ b/test/built-ins/Function/length/S15.3.5.1_A2_T3.js @@ -11,19 +11,11 @@ description: > var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); delete f.length; -//CHECK#2 -if (f.hasOwnProperty('length')) { - throw new Test262Error('#2: the function.length property does not have the attributes DontDelete.'); -} +assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true'); +assert.notSameValue(f.length, 6, 'The value of f.length is not 6'); -//CHECK#3 -if (f.length === 6) { - throw new Test262Error('#3: the length property does not have the attributes { DontDelete }'); -} +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A3_T1.js b/test/built-ins/Function/length/S15.3.5.1_A3_T1.js index 9d9e29dd71..5eaa228c95 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A3_T1.js +++ b/test/built-ins/Function/length/S15.3.5.1_A3_T1.js @@ -12,29 +12,25 @@ includes: [propertyHelper.js] var f = new Function("arg1,arg2,arg3", "arg4,arg5", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length')); var flength = f.length; verifyNotWritable(f, "length", null, function() {}); -//CHECK#2 -if (f.length !== flength) { - throw new Test262Error('#2: the function.length property has the attributes ReadOnly'); -} +assert.sameValue(f.length, flength); -//CHECK#3 try { f.length(); throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } } -//CHECK#4 if (f.length !== 5) { throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A3_T2.js b/test/built-ins/Function/length/S15.3.5.1_A3_T2.js index 24ce1a5080..c298266649 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A3_T2.js +++ b/test/built-ins/Function/length/S15.3.5.1_A3_T2.js @@ -12,29 +12,25 @@ includes: [propertyHelper.js] var f = Function("arg1,arg2,arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length')); var flength = f.length; verifyNotWritable(f, "length", null, function() {}); -//CHECK#2 -if (f.length !== flength) { - throw new Test262Error('#2: the function.length property has the attributes ReadOnly'); -} +assert.sameValue(f.length, flength); -//CHECK#3 try { f.length(); throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } } -//CHECK#4 if (f.length !== 3) { throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A3_T3.js b/test/built-ins/Function/length/S15.3.5.1_A3_T3.js index 915a408a5d..022647dc2b 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A3_T3.js +++ b/test/built-ins/Function/length/S15.3.5.1_A3_T3.js @@ -12,29 +12,25 @@ includes: [propertyHelper.js] var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length')); var flength = f.length; verifyNotWritable(f, "length", null, function() {}); -//CHECK#2 -if (f.length !== flength) { - throw new Test262Error('#2: the function.length property has the attributes ReadOnly'); -} +assert.sameValue(f.length, flength); -//CHECK#3 try { f.length(); throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } } -//CHECK#4 if (f.length !== 6) { throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A4_T1.js b/test/built-ins/Function/length/S15.3.5.1_A4_T1.js index 6af6f45591..82eae8d5fc 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A4_T1.js +++ b/test/built-ins/Function/length/S15.3.5.1_A4_T1.js @@ -11,17 +11,13 @@ description: > var f = new Function("arg1,arg2,arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); for (var key in f) { if (key == "length") { var lengthenumed = true; } } -//CHECK#2 -if (lengthenumed) { - throw new Test262Error('#2: the length property has the attributes { DontEnum }'); -} +assert(!lengthenumed, 'The value of !lengthenumed is expected to be true'); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A4_T2.js b/test/built-ins/Function/length/S15.3.5.1_A4_T2.js index b44b79c8e7..a01c36c605 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A4_T2.js +++ b/test/built-ins/Function/length/S15.3.5.1_A4_T2.js @@ -11,10 +11,7 @@ description: > var f = Function("arg1,arg2,arg3", "arg5,arg4", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); for (var key in f) { if (key == "length") { @@ -22,7 +19,6 @@ for (var key in f) { } } -//CHECK#2 -if (lengthenumed) { - throw new Test262Error('#2: the length property has the attributes { DontEnum }'); -} +assert(!lengthenumed, 'The value of !lengthenumed is expected to be true'); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/length/S15.3.5.1_A4_T3.js b/test/built-ins/Function/length/S15.3.5.1_A4_T3.js index 13a8cbaa58..15684923f1 100644 --- a/test/built-ins/Function/length/S15.3.5.1_A4_T3.js +++ b/test/built-ins/Function/length/S15.3.5.1_A4_T3.js @@ -11,10 +11,7 @@ description: > var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); -//CHECK#1 -if (!(f.hasOwnProperty('length'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); for (var key in f) { if (key == "length") { @@ -22,7 +19,6 @@ for (var key in f) { } } -//CHECK#2 -if (lengthenumed) { - throw new Test262Error('#2: the length property has the attributes { DontEnum }'); -} +assert(!lengthenumed, 'The value of !lengthenumed is expected to be true'); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/S15.3.3.1_A1.js b/test/built-ins/Function/prototype/S15.3.3.1_A1.js index 65a7a57e6d..0ef6a69e54 100644 --- a/test/built-ins/Function/prototype/S15.3.3.1_A1.js +++ b/test/built-ins/Function/prototype/S15.3.3.1_A1.js @@ -14,16 +14,12 @@ verifyNotWritable(Function, "prototype", null, function() { return "shifted"; }); -//CHECK#1 -if (Function.prototype !== obj) { - throw new Test262Error('#1: the Function.prototype property has the attributes ReadOnly.'); -} +assert.sameValue(Function.prototype, obj, 'The value of Function.prototype is expected to equal the value of obj'); -//CHECK#2 try { - if (Function.prototype() !== undefined) { - throw new Test262Error('#2: the Function.prototype property has the attributes ReadOnly'); - } + assert.sameValue(Function.prototype(), undefined, 'Function.prototype() returns undefined'); } catch (e) { throw new Test262Error('#2.1: the Function.prototype property has the attributes ReadOnly: ' + e); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/S15.3.3.1_A2.js b/test/built-ins/Function/prototype/S15.3.3.1_A2.js index 793868899a..238607f141 100644 --- a/test/built-ins/Function/prototype/S15.3.3.1_A2.js +++ b/test/built-ins/Function/prototype/S15.3.3.1_A2.js @@ -6,19 +6,20 @@ info: The Function.prototype property has the attribute DontEnum es5id: 15.3.3.1_A2 description: Checking if enumerating the Function.prototype property fails ---*/ - -// CHECK#1 -if (Function.propertyIsEnumerable('prototype')) { - throw new Test262Error('#1: the Function.prototype property has the attributes DontEnum'); -} +assert( + !Function.propertyIsEnumerable('prototype'), + 'The value of !Function.propertyIsEnumerable(\'prototype\') is expected to be true' +); // CHECK#2 var count = 0; for (var p in Function) { - if (p === "prototype") count++; + if (p === "prototype") { + count++; + } } -if (count !== 0) { - throw new Test262Error('#2: the Function.prototype property has the attributes DontEnum'); -} +assert.sameValue(count, 0, 'The value of count is expected to be 0'); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/S15.3.3.1_A3.js b/test/built-ins/Function/prototype/S15.3.3.1_A3.js index ff1fdef8dd..ecd38bdf7c 100644 --- a/test/built-ins/Function/prototype/S15.3.3.1_A3.js +++ b/test/built-ins/Function/prototype/S15.3.3.1_A3.js @@ -10,17 +10,17 @@ includes: [propertyHelper.js] verifyNotConfigurable(Function, "prototype"); -//CHECK#1 try { - if ((delete Function.prototype) !== false) { - throw new Test262Error('#1: Function.prototype has the attribute DontDelete'); - } + assert.sameValue(delete Function.prototype, false); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } assert(e instanceof TypeError); } -//CHECK#2 if (!(Function.hasOwnProperty('prototype'))) { throw new Test262Error('#2: the Function.prototype property has the attributes DontDelete.'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/S15.3.3.1_A4.js b/test/built-ins/Function/prototype/S15.3.3.1_A4.js index 49483e5728..c9f599a357 100644 --- a/test/built-ins/Function/prototype/S15.3.3.1_A4.js +++ b/test/built-ins/Function/prototype/S15.3.3.1_A4.js @@ -18,7 +18,9 @@ function foo() {} Object.defineProperty(foo, 'prototype', { value: {} }); -if (foo.prototype !== - Object.getOwnPropertyDescriptor(foo, 'prototype').value) { - throw new Test262Error("A function.prototype's descriptor lies"); -} + +assert.sameValue( + foo.prototype, + Object.getOwnPropertyDescriptor(foo, 'prototype').value, + 'The value of foo.prototype is expected to equal the value of Object.getOwnPropertyDescriptor(foo, \'prototype\').value' +); diff --git a/test/built-ins/Function/prototype/S15.3.4_A1.js b/test/built-ins/Function/prototype/S15.3.4_A1.js index 914ea6ed2d..46f816518e 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A1.js +++ b/test/built-ins/Function/prototype/S15.3.4_A1.js @@ -8,8 +8,8 @@ info: | es5id: 15.3.4_A1 description: Object.prototype.toString returns [object+[[Class]]+] ---*/ - -if (Object.prototype.toString.call(Function.prototype) !== "[object Function]") { - throw new Test262Error('#2: The Function prototype object is itself a Function ' + - 'object (its [[Class]] is "Function") (15.3.4)'); -} +assert.sameValue( + Object.prototype.toString.call(Function.prototype), + "[object Function]", + 'Object.prototype.toString.call(Function.prototype) must return "[object Function]"' +); diff --git a/test/built-ins/Function/prototype/S15.3.4_A2_T1.js b/test/built-ins/Function/prototype/S15.3.4_A2_T1.js index fb3f325d3d..df34727e9a 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A2_T1.js +++ b/test/built-ins/Function/prototype/S15.3.4_A2_T1.js @@ -9,11 +9,8 @@ es5id: 15.3.4_A2_T1 description: Call Function.prototype() ---*/ -//CHECK#1 try { - if (Function.prototype() !== undefined) { - throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined'); - } + assert.sameValue(Function.prototype(), undefined, 'Function.prototype() returns undefined'); } catch (e) { throw new Test262Error('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: ' + e); } diff --git a/test/built-ins/Function/prototype/S15.3.4_A2_T2.js b/test/built-ins/Function/prototype/S15.3.4_A2_T2.js index 2f8aa12c90..4210933f80 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A2_T2.js +++ b/test/built-ins/Function/prototype/S15.3.4_A2_T2.js @@ -9,11 +9,8 @@ es5id: 15.3.4_A2_T2 description: Call Function.prototype(null,void 0) ---*/ -//CHECK#1 try { - if (Function.prototype(null, void 0) !== undefined) { - throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined'); - } + assert.sameValue(Function.prototype(null, void 0), undefined, 'Function.prototype(null, void 0) returns undefined'); } catch (e) { throw new Test262Error('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: ' + e); } diff --git a/test/built-ins/Function/prototype/S15.3.4_A2_T3.js b/test/built-ins/Function/prototype/S15.3.4_A2_T3.js index 3967461bd8..5cec84f644 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A2_T3.js +++ b/test/built-ins/Function/prototype/S15.3.4_A2_T3.js @@ -9,12 +9,5 @@ es5id: 15.3.4_A2_T3 description: Call Function.prototype(x), where x is undefined variable ---*/ -//CHECK#1 -try { - if (Function.prototype(x) !== undefined) { - var x; - throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined'); - } -} catch (e) { - throw new Test262Error('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: ' + e); -} +var x; +assert.sameValue(Function.prototype(x), undefined, 'Function.prototype(x) returns undefined'); diff --git a/test/built-ins/Function/prototype/S15.3.4_A3_T1.js b/test/built-ins/Function/prototype/S15.3.4_A3_T1.js index 0beb02989a..db27a64917 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A3_T1.js +++ b/test/built-ins/Function/prototype/S15.3.4_A3_T1.js @@ -8,9 +8,8 @@ info: | es5id: 15.3.4_A3_T1 description: Checking prototype of Function.prototype ---*/ - -if (Object.getPrototypeOf(Function.prototype) !== Object.prototype) { - throw new Test262Error('#1: The value of the internal [[Prototype]] property of ' + - 'the Function prototype object is the Object prototype ' + - 'object (15.3.4)'); -} +assert.sameValue( + Object.getPrototypeOf(Function.prototype), + Object.prototype, + 'Object.getPrototypeOf(Function.prototype) returns Object.prototype' +); diff --git a/test/built-ins/Function/prototype/S15.3.4_A3_T2.js b/test/built-ins/Function/prototype/S15.3.4_A3_T2.js index 10517a39c3..888ae05b07 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A3_T2.js +++ b/test/built-ins/Function/prototype/S15.3.4_A3_T2.js @@ -13,7 +13,4 @@ description: > Object.prototype.indicator = 1; -//CHECK#1 -if (Function.prototype.indicator !== 1) { - throw new Test262Error('#1: The value of the internal [[Prototype]] property of the Function prototype object is the Object prototype object (15.3.2.1)'); -} +assert.sameValue(Function.prototype.indicator, 1, 'The value of Function.prototype.indicator is expected to be 1'); diff --git a/test/built-ins/Function/prototype/S15.3.4_A4.js b/test/built-ins/Function/prototype/S15.3.4_A4.js index e9ca1d5ae9..620ed2b46c 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A4.js +++ b/test/built-ins/Function/prototype/S15.3.4_A4.js @@ -9,18 +9,20 @@ info: | es5id: 15.3.4_A4 description: Checking valueOf property at Function.prototype ---*/ +assert.sameValue( + Function.prototype.hasOwnProperty("valueOf"), + false, + 'Function.prototype.hasOwnProperty("valueOf") must return false' +); -//CHECK#1 -if (Function.prototype.hasOwnProperty("valueOf") !== false) { - throw new Test262Error('#1: The Function prototype object does not have a valueOf property of its own'); -} +assert.notSameValue( + typeof Function.prototype.valueOf, + "undefined", + 'The value of typeof Function.prototype.valueOf is not "undefined"' +); -//CHECK#2 -if (typeof Function.prototype.valueOf === "undefined") { - throw new Test262Error('#2: however, it inherits the valueOf property from the Object prototype Object'); -} - -//CHECK#3 -if (Function.prototype.valueOf !== Object.prototype.valueOf) { - throw new Test262Error('#3: however, it inherits the valueOf property from the Object prototype Object'); -} +assert.sameValue( + Function.prototype.valueOf, + Object.prototype.valueOf, + 'The value of Function.prototype.valueOf is expected to equal the value of Object.prototype.valueOf' +); diff --git a/test/built-ins/Function/prototype/S15.3.4_A5.js b/test/built-ins/Function/prototype/S15.3.4_A5.js index 5ddee5d9cf..e5c868ffd0 100644 --- a/test/built-ins/Function/prototype/S15.3.4_A5.js +++ b/test/built-ins/Function/prototype/S15.3.4_A5.js @@ -11,4 +11,4 @@ description: Checking if creating "new Function.prototype object" fails assert.throws(TypeError, function() { new Function.prototype; -}); +}, '`new Function.prototype` throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/S15.3.5.2_A1_T1.js b/test/built-ins/Function/prototype/S15.3.5.2_A1_T1.js index 57bb8a2fae..d39c1d98a1 100644 --- a/test/built-ins/Function/prototype/S15.3.5.2_A1_T1.js +++ b/test/built-ins/Function/prototype/S15.3.5.2_A1_T1.js @@ -12,26 +12,23 @@ includes: [propertyHelper.js] var f = new Function("", null); -//CHECK#1 -if (!(f.hasOwnProperty('prototype'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('prototype')); var fproto = f.prototype; verifyNotConfigurable(f, "prototype"); -//CHECK#2 try { - if ((delete f.prototype) !== false) { - throw new Test262Error('#2: the prototype property has the attributes { DontDelete }'); - } + assert.sameValue(delete f.prototype, false); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } assert(e instanceof TypeError); } -//CHECK#3 if (f.prototype !== fproto) { throw new Test262Error('#3: the prototype property has the attributes { DontDelete }'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/S15.3.5.2_A1_T2.js b/test/built-ins/Function/prototype/S15.3.5.2_A1_T2.js index 02f644d055..4d7262af02 100644 --- a/test/built-ins/Function/prototype/S15.3.5.2_A1_T2.js +++ b/test/built-ins/Function/prototype/S15.3.5.2_A1_T2.js @@ -12,26 +12,23 @@ includes: [propertyHelper.js] var f = Function(void 0, ""); -//CHECK#1 -if (!(f.hasOwnProperty('prototype'))) { - throw new Test262Error('#1: the function has length property.'); -} +assert(f.hasOwnProperty('prototype')); var fproto = f.prototype; verifyNotConfigurable(f, "prototype"); -//CHECK#2 try { - if ((delete f.prototype) !== false) { - throw new Test262Error('#2: the prototype property has the attributes { DontDelete }'); - } + assert.sameValue(delete f.prototype, false); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) { + throw e; + } assert(e instanceof TypeError); } -//CHECK#3 if (f.prototype !== fproto) { throw new Test262Error('#3: the prototype property has the attributes { DontDelete }'); } + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A12.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A12.js index 9ab5667089..13c21f3ed0 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A12.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A12.js @@ -8,8 +8,8 @@ description: > Checking if obtaining the prototype property of Function.prototype.apply fails ---*/ - -//CHECK#1 -if (Function.prototype.apply.prototype !== undefined) { - throw new Test262Error('#1: Function.prototype.apply has not prototype property' + Function.prototype.apply.prototype); -} +assert.sameValue( + Function.prototype.apply.prototype, + undefined, + 'The value of Function.prototype.apply.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T1.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T1.js index a724f3d314..83df197d7a 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T1.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T1.js @@ -14,23 +14,17 @@ description: > var proto = Function(); -function FACTORY() {}; +function FACTORY() {} FACTORY.prototype = proto; var obj = new FACTORY; -//CHECK#1 -if (typeof obj.apply !== "function") { - throw new Test262Error('#1: apply method accessed'); -} +assert.sameValue(typeof obj.apply, "function", 'The value of `typeof obj.apply` is expected to be "function"'); -//CHECK#2 try { obj.apply(); throw new Test262Error('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T2.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T2.js index 838796c9f5..6eb6d99b1e 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T2.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A1_T2.js @@ -12,23 +12,17 @@ description: > property. Prototype of the object is Function.prototype ---*/ -function FACTORY() {}; +function FACTORY() {} FACTORY.prototype = Function.prototype; var obj = new FACTORY; -//CHECK#1 -if (typeof obj.apply !== "function") { - throw new Test262Error('#1: apply method accessed'); -} +assert.sameValue(typeof obj.apply, "function", 'The value of `typeof obj.apply` is expected to be "function"'); -//CHECK#2 try { obj.apply(); throw new Test262Error('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T1.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T1.js index f06ac4fc61..0f1e3d6d8e 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T1.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T1.js @@ -11,7 +11,4 @@ description: Not any arguments at apply function Function("this.field=\"strawberry\"").apply(); -//CHECK#1 -if (this["field"] !== "strawberry") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "strawberry", 'The value of this["field"] is expected to be "strawberry"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T10.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T10.js index 7049eaf43a..a3a8feeafd 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T10.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T10.js @@ -12,7 +12,4 @@ flags: [noStrict] eval(" (function(){this.feat=1}).apply()"); -//CHECK#1 -if (this["feat"] !== 1) { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 1'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T2.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T2.js index ed5ee43c60..d9b82591d3 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T2.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T2.js @@ -11,7 +11,4 @@ description: Argument at apply function is null Function("this.field=\"green\"").apply(null); -//CHECK#1 -if (this["field"] !== "green") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "green", 'The value of this["field"] is expected to be "green"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T3.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T3.js index e0dd2debe7..f3b31928ce 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T3.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T3.js @@ -11,7 +11,4 @@ description: Argument at apply function is void 0 Function("this.field=\"battle\"").apply(void 0); -//CHECK#1 -if (this["field"] !== "battle") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "battle", 'The value of this["field"] is expected to be "battle"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T4.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T4.js index c9a9337eed..bc0fedd318 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T4.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T4.js @@ -11,7 +11,4 @@ description: Argument at apply function is undefined Function("this.field=\"oil\"").apply(undefined); -//CHECK#1 -if (this["field"] !== "oil") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "oil", 'The value of this["field"] is expected to be "oil"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T5.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T5.js index 7bafaac3c2..9d05079136 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T5.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T5.js @@ -13,16 +13,9 @@ description: > function FACTORY() { Function("this.feat=\"in da haus\"").apply(); -}; +} var obj = new FACTORY; -//CHECK#1 -if (this["feat"] !== "in da haus") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} - -//CHECK#2 -if (typeof obj.feat !== "undefined") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"'); +assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T6.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T6.js index 28b95566a7..ea37a004e1 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T6.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T6.js @@ -16,16 +16,9 @@ function FACTORY() { (function() { this.feat = "kamon beyba" }).apply(null); -}; +} var obj = new FACTORY; -//CHECK#1 -if (this["feat"] !== "kamon beyba") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} - -//CHECK#2 -if (typeof obj.feat !== "undefined") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"'); +assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T7.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T7.js index a3a45a1ea9..103b575a05 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T7.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T7.js @@ -16,7 +16,4 @@ description: > })(); -//CHECK#1 -if (this["feat"] !== "in da haus") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T8.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T8.js index 3d98e89938..04230ef8d8 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T8.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T8.js @@ -18,7 +18,4 @@ flags: [noStrict] }).apply(undefined); })(); -//CHECK#1 -if (this["feat"] !== "kamon beyba") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T9.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T9.js index bd928c96a8..a1cf629c36 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T9.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A3_T9.js @@ -11,7 +11,4 @@ description: Checking by using eval, argument at apply function is void 0 eval(" Function(\"this.feat=1\").apply(void 0) "); -//CHECK#1 -if (this["feat"] !== 1) { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 1'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T1.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T1.js index 518dd0f583..f65e78eb57 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T1.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T1.js @@ -13,12 +13,5 @@ var obj = 1; var retobj = Function("this.touched= true; return this;").apply(obj); -//CHECK#1 -if (typeof obj.touched !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T2.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T2.js index 84d1775874..3db0c692e9 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T2.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T2.js @@ -13,12 +13,5 @@ var obj = true; var retobj = new Function("this.touched= true; return this;").apply(obj); -//CHECK#1 -if (typeof obj.touched !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T3.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T3.js index 2e7bbcd0a2..554dd6e951 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T3.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T3.js @@ -17,12 +17,5 @@ var retobj = (function() { return this; }).apply(obj); -//CHECK#1 -if (typeof obj.touched !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T4.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T4.js index 2384053b50..c452df4f37 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T4.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T4.js @@ -17,14 +17,7 @@ f = function() { retobj = f.apply(obj); -//CHECK#1 -if (typeof obj !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj, "undefined", 'The value of `typeof obj` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); var obj; diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T5.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T5.js index 0ce4d64b7a..807e66fd08 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T5.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T5.js @@ -17,7 +17,4 @@ var obj = {}; f.apply(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T6.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T6.js index ae8bad296f..48acd137dc 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T6.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T6.js @@ -15,7 +15,4 @@ var obj = new String("soap"); this.touched = true; }).apply(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T7.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T7.js index 8abe9a41ac..b48fe6fe78 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T7.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T7.js @@ -13,7 +13,4 @@ var obj = new Number(1); Function("this.touched= true;").apply(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T8.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T8.js index 75b3f0bb88..24008f2bba 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T8.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A5_T8.js @@ -13,7 +13,4 @@ var obj = Function(); new Function("this.touched= true; return this;").apply(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T1.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T1.js index d8756b51f6..94f81375ea 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T1.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T1.js @@ -11,7 +11,4 @@ description: argArray is (null,[1]) Function("a1,a2,a3", "this.shifted=a1;").apply(null, [1]); -//CHECK#1 -if (this["shifted"] !== 1) { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(this["shifted"], 1, 'The value of this["shifted"] is expected to be 1'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T10.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T10.js index b2563b3dd2..7b45e1c07e 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T10.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T10.js @@ -17,12 +17,10 @@ var obj = {}; Function("a1,a2,a3", "this.shifted=a1+a2+a3;").apply(obj, arguments); })("", 4, 2); -//CHECK#1 -if (obj["shifted"] !== "42") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(obj["shifted"], "42", 'The value of obj["shifted"] is expected to be "42"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T2.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T2.js index 34acb7e704..3eb9f11ca8 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T2.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T2.js @@ -11,7 +11,4 @@ description: argArray is (null,[1,2,3]) new Function("a1,a2", "a3", "this.shifted=a2;").apply(null, [1, 2, 3]); -//CHECK#1 -if (this["shifted"] !== 2) { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(this["shifted"], 2, 'The value of this["shifted"] is expected to be 2'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T3.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T3.js index 79c40ee00a..1d47bf49f2 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T3.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T3.js @@ -21,12 +21,10 @@ var obj = {}; Function(p, "a2,a3", "this.shifted=a1;").apply(obj, new Array("nine", "inch", "nails")); -//CHECK#1 -if (obj["shifted"] !== "nine") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(obj["shifted"], "nine", 'The value of obj["shifted"] is expected to be "nine"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T4.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T4.js index ec41b8fa33..345cd255e1 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T4.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T4.js @@ -25,12 +25,10 @@ new Function(p, p, p, "this.shifted=a3;").apply(obj, (function() { return arguments; })("a", "b", "c")); -//CHECK#1 -if (obj["shifted"] !== "c") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(obj["shifted"], "c", 'The value of obj["shifted"] is expected to be "c"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T5.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T5.js index bd0014429c..81966c3bb7 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T5.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T5.js @@ -15,12 +15,5 @@ function FACTORY() { var obj = new FACTORY("", 1, 2); -//CHECK#1 -if (this["shifted"] !== "12") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} - -//CHECK#2 -if (typeof obj.shifted !== "undefined") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(this["shifted"], "12", 'The value of this["shifted"] is expected to be "12"'); +assert.sameValue(typeof obj.shifted, "undefined", 'The value of `typeof obj.shifted` is expected to be "undefined"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T6.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T6.js index 2eedad51af..bcd880d352 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T6.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T6.js @@ -15,12 +15,10 @@ function FACTORY() { var obj = new FACTORY("", 4, 2); -//CHECK#1 -if (obj["shifted"] !== "42") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(obj["shifted"], "42", 'The value of obj["shifted"] is expected to be "42"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T7.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T7.js index 0ee6957971..f58e635614 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T7.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T7.js @@ -15,7 +15,4 @@ description: > Function("a1,a2,a3", "this.shifted=a1+a2+a3;").apply(null, arguments); })("", 1, 2); -//CHECK#1 -if (this["shifted"] !== "12") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(this["shifted"], "12", 'The value of this["shifted"] is expected to be "12"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T8.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T8.js index 738eaa1fc0..bdbe8c6adc 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T8.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T8.js @@ -15,7 +15,4 @@ description: > Function("a1,a2,a3", "this.shifted=a1+a2+a3;").apply(this, arguments); })("", 4, 2); -//CHECK#2 -if (this["shifted"] !== "42") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(this["shifted"], "42", 'The value of this["shifted"] is expected to be "42"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T9.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T9.js index 0dd3033f2b..c40047cd77 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T9.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A7_T9.js @@ -19,12 +19,10 @@ function FACTORY() { var obj = new FACTORY("", 1, 2); -//CHECK#1 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); -//CHECK#2 -if (obj.shifted !== "12") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(obj.shifted, "12", 'The value of obj.shifted is expected to be "12"'); diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js index f41e59968a..dbce6ab382 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js @@ -11,7 +11,5 @@ try { var obj = new Function.prototype.apply; throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.apply can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js index 700a89b077..3ece142981 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js @@ -11,7 +11,5 @@ try { var obj = new Function.prototype.apply(); throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.apply can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T3.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T3.js index 79f5dc0047..dcb0fdd104 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T3.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T3.js @@ -11,7 +11,5 @@ try { var obj = new Function.apply; throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.apply can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T4.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T4.js index 4b3a6b70d8..5a902ad325 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T4.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T4.js @@ -11,7 +11,5 @@ try { var obj = new(Function("this.p1=1").apply); throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.apply can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T5.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T5.js index b96632cd7b..7ed13b4932 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T5.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T5.js @@ -12,7 +12,5 @@ try { var obj = new FACTORY(); throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.apply can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T6.js b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T6.js index aa10206203..c96443bd3f 100644 --- a/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T6.js +++ b/test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T6.js @@ -9,14 +9,10 @@ description: > f(){this.p1=1;};return f").apply())" fails ---*/ -//CHECK#1 try { var obj = new(Function("function f(){this.p1=1;};return f").apply()); } catch (e) { throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller'); } -//CHECK#2 -if (obj.p1 !== 1) { - throw new Test262Error('#2: Function.prototype.apply can\'t be used as [[Construct]] caller'); -} +assert.sameValue(obj.p1, 1, 'The value of obj.p1 is expected to be 1'); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A1.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A1.js index cae9bb2ae4..a0973e52b2 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A1.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A1.js @@ -18,4 +18,4 @@ function baz() { assert.throws(TypeError, function() { baz(); -}); +}, 'baz() throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A13.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A13.js index abb2970358..544b743a77 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A13.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A13.js @@ -8,4 +8,4 @@ description: If IsCallable(func) is false, then throw a TypeError exception. assert.throws(TypeError, function() { Function.prototype.bind.call(undefined, {}); -}); +}, 'Function.prototype.bind.call(undefined, {}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A14.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A14.js index f72ee04c52..021c01e13a 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A14.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A14.js @@ -8,4 +8,4 @@ description: If IsCallable(func) is false, then throw a TypeError exception. assert.throws(TypeError, function() { Function.prototype.bind.call(null, {}); -}); +}, 'Function.prototype.bind.call(null, {}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A15.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A15.js index 45f816e339..10858c2d64 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A15.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A15.js @@ -8,4 +8,4 @@ description: If IsCallable(func) is false, then throw a TypeError exception. assert.throws(TypeError, function() { Function.prototype.bind.call({}, {}); -}); +}, 'Function.prototype.bind.call({}, {}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A16.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A16.js index 19d337e6c2..c403a508b3 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A16.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A16.js @@ -19,8 +19,6 @@ if (typeof re === 'function') { throw new Test262Error('#1: If IsCallable(func) is false, ' + 'then (bind should) throw a TypeError exception'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: TypeError expected. Actual: ' + e); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } } diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A2.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A2.js index d7dd278699..26c4607a62 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A2.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A2.js @@ -18,4 +18,4 @@ function baz() { assert.throws(TypeError, function() { baz(); -}); +}, 'baz() throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A3.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A3.js index 8f2be67d4f..b88c0c7385 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A3.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A3.js @@ -5,7 +5,7 @@ es5id: 15.3.4.5_A3 description: Function.prototype.bind must exist ---*/ - -if (!('bind' in Function.prototype)) { - throw new Test262Error('Function.prototype.bind is missing'); -} +assert( + 'bind' in Function.prototype, + 'The result of evaluating (\'bind\' in Function.prototype) is expected to be true' +); diff --git a/test/built-ins/Function/prototype/bind/S15.3.4.5_A5.js b/test/built-ins/Function/prototype/bind/S15.3.4.5_A5.js index 707dc16a59..c2cbcd3006 100644 --- a/test/built-ins/Function/prototype/bind/S15.3.4.5_A5.js +++ b/test/built-ins/Function/prototype/bind/S15.3.4.5_A5.js @@ -13,6 +13,9 @@ function construct(f, args) { return new bound(); } var d = construct(Date, [1957, 4, 27]); -if (Object.prototype.toString.call(d) !== '[object Date]') { - throw new Test262Error('Using the Date constructor via .bind did not create a Date.'); -} + +assert.sameValue( + Object.prototype.toString.call(d), + '[object Date]', + 'Object.prototype.toString.call(construct(Date, [1957, 4, 27])) must return "[object Date]"' +); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A10.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A10.js index 2a25275ff4..1e6fdf6042 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A10.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A10.js @@ -9,11 +9,10 @@ description: > fails includes: [propertyHelper.js] ---*/ - -//CHECK#1 -if (!(Function.prototype.call.hasOwnProperty('length'))) { - throw new Test262Error('#1: the Function.prototype.call has length property.'); -} +assert( + Function.prototype.call.hasOwnProperty('length'), + 'Function.prototype.call.hasOwnProperty(\'length\') must return true' +); var obj = Function.prototype.call.length; @@ -21,7 +20,10 @@ verifyNotWritable(Function.prototype.call, "length", null, function() { return "shifted"; }); -//CHECK#2 -if (Function.prototype.call.length !== obj) { - throw new Test262Error('#2: the Function.prototype.call length property has the attributes ReadOnly.'); -} +assert.sameValue( + Function.prototype.call.length, + obj, + 'The value of Function.prototype.call.length is expected to equal the value of obj' +); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A11.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A11.js index 1d92a9de21..0c152f8eb7 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A11.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A11.js @@ -8,20 +8,19 @@ description: > Checking if enumerating the Function.prototype.call.length property fails ---*/ +assert( + Function.prototype.call.hasOwnProperty('length'), + 'Function.prototype.call.hasOwnProperty(\'length\') must return true' +); -//CHECK#0 -if (!(Function.prototype.call.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Function.prototype.call has length property.'); -} - - -// CHECK#1 -if (Function.prototype.call.propertyIsEnumerable('length')) { - throw new Test262Error('#1: the Function.prototype.call.length property has the attributes DontEnum'); -} +assert( + !Function.prototype.call.propertyIsEnumerable('length'), + 'The value of !Function.prototype.call.propertyIsEnumerable(\'length\') is expected to be true' +); // CHECK#2 for (var p in Function.prototype.call) { - if (p === "length") - throw new Test262Error('#2: the Function.prototype.call.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/Function/prototype/call/S15.3.4.4_A12.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A12.js index 5f0c64b8f6..57e32fe879 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A12.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A12.js @@ -8,8 +8,8 @@ description: > Checking if obtaining the prototype property of Function.prototype.call fails ---*/ - -//CHECK#1 -if (Function.prototype.call.prototype !== undefined) { - throw new Test262Error('#1: Function.prototype.call has not prototype property' + Function.prototype.call.prototype); -} +assert.sameValue( + Function.prototype.call.prototype, + undefined, + 'The value of Function.prototype.call.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A13.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A13.js index c3ca80a810..adbe505c2a 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A13.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A13.js @@ -8,4 +8,4 @@ description: If IsCallable(func) is false, then throw a TypeError exception. assert.throws(TypeError, function() { Function.prototype.call.call(undefined, {}); -}); +}, 'Function.prototype.call.call(undefined, {}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A14.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A14.js index 9635387890..0461f03ba6 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A14.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A14.js @@ -8,4 +8,4 @@ description: If IsCallable(func) is false, then throw a TypeError exception. assert.throws(TypeError, function() { Function.prototype.call.call(null, {}); -}); +}, 'Function.prototype.call.call(null, {}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A15.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A15.js index c975ccbfdf..fa61fd5fcb 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A15.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A15.js @@ -8,4 +8,4 @@ description: If IsCallable(func) is false, then throw a TypeError exception. assert.throws(TypeError, function() { Function.prototype.call.call({}, {}); -}); +}, 'Function.prototype.call.call({}, {}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A16.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A16.js index 7a1f907790..18fef9ee99 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A16.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A16.js @@ -19,8 +19,6 @@ if (typeof re === 'function') { throw new Test262Error('#1: If IsCallable(func) is false, ' + 'then (bind should) throw a TypeError exception'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1: TypeError expected. Actual: ' + e); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T1.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T1.js index d8ea6999f6..16846d5963 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T1.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T1.js @@ -14,23 +14,17 @@ description: > var proto = Function(); -function FACTORY() {}; +function FACTORY() {} FACTORY.prototype = proto; var obj = new FACTORY; -//CHECK#1 -if (typeof obj.call !== "function") { - throw new Test262Error('#1: call method accessed'); -} +assert.sameValue(typeof obj.call, "function", 'The value of `typeof obj.call` is expected to be "function"'); -//CHECK#2 try { obj.call(); throw new Test262Error('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T2.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T2.js index 7d929226c7..7c22bc2242 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T2.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A1_T2.js @@ -12,23 +12,17 @@ description: > property. Prototype of the object is Function.prototype ---*/ -function FACTORY() {}; +function FACTORY() {} FACTORY.prototype = Function.prototype; var obj = new FACTORY; -//CHECK#1 -if (typeof obj.call !== "function") { - throw new Test262Error('#1: call method accessed'); -} +assert.sameValue(typeof obj.call, "function", 'The value of `typeof obj.call` is expected to be "function"'); -//CHECK#2 try { obj.call(); throw new Test262Error('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T1.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T1.js index 21a3236305..b9fb0e3ef9 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T1.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T1.js @@ -6,18 +6,16 @@ info: The length property of the call method is 1 es5id: 15.3.4.4_A2_T1 description: Checking Function.prototype.call.length ---*/ +assert.sameValue( + typeof Function.prototype.call, + "function", + 'The value of `typeof Function.prototype.call` is expected to be "function"' +); -//CHECK#1 -if (typeof Function.prototype.call !== "function") { - throw new Test262Error('#1: call method defined'); -} +assert.notSameValue( + typeof Function.prototype.call.length, + "undefined", + 'The value of typeof Function.prototype.call.length is not "undefined"' +); -//CHECK#2 -if (typeof Function.prototype.call.length === "undefined") { - throw new Test262Error('#2: length property of call method defined'); -} - -//CHECK#3 -if (Function.prototype.call.length !== 1) { - throw new Test262Error('#3: The length property of the call method is 1'); -} +assert.sameValue(Function.prototype.call.length, 1, 'The value of Function.prototype.call.length is expected to be 1'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T2.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T2.js index 244c528adb..a0a97d077c 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T2.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A2_T2.js @@ -9,17 +9,6 @@ description: Checking f.call.length, where f is new Function var f = new Function; -//CHECK#1 -if (typeof f.call !== "function") { - throw new Test262Error('#1: call method accessed'); -} - -//CHECK#2 -if (typeof f.call.length === "undefined") { - throw new Test262Error('#2: length property of call method defined'); -} - -//CHECK#3 -if (f.call.length !== 1) { - throw new Test262Error('#3: The length property of the call method is 1'); -} +assert.sameValue(typeof f.call, "function", 'The value of `typeof f.call` is expected to be "function"'); +assert.notSameValue(typeof f.call.length, "undefined", 'The value of typeof f.call.length is not "undefined"'); +assert.sameValue(f.call.length, 1, 'The value of f.call.length is expected to be 1'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T1.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T1.js index 9472dda5cd..8343f0b67e 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T1.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T1.js @@ -11,7 +11,4 @@ description: Not any arguments at call function Function("this.field=\"strawberry\"").call(); -//CHECK#1 -if (this["field"] !== "strawberry") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "strawberry", 'The value of this["field"] is expected to be "strawberry"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T10.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T10.js index 2a97761ad6..9b8316bd6c 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T10.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T10.js @@ -12,7 +12,4 @@ flags: [noStrict] eval(" (function(){this.feat=1}).call()"); -//CHECK#1 -if (this["feat"] !== 1) { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 1'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T2.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T2.js index ee8babac37..f2ec4193a1 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T2.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T2.js @@ -11,7 +11,4 @@ description: Argument at call function is null Function("this.field=\"green\"").call(null); -//CHECK#1 -if (this["field"] !== "green") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "green", 'The value of this["field"] is expected to be "green"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T3.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T3.js index 91cd21dae9..83b2191f6b 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T3.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T3.js @@ -11,7 +11,4 @@ description: Argument at call function is void 0 Function("this.field=\"battle\"").call(void 0); -//CHECK#1 -if (this["field"] !== "battle") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "battle", 'The value of this["field"] is expected to be "battle"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T4.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T4.js index 37d8dafc29..76fc80affe 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T4.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T4.js @@ -11,7 +11,4 @@ description: Argument at call function is undefined Function("this.field=\"oil\"").call(undefined); -//CHECK#1 -if (this["field"] !== "oil") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["field"], "oil", 'The value of this["field"] is expected to be "oil"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T5.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T5.js index ed0588fef4..8e1bd7031a 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T5.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T5.js @@ -13,16 +13,9 @@ description: > function FACTORY() { Function("this.feat=\"in da haus\"").call(); -}; +} var obj = new FACTORY; -//CHECK#1 -if (this["feat"] !== "in da haus") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} - -//CHECK#2 -if (typeof obj.feat !== "undefined") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"'); +assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T6.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T6.js index 6d2f1bf526..4d3032551d 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T6.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T6.js @@ -16,16 +16,9 @@ function FACTORY() { (function() { this.feat = "kamon beyba" }).call(null); -}; +} var obj = new FACTORY; -//CHECK#1 -if (this["feat"] !== "kamon beyba") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} - -//CHECK#2 -if (typeof obj.feat !== "undefined") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"'); +assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T7.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T7.js index 132377bf22..9374f84cca 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T7.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T7.js @@ -16,7 +16,4 @@ description: > })(); -//CHECK#1 -if (this["feat"] !== "in da haus") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T8.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T8.js index 32ecb226f0..6b4218d852 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T8.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T8.js @@ -19,7 +19,4 @@ flags: [noStrict] })(); -//CHECK#1 -if (this["feat"] !== "kamon beyba") { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T9.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T9.js index 115fb2dc76..721fd5d56e 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T9.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A3_T9.js @@ -12,7 +12,4 @@ description: Checking by using eval, argument at call function is void 0 eval(" Function(\"this.feat=1\").call(void 0) "); -//CHECK#1 -if (this["feat"] !== 1) { - throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); -} +assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 1'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T1.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T1.js index ab7d3b72df..f6ad75c8d3 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T1.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T1.js @@ -13,12 +13,5 @@ var obj = 1; var retobj = Function("this.touched= true; return this;").call(obj); -//CHECK#1 -if (typeof obj.touched !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T2.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T2.js index dc36ba9bef..36c7a47205 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T2.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T2.js @@ -13,12 +13,5 @@ var obj = true; var retobj = new Function("this.touched= true; return this;").call(obj); -//CHECK#1 -if (typeof obj.touched !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T3.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T3.js index 2e8fc0dd4b..4ad1ba9134 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T3.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T3.js @@ -17,12 +17,5 @@ var retobj = (function() { return this; }).call(obj); -//CHECK#1 -if (typeof obj.touched !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T4.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T4.js index cd2ce88ef7..d819a9436d 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T4.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T4.js @@ -17,14 +17,7 @@ var f = function() { var retobj = f.call(obj); -//CHECK#1 -if (typeof obj !== "undefined") { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} - -//CHECK#2 -if (!(retobj["touched"])) { - throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert.sameValue(typeof obj, "undefined", 'The value of `typeof obj` is expected to be "undefined"'); +assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true'); var obj; diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T5.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T5.js index c07cd2bb1a..dff1f324b8 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T5.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T5.js @@ -17,7 +17,4 @@ var obj = {}; f.call(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T6.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T6.js index fd26188f75..d9afe5ea0b 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T6.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T6.js @@ -15,7 +15,4 @@ var obj = new String("soap"); this.touched = true; }).call(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T7.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T7.js index ad5fef8d7f..9a2094ae23 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T7.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T7.js @@ -13,7 +13,4 @@ var obj = new Number(1); Function("this.touched= true;").call(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T8.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T8.js index 9176c0ae38..ca0c8cccfa 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T8.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A5_T8.js @@ -13,7 +13,4 @@ var obj = Function(); new Function("this.touched= true; return this;").call(obj); -//CHECK#1 -if (!(obj.touched)) { - throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); -} +assert(obj.touched, 'The value of obj.touched is expected to be true'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T1.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T1.js index 4435e5089a..ce0ffa13fd 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T1.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T1.js @@ -11,17 +11,11 @@ description: Argunemts of call function is (null,[1]) Function("a1,a2,a3", "this.shifted=a1;").call(null, [1]); -//CHECK#1 -if (this["shifted"].constructor !== Array) { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue( + this["shifted"].constructor, + Array, + 'The value of this["shifted"].constructor is expected to equal the value of Array' +); -//CHECK#2 -if (this["shifted"].length !== 1) { - throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} - -//CHECK#3 -if (this["shifted"][0] !== 1) { - throw new Test262Error('#3: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(this["shifted"].length, 1, 'The value of this["shifted"].length is expected to be 1'); +assert.sameValue(this["shifted"][0], 1, 'The value of this["shifted"][0] is expected to be 1'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T10.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T10.js index cafe6ca8b5..73899d6831 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T10.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T10.js @@ -17,12 +17,10 @@ var obj = {}; Function("a1,a2,a3", "this.shifted=a1.length+a2+a3;").call(obj, arguments, "", "2"); })("", 4, 2, "a"); -//CHECK#1 -if (obj["shifted"] !== "42") { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(obj["shifted"], "42", 'The value of obj["shifted"] is expected to be "42"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T2.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T2.js index e696a1b11e..3db2c96cfd 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T2.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T2.js @@ -11,12 +11,8 @@ description: Argunemts of call function is (null,[3,2,1]) new Function("a1,a2", "a3", "this.shifted=a1;").call(null, [3, 2, 1]); -//CHECK#1 -if (this["shifted"].length !== 3) { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(this["shifted"].length, 3); -//CHECK#2 if ((this["shifted"][0] !== 3) || (this["shifted"][1] !== 2) || (this["shifted"][2] !== 1)) { throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T3.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T3.js index 2748fdd25d..9d39ac216a 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T3.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T3.js @@ -23,17 +23,12 @@ var obj = {}; Function(p, "a2,a3", "this.shifted=a1;").call(obj, new Array("nine", "inch", "nails")); -//CHECK#1 -if (obj["shifted"].length !== 3) { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(obj["shifted"].length, 3); -//CHECK#2 if ((obj["shifted"][0] !== "nine") || (obj["shifted"][1] !== "inch") || (obj["shifted"][2] !== "nails")) { throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); } -//CHECK#3 if (typeof this["shifted"] !== "undefined") { throw new Test262Error('#3: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T4.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T4.js index 1b3e994502..6a6492e7c5 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T4.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T4.js @@ -25,12 +25,10 @@ new Function(p, p, p, "this.shifted=a3+a2+a1.length;").call(obj, (function() { return arguments; })("a", "b", "c", "d"), "", 2); -//CHECK#1 -if (obj["shifted"] !== "24") { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(obj["shifted"], "24", 'The value of obj["shifted"] is expected to be "24"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T5.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T5.js index 6750ea4e78..b4fae810b7 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T5.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T5.js @@ -17,12 +17,5 @@ function FACTORY() { var obj = new FACTORY("", 1, 2, "A"); -//CHECK#1 -if (this["shifted"] !== "42") { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} - -//CHECK#2 -if (typeof obj.shifted !== "undefined") { - throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(this["shifted"], "42", 'The value of this["shifted"] is expected to be "42"'); +assert.sameValue(typeof obj.shifted, "undefined", 'The value of `typeof obj.shifted` is expected to be "undefined"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T6.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T6.js index c22c66848b..5ce9b7684c 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T6.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T6.js @@ -17,12 +17,10 @@ function FACTORY() { var obj = new FACTORY("", 4, 2, "A"); -//CHECK#1 -if (obj["shifted"] !== "42") { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(obj["shifted"], "42", 'The value of obj["shifted"] is expected to be "42"'); -//CHECK#2 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T7.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T7.js index c4ac2485b4..e353e47939 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T7.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T7.js @@ -15,7 +15,4 @@ description: > Function("a1,a2,a3", "this.shifted=a1.length+a2+a3;").call(null, arguments, "", 2); })("", 1, 2, true); -//CHECK#1 -if (this["shifted"] !== "42") { - throw new Test262Error('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(this["shifted"], "42", 'The value of this["shifted"] is expected to be "42"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T8.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T8.js index beabefd3ee..ac018110ad 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T8.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T8.js @@ -15,7 +15,4 @@ description: > Function("a1,a2,a3", "this.shifted=a1.length+a2+a3;").call(this, arguments, "", 2); })("", 4, 2, null); -//CHECK#2 -if (this["shifted"] !== "42") { - throw new Test262Error('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); -} +assert.sameValue(this["shifted"], "42", 'The value of this["shifted"] is expected to be "42"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T9.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T9.js index d302d6988b..47312833ca 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T9.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A6_T9.js @@ -19,12 +19,10 @@ function FACTORY() { var obj = new FACTORY("", 1, 2, void 0); -//CHECK#1 -if (typeof this["shifted"] !== "undefined") { - throw new Test262Error('#1: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue( + typeof this["shifted"], + "undefined", + 'The value of `typeof this["shifted"]` is expected to be "undefined"' +); -//CHECK#2 -if (obj.shifted !== "42") { - throw new Test262Error('#2: If argArray is either an array or an arguments object, the function is passed the...'); -} +assert.sameValue(obj.shifted, "42", 'The value of obj.shifted is expected to be "42"'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js index 36bc7917fa..9b85847381 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js @@ -11,7 +11,5 @@ try { var obj = new Function.prototype.call; throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.call can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js index 22cffdf82a..b530af9215 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js @@ -12,7 +12,5 @@ try { var obj = new FACTORY(); throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.call can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T3.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T3.js index 1b8be85d4a..f64a0e40bc 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T3.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T3.js @@ -11,7 +11,5 @@ try { var obj = new Function.call; throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.call can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T4.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T4.js index 2bfaff6900..dde975d363 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T4.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T4.js @@ -11,7 +11,5 @@ try { var obj = new(Function("this.p1=1").call); throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.call can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T5.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T5.js index 086fcda8f0..e591373074 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T5.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T5.js @@ -12,7 +12,5 @@ try { var obj = new FACTORY(); throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller'); } catch (e) { - if (!(e instanceof TypeError)) { - throw new Test262Error('#1.1: Function.prototype.call can\'t be used as [[Construct]] caller'); - } + assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true'); } diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T6.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T6.js index 475e899538..d971feeca0 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T6.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A7_T6.js @@ -9,14 +9,10 @@ description: > f(){this.p1=1;};return f").call())" fails ---*/ -//CHECK#1 try { var obj = new(Function("function f(){this.p1=1;};return f").call()); } catch (e) { throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller'); } -//CHECK#2 -if (obj.p1 !== 1) { - throw new Test262Error('#2: Function.prototype.call can\'t be used as [[Construct]] caller'); -} +assert.sameValue(obj.p1, 1, 'The value of obj.p1 is expected to be 1'); diff --git a/test/built-ins/Function/prototype/call/S15.3.4.4_A9.js b/test/built-ins/Function/prototype/call/S15.3.4.4_A9.js index eb4c806654..2ed71ccb07 100644 --- a/test/built-ins/Function/prototype/call/S15.3.4.4_A9.js +++ b/test/built-ins/Function/prototype/call/S15.3.4.4_A9.js @@ -10,18 +10,19 @@ description: > Checking if deleting the Function.prototype.call.length property fails ---*/ +assert( + Function.prototype.call.hasOwnProperty('length'), + 'Function.prototype.call.hasOwnProperty(\'length\') must return true' +); -//CHECK#0 -if (!(Function.prototype.call.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Function.prototype.call has length property'); -} +assert( + delete Function.prototype.call.length, + 'The value of delete Function.prototype.call.length is expected to be true' +); -//CHECK#1 -if (!delete Function.prototype.call.length) { - throw new Test262Error('#1: The Function.prototype.call.length property does not have the attributes DontDelete'); -} +assert( + !Function.prototype.call.hasOwnProperty('length'), + 'The value of !Function.prototype.call.hasOwnProperty(\'length\') is expected to be true' +); -//CHECK#2 -if (Function.prototype.call.hasOwnProperty('length')) { - throw new Test262Error('#2: The Function.prototype.call.length property does not have the attributes DontDelete'); -} +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/constructor/S15.3.4.1_A1_T1.js b/test/built-ins/Function/prototype/constructor/S15.3.4.1_A1_T1.js index 8024311b7a..3bddd5c775 100644 --- a/test/built-ins/Function/prototype/constructor/S15.3.4.1_A1_T1.js +++ b/test/built-ins/Function/prototype/constructor/S15.3.4.1_A1_T1.js @@ -8,8 +8,8 @@ info: | es5id: 15.3.4.1_A1_T1 description: Checking Function.prototype.constructor ---*/ - -//CHECK#1 -if (Function.prototype.constructor !== Function) { - throw new Test262Error('#1: The initial value of Function.prototype.constructor is the built-in Function constructor'); -} +assert.sameValue( + Function.prototype.constructor, + Function, + 'The value of Function.prototype.constructor is expected to equal the value of Function' +); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A10.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A10.js index 890b5cf026..24db12f622 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A10.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A10.js @@ -9,17 +9,19 @@ description: > property fails includes: [propertyHelper.js] ---*/ - -//CHECK#1 -if (!(Function.prototype.toString.hasOwnProperty('length'))) { - throw new Test262Error('#1: the Function.prototype.toString has length property.'); -} +assert( + Function.prototype.toString.hasOwnProperty('length'), + 'Function.prototype.toString.hasOwnProperty(\'length\') must return true' +); var obj = Function.prototype.toString.length; verifyNotWritable(Function.prototype.toString, "length", null, function(){return "shifted";}); -//CHECK#2 -if (Function.prototype.toString.length !== obj) { - throw new Test262Error('#2: the Function.prototype.toString length property has the attributes ReadOnly.'); -} +assert.sameValue( + Function.prototype.toString.length, + obj, + 'The value of Function.prototype.toString.length is expected to equal the value of obj' +); + +// TODO: Convert to verifyProperty() format. diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A11.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A11.js index 598847d71d..742e7a4c60 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A11.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A11.js @@ -6,13 +6,13 @@ info: The length property of the toString method is 0 es5id: 15.3.4.2_A11 description: Checking Function.prototype.toString.length ---*/ +assert( + Function.prototype.toString.hasOwnProperty("length"), + 'Function.prototype.toString.hasOwnProperty("length") must return true' +); -//CHECK#1 -if (!(Function.prototype.toString.hasOwnProperty("length"))) { - throw new Test262Error('#1: The Function.prototype.toString has the length property'); -} - -//CHECK#2 -if (Function.prototype.toString.length !== 0) { - throw new Test262Error('#2: The length property of the toString method is 0'); -} +assert.sameValue( + Function.prototype.toString.length, + 0, + 'The value of Function.prototype.toString.length is expected to be 0' +); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A12.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A12.js index 1bb1b584fe..9e9a91e8ae 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A12.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A12.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Function.prototype.toString.call(undefined); -}); +}, 'Function.prototype.toString.call(undefined) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A13.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A13.js index 5cab3aaf2d..9f00a84765 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A13.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A13.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Function.prototype.toString.call(null); -}); +}, 'Function.prototype.toString.call(null) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A14.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A14.js index 20fc46662b..de50f30fcb 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A14.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A14.js @@ -10,4 +10,4 @@ description: > assert.throws(TypeError, function() { Function.prototype.toString.call({}); -}); +}, 'Function.prototype.toString.call({}) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A16.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A16.js index 4cba0c3b54..e7573bc032 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A16.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A16.js @@ -16,4 +16,4 @@ var obj = {toString: Function.prototype.toString}; assert.throws(TypeError, function() { String(obj); -}); +}, 'String(obj) throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A6.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A6.js index 1592e2af67..c21f473913 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A6.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A6.js @@ -8,8 +8,8 @@ description: > Checking if obtaining the prototype property of Function.prototype.toString fails ---*/ - -//CHECK#1 -if (Function.prototype.toString.prototype !== undefined) { - throw new Test262Error('#1: Function.prototype.toString has not prototype property'+Function.prototype.toString.prototype); -} +assert.sameValue( + Function.prototype.toString.prototype, + undefined, + 'The value of Function.prototype.toString.prototype is expected to equal undefined' +); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js index ef8ce26959..fabab25bd0 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js @@ -11,4 +11,4 @@ var FACTORY = Function.prototype.toString; assert.throws(TypeError, function() { new FACTORY; -}); +}, '`new FACTORY` throws a TypeError exception'); diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A8.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A8.js index 8bc7fb80c0..dcf6804ad4 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A8.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A8.js @@ -8,20 +8,19 @@ description: > Checking if enumerating the Function.prototype.toString.length property fails ---*/ +assert( + Function.prototype.toString.hasOwnProperty('length'), + 'Function.prototype.toString.hasOwnProperty(\'length\') must return true' +); -//CHECK#0 -if (!(Function.prototype.toString.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Function.prototype.toString has length property.'); -} - - -// CHECK#1 -if (Function.prototype.toString.propertyIsEnumerable('length')) { - throw new Test262Error('#1: the Function.prototype.toString.length property has the attributes DontEnum'); -} +assert( + !Function.prototype.toString.propertyIsEnumerable('length'), + 'The value of !Function.prototype.toString.propertyIsEnumerable(\'length\') is expected to be true' +); // CHECK#2 for (var p in Function.prototype.toString){ - if (p==="length") - throw new Test262Error('#2: the Function.prototype.toString.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/Function/prototype/toString/S15.3.4.2_A9.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A9.js index 3390f78953..f9bad95f84 100644 --- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A9.js +++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A9.js @@ -10,18 +10,19 @@ description: > Checking if deleting the Function.prototype.toString.length property fails ---*/ +assert( + Function.prototype.toString.hasOwnProperty('length'), + 'Function.prototype.toString.hasOwnProperty(\'length\') must return true' +); -//CHECK#0 -if (!(Function.prototype.toString.hasOwnProperty('length'))) { - throw new Test262Error('#0: the Function.prototype.toString has length property'); -} +assert( + delete Function.prototype.toString.length, + 'The value of delete Function.prototype.toString.length is expected to be true' +); -//CHECK#1 -if (!delete Function.prototype.toString.length) { - throw new Test262Error('#1: The Function.prototype.toString.length property does not have the attributes DontDelete'); -} +assert( + !Function.prototype.toString.hasOwnProperty('length'), + 'The value of !Function.prototype.toString.hasOwnProperty(\'length\') is expected to be true' +); -//CHECK#2 -if (Function.prototype.toString.hasOwnProperty('length')) { - throw new Test262Error('#2: The Function.prototype.toString.length property does not have the attributes DontDelete'); -} +// TODO: Convert to verifyProperty() format.