From 4eac0d909e4f4cb3eddb501265be5801b1bac93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 6 Aug 2015 18:31:06 +0200 Subject: [PATCH] Replace runTestCase with assert helpers [test/language/expressions/delete] --- test/language/expressions/delete/11.4.1-2-2.js | 9 +++------ test/language/expressions/delete/11.4.1-2-3.js | 9 ++------- test/language/expressions/delete/11.4.1-2-4.js | 9 ++------- test/language/expressions/delete/11.4.1-2-5.js | 9 ++------- test/language/expressions/delete/11.4.1-2-6.js | 9 ++------- test/language/expressions/delete/11.4.1-3-1.js | 9 ++------- test/language/expressions/delete/11.4.1-3-3.js | 9 ++------- test/language/expressions/delete/11.4.1-4-a-3-s.js | 7 ++----- test/language/expressions/delete/11.4.1-4-a-4-s.js | 7 ++----- test/language/expressions/delete/11.4.1-4.a-1.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-12.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-14.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-15.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-2.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-3.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-4.js | 9 ++------- test/language/expressions/delete/11.4.1-4.a-6.js | 10 +++------- test/language/expressions/delete/11.4.1-4.a-9.js | 9 ++------- test/language/expressions/delete/11.4.1-5-2.js | 8 ++------ test/language/expressions/delete/11.4.1-5-a-28-s.js | 5 ----- 20 files changed, 46 insertions(+), 132 deletions(-) diff --git a/test/language/expressions/delete/11.4.1-2-2.js b/test/language/expressions/delete/11.4.1-2-2.js index e801c2799a..0951a60698 100644 --- a/test/language/expressions/delete/11.4.1-2-2.js +++ b/test/language/expressions/delete/11.4.1-2-2.js @@ -6,15 +6,12 @@ es5id: 11.4.1-2-2 description: > delete operator returns true when deleting returned value from a function -includes: [runTestCase.js] ---*/ -function testcase() { var bIsFooCalled = false; var foo = function(){bIsFooCalled = true;}; var d = delete foo(); - if(d === true && bIsFooCalled === true) - return true; - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); +assert.sameValue(bIsFooCalled, true, 'bIsFooCalled'); diff --git a/test/language/expressions/delete/11.4.1-2-3.js b/test/language/expressions/delete/11.4.1-2-3.js index a55699770f..dbd9737074 100644 --- a/test/language/expressions/delete/11.4.1-2-3.js +++ b/test/language/expressions/delete/11.4.1-2-3.js @@ -6,13 +6,8 @@ es5id: 11.4.1-2-3 description: > delete operator returns true when deleting a non-reference (boolean) -includes: [runTestCase.js] ---*/ -function testcase() { var d = delete true; - if (d === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); diff --git a/test/language/expressions/delete/11.4.1-2-4.js b/test/language/expressions/delete/11.4.1-2-4.js index a2cb46eba2..fbad9c12f3 100644 --- a/test/language/expressions/delete/11.4.1-2-4.js +++ b/test/language/expressions/delete/11.4.1-2-4.js @@ -4,13 +4,8 @@ /*--- es5id: 11.4.1-2-4 description: delete operator returns true when deleting a non-reference (string) -includes: [runTestCase.js] ---*/ -function testcase() { var d = delete "abc"; - if (d === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); diff --git a/test/language/expressions/delete/11.4.1-2-5.js b/test/language/expressions/delete/11.4.1-2-5.js index 55784bc5ec..cbceca7dae 100644 --- a/test/language/expressions/delete/11.4.1-2-5.js +++ b/test/language/expressions/delete/11.4.1-2-5.js @@ -4,13 +4,8 @@ /*--- es5id: 11.4.1-2-5 description: delete operator returns true when deleting a non-reference (obj) -includes: [runTestCase.js] ---*/ -function testcase() { var d = delete {a:0} ; - if (d === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); diff --git a/test/language/expressions/delete/11.4.1-2-6.js b/test/language/expressions/delete/11.4.1-2-6.js index d772298385..97cfc995cb 100644 --- a/test/language/expressions/delete/11.4.1-2-6.js +++ b/test/language/expressions/delete/11.4.1-2-6.js @@ -4,13 +4,8 @@ /*--- es5id: 11.4.1-2-6 description: delete operator returns true when deleting a non-reference (null) -includes: [runTestCase.js] ---*/ -function testcase() { var d = delete null; - if (d === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); diff --git a/test/language/expressions/delete/11.4.1-3-1.js b/test/language/expressions/delete/11.4.1-3-1.js index 2aa0a935ac..c04ee454a8 100644 --- a/test/language/expressions/delete/11.4.1-3-1.js +++ b/test/language/expressions/delete/11.4.1-3-1.js @@ -7,14 +7,9 @@ description: > delete operator returns true when deleting an unresolvable reference flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { // just cooking up a long/veryLikely unique name var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_0__; - if (d === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); diff --git a/test/language/expressions/delete/11.4.1-3-3.js b/test/language/expressions/delete/11.4.1-3-3.js index a514fad092..30b6b49a30 100644 --- a/test/language/expressions/delete/11.4.1-3-3.js +++ b/test/language/expressions/delete/11.4.1-3-3.js @@ -6,14 +6,9 @@ es5id: 11.4.1-3-3 description: > delete operator returns true when deleting an explicitly qualified yet unresolvable reference (property undefined for base obj) -includes: [runTestCase.js] ---*/ -function testcase() { var __ES3_1_test_suite_test_11_4_1_3_unique_id_3__ = {}; var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_3__.x; - if (d === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); diff --git a/test/language/expressions/delete/11.4.1-4-a-3-s.js b/test/language/expressions/delete/11.4.1-4-a-3-s.js index ee0a00693d..3816fb9fb9 100644 --- a/test/language/expressions/delete/11.4.1-4-a-3-s.js +++ b/test/language/expressions/delete/11.4.1-4-a-3-s.js @@ -5,10 +5,8 @@ es5id: 11.4.1-4-a-3-s description: > TypeError isn't thrown when deleting configurable data property -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { value: "abc", @@ -16,6 +14,5 @@ function testcase() { }); delete obj.prop; - return !obj.hasOwnProperty("prop"); - } -runTestCase(testcase); + +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); diff --git a/test/language/expressions/delete/11.4.1-4-a-4-s.js b/test/language/expressions/delete/11.4.1-4-a-4-s.js index 9615b50414..ed5c2d47e8 100644 --- a/test/language/expressions/delete/11.4.1-4-a-4-s.js +++ b/test/language/expressions/delete/11.4.1-4-a-4-s.js @@ -5,10 +5,8 @@ es5id: 11.4.1-4-a-4-s description: > TypeError isn't thrown when deleting configurable accessor property -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { get: function () { @@ -18,6 +16,5 @@ function testcase() { }); delete obj.prop; - return !obj.hasOwnProperty("prop"); - } -runTestCase(testcase); + +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); diff --git a/test/language/expressions/delete/11.4.1-4.a-1.js b/test/language/expressions/delete/11.4.1-4.a-1.js index 419f787d4c..c68f0a6b9d 100644 --- a/test/language/expressions/delete/11.4.1-4.a-1.js +++ b/test/language/expressions/delete/11.4.1-4.a-1.js @@ -9,18 +9,14 @@ es5id: 11.4.1-4.a-1 description: > delete operator returns true when deleting a configurable data property -includes: [runTestCase.js] ---*/ -function testcase() { var o = {}; var desc = { value: 1, configurable: true }; Object.defineProperty(o, "foo", desc); var d = delete o.foo; - if (d === true && o.hasOwnProperty("foo") === false) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); +assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")'); diff --git a/test/language/expressions/delete/11.4.1-4.a-12.js b/test/language/expressions/delete/11.4.1-4.a-12.js index 9553756b25..5a5f306203 100644 --- a/test/language/expressions/delete/11.4.1-4.a-12.js +++ b/test/language/expressions/delete/11.4.1-4.a-12.js @@ -8,15 +8,11 @@ info: > es5id: 11.4.1-4.a-12 description: delete operator returns false when deleting a property(length) flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { - var a = [1,2,3] a.x = 10; var d = delete a.length - if(d === false && a.length === 3) - return true; - } -runTestCase(testcase); + +assert.sameValue(d, false, 'd'); +assert.sameValue(a.length, 3, 'a.length'); diff --git a/test/language/expressions/delete/11.4.1-4.a-14.js b/test/language/expressions/delete/11.4.1-4.a-14.js index 005b6aa381..2701ed24de 100644 --- a/test/language/expressions/delete/11.4.1-4.a-14.js +++ b/test/language/expressions/delete/11.4.1-4.a-14.js @@ -7,15 +7,11 @@ info: > language provides no way to directly exercise [[Delete]], the tests are placed here. es5id: 11.4.1-4.a-14 description: delete operator returns true when deleting Array elements -includes: [runTestCase.js] ---*/ -function testcase() { - var a = [1,2,3] a.x = 10; var d = delete a[1] - if(d === true && a[1] === undefined) - return true; - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); +assert.sameValue(a[1], undefined, 'a[1]'); diff --git a/test/language/expressions/delete/11.4.1-4.a-15.js b/test/language/expressions/delete/11.4.1-4.a-15.js index 2290557cfd..570a10f5ce 100644 --- a/test/language/expressions/delete/11.4.1-4.a-15.js +++ b/test/language/expressions/delete/11.4.1-4.a-15.js @@ -7,15 +7,11 @@ info: > language provides no way to directly exercise [[Delete]], the tests are placed here. es5id: 11.4.1-4.a-15 description: delete operator returns true when deleting Array expandos -includes: [runTestCase.js] ---*/ -function testcase() { - var a = [1,2,3] a.x = 10; var d = delete a.x; - if( d === true && a.x === undefined) - return true; - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); +assert.sameValue(a.x, undefined, 'a.x'); diff --git a/test/language/expressions/delete/11.4.1-4.a-2.js b/test/language/expressions/delete/11.4.1-4.a-2.js index 0e9fa332ae..87d3c39a5a 100644 --- a/test/language/expressions/delete/11.4.1-4.a-2.js +++ b/test/language/expressions/delete/11.4.1-4.a-2.js @@ -9,10 +9,8 @@ es5id: 11.4.1-4.a-2 description: > delete operator returns true when deleting a configurable accessor property -includes: [runTestCase.js] ---*/ -function testcase() { var o = {}; // define an accessor @@ -22,8 +20,6 @@ function testcase() { Object.defineProperty(o, "foo", desc); var d = delete o.foo; - if (d === true && o.hasOwnProperty("foo") === false) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); +assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")'); diff --git a/test/language/expressions/delete/11.4.1-4.a-3.js b/test/language/expressions/delete/11.4.1-4.a-3.js index 4268066a9d..6070c2f173 100644 --- a/test/language/expressions/delete/11.4.1-4.a-3.js +++ b/test/language/expressions/delete/11.4.1-4.a-3.js @@ -10,18 +10,14 @@ description: > delete operator returns false when deleting a non-configurable data property flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { var o = {}; var desc = { value : 1, configurable: false }; // all other attributes default to false Object.defineProperty(o, "foo", desc); // Now, deleting o.foo should fail because [[Configurable]] on foo is false. var d = delete o.foo; - if (d === false && o.hasOwnProperty("foo") === true) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, false, 'd'); +assert.sameValue(o.hasOwnProperty("foo"), true, 'o.hasOwnProperty("foo")'); diff --git a/test/language/expressions/delete/11.4.1-4.a-4.js b/test/language/expressions/delete/11.4.1-4.a-4.js index c3246b83f4..138adaf4d5 100644 --- a/test/language/expressions/delete/11.4.1-4.a-4.js +++ b/test/language/expressions/delete/11.4.1-4.a-4.js @@ -10,14 +10,9 @@ description: > delete operator returns false when deleting a non-configurable data property (NaN) flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { // NaN (15.1.1.1) has [[Configurable]] set to false. var d = delete NaN; - if (d === false) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, false, 'd'); diff --git a/test/language/expressions/delete/11.4.1-4.a-6.js b/test/language/expressions/delete/11.4.1-4.a-6.js index 66dae9683b..736abcd77f 100644 --- a/test/language/expressions/delete/11.4.1-4.a-6.js +++ b/test/language/expressions/delete/11.4.1-4.a-6.js @@ -8,10 +8,8 @@ info: > es5id: 11.4.1-4.a-6 description: delete operator returns true when deleting a property inside 'with' flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { var o = new Object(); o.x = 1; var d; @@ -19,8 +17,6 @@ function testcase() { { d = delete x; } - if (d === true && o.x === undefined) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, true, 'd'); +assert.sameValue(o.x, undefined, 'o.x'); diff --git a/test/language/expressions/delete/11.4.1-4.a-9.js b/test/language/expressions/delete/11.4.1-4.a-9.js index 43ceddf093..d4534d3e19 100644 --- a/test/language/expressions/delete/11.4.1-4.a-9.js +++ b/test/language/expressions/delete/11.4.1-4.a-9.js @@ -10,13 +10,8 @@ description: > delete operator returns false when deleting a non-configurable data property (Math.LN2) flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { var d = delete Math.LN2; - if (d === false) { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(d, false, 'd'); diff --git a/test/language/expressions/delete/11.4.1-5-2.js b/test/language/expressions/delete/11.4.1-5-2.js index e6d5193ab6..2e565106f8 100644 --- a/test/language/expressions/delete/11.4.1-5-2.js +++ b/test/language/expressions/delete/11.4.1-5-2.js @@ -7,11 +7,8 @@ description: > delete operator returns false when deleting a direct reference to a function argument flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { - function foo(a,b) { // Now, deleting 'a' directly should fail @@ -19,6 +16,5 @@ function testcase() { var d = delete a; return (d === false && a === 1); } - return foo(1,2); - } -runTestCase(testcase); + +assert(foo(1,2), 'foo(1,2) !== true'); diff --git a/test/language/expressions/delete/11.4.1-5-a-28-s.js b/test/language/expressions/delete/11.4.1-5-a-28-s.js index 7780447ad7..0028e84ddd 100644 --- a/test/language/expressions/delete/11.4.1-5-a-28-s.js +++ b/test/language/expressions/delete/11.4.1-5-a-28-s.js @@ -4,12 +4,7 @@ /*--- es5id: 11.4.1-5-a-28-s description: Strict Mode - TypeError is not thrown when deleting RegExp.length -includes: [runTestCase.js] ---*/ -function testcase() { var a = new RegExp(); var b = delete RegExp.length; - return true; -} -runTestCase(testcase);