diff options
219 files changed, 695 insertions, 2057 deletions
diff --git a/test/built-ins/Array/from/S22.1.2.1_T1.js b/test/built-ins/Array/from/S22.1.2.1_T1.js index c35877b45..fd2320f76 100644 --- a/test/built-ins/Array/from/S22.1.2.1_T1.js +++ b/test/built-ins/Array/from/S22.1.2.1_T1.js @@ -5,16 +5,9 @@ es6id: 22.1.2.1_T1 description: Testing Array.from when passed a String author: Hank Yates (hankyates@gmail.com) -includes: [runTestCase.js] ---*/ -runTestCase(function () { var arrLikeSource = 'testValue', testArr = Array.from(arrLikeSource); - if (testArr.length != 9) { - return false; - } - - return true; -}); +assert.sameValue(testArr.length, 9); diff --git a/test/built-ins/Array/from/S22.1.2.1_T2.js b/test/built-ins/Array/from/S22.1.2.1_T2.js index 827b00360..138be8be0 100644 --- a/test/built-ins/Array/from/S22.1.2.1_T2.js +++ b/test/built-ins/Array/from/S22.1.2.1_T2.js @@ -5,10 +5,8 @@ es6id: 22.1.2.1_T2 description: Testing Array.from when passed an Object is passed author: Hank Yates (hankyates@gmail.com) -includes: [runTestCase.js] ---*/ -runTestCase(function () { var testArr = Array.from({ 'a': 1, 'b': '2', @@ -16,10 +14,4 @@ runTestCase(function () { 'length': '3' }); - if (testArr.length != 3) { - return false; - } - - return true; - -}); +assert.sameValue(testArr.length, 3); diff --git a/test/built-ins/Array/from/S22.1.2.1_T3.js b/test/built-ins/Array/from/S22.1.2.1_T3.js index 0299f3623..72e93ec53 100644 --- a/test/built-ins/Array/from/S22.1.2.1_T3.js +++ b/test/built-ins/Array/from/S22.1.2.1_T3.js @@ -5,16 +5,8 @@ es6id: 22.1.2.1_T3 description: Testing Array.from when passed an undefined author: Hank Yates (hankyates@gmail.com) -includes: [runTestCase.js] ---*/ -runTestCase(function () { - try { +assert.throws(TypeError, function() { Array.from(undefined); - } catch (e) { - return e instanceof TypeError; - } - - return false; - }); diff --git a/test/built-ins/Array/prototype/every/15.4.4.16-4-10.js b/test/built-ins/Array/prototype/every/15.4.4.16-4-10.js index 6bff09afc..6e36f9856 100644 --- a/test/built-ins/Array/prototype/every/15.4.4.16-4-10.js +++ b/test/built-ins/Array/prototype/every/15.4.4.16-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.16-4-10 description: > Array.prototype.every - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.every.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/every/15.4.4.16-4-11.js b/test/built-ins/Array/prototype/every/15.4.4.16-4-11.js index 6c5a71ec6..7f49c16a4 100644 --- a/test/built-ins/Array/prototype/every/15.4.4.16-4-11.js +++ b/test/built-ins/Array/prototype/every/15.4.4.16-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.16-4-11 description: > Array.prototype.every - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.every.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js b/test/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js index b81bc78d0..bba24bca1 100644 --- a/test/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js +++ b/test/built-ins/Array/prototype/every/15.4.4.16-7-c-ii-7.js @@ -6,28 +6,22 @@ es5id: 15.4.4.16-7-c-ii-7 description: > Array.prototype.every - unhandled exceptions happened in callbackfn terminate iteration -includes: [runTestCase.js] ---*/ -function testcase() { - var called = 0; function callbackfn(val, idx, obj) { called++; if (called === 1) { - throw new Error("Exception occurred in callbackfn"); + throw new Test262Error("Exception occurred in callbackfn"); } return true; } var obj = { 0: 11, 4: 10, 10: 8, length: 20 }; - try { +assert.throws(Test262Error, function() { Array.prototype.every.call(obj, callbackfn); - return false; - } catch (ex) { - return 1 === called; - } - } -runTestCase(testcase); +}); + +assert.sameValue(called, 1, 'called'); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-4-10.js b/test/built-ins/Array/prototype/filter/15.4.4.20-4-10.js index 702bdd445..ce069c57a 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-4-10.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.20-4-10 description: > Array.prototype.filter - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.filter.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-4-11.js b/test/built-ins/Array/prototype/filter/15.4.4.20-4-11.js index 8964aa4fe..86e3eafc3 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-4-11.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.20-4-11 description: > Array.prototype.filter - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.filter.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-5-1.js b/test/built-ins/Array/prototype/filter/15.4.4.20-5-1.js index f24da6d49..741dabfb6 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-5-1.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-5-1.js @@ -5,10 +5,9 @@ es5id: 15.4.4.20-5-1 description: Array.prototype.filter - thisArg is passed flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { +(function() { this._15_4_4_20_5_1 = false; var _15_4_4_20_5_1 = true; @@ -17,6 +16,6 @@ function testcase() { } var srcArr = [1]; var resArr = srcArr.filter(callbackfn); - return resArr.length === 0; - } -runTestCase(testcase); + +assert.sameValue(resArr.length, 0, 'resArr.length'); +})(); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-9-3.js b/test/built-ins/Array/prototype/filter/15.4.4.20-9-3.js index f660f7eb1..2e98c45af 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-9-3.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-9-3.js @@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-3 description: > Array.prototype.filter doesn't visit deleted elements in array after the call -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj) { delete srcArr[2]; @@ -23,8 +20,8 @@ function testcase() { var srcArr = [1,2,3,4,5]; var resArr = srcArr.filter(callbackfn); - if(resArr.length === 3 && resArr[0] === 1 && resArr[2] === 4 ) // two elements deleted - return true; - - } -runTestCase(testcase); + +// two elements deleted +assert.sameValue(resArr.length, 3, 'resArr.length'); +assert.sameValue(resArr[0], 1, 'resArr[0]'); +assert.sameValue(resArr[2], 4, 'resArr[2]'); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-9-6.js b/test/built-ins/Array/prototype/filter/15.4.4.20-9-6.js index b22c278f1..6a4bfc3af 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-9-6.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-9-6.js @@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-6 description: > Array.prototype.filter visits deleted element in array after the call when same index is also present in prototype -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj) { delete srcArr[2]; @@ -25,8 +22,8 @@ function testcase() { var srcArr = [1,2,3,4,5]; var resArr = srcArr.filter(callbackfn); delete Array.prototype[4]; - if(resArr.length === 4 && resArr[0] === 1 && resArr[3] == 5) // only one element deleted - return true; - - } -runTestCase(testcase); + +// only one element deleted +assert.sameValue(resArr.length, 4, 'resArr.length'); +assert.sameValue(resArr[0], 1, 'resArr[0]'); +assert.sameValue(resArr[3], 5, 'resArr[3]'); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js b/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js index a71b2fee2..5038d64a9 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js @@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-iii-1-2 description: > Array.prototype.filter - value of returned array element can be overwritten -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj) { return true; } @@ -18,12 +15,7 @@ function testcase() { var obj = { 0: 11, 1: 9, length: 2 }; var newArr = Array.prototype.filter.call(obj, callbackfn); - try { var tempVal = newArr[1]; newArr[1] += 1; - return newArr[1] !== tempVal; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert.notSameValue(newArr[1], tempVal, 'newArr[1]'); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js b/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js index 066cdba9a..27a44717a 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js @@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-iii-1-4 description: > Array.prototype.filter - value of returned array element can be changed or deleted -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj) { return true; } @@ -18,12 +15,8 @@ function testcase() { var obj = { 0: 11, 1: 9, length: 2 }; var newArr = Array.prototype.filter.call(obj, callbackfn); - try { var tempVal = newArr[1]; delete newArr[1]; - return tempVal !== undefined && newArr[1] === undefined; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert.notSameValue(tempVal, undefined, 'tempVal'); +assert.sameValue(newArr[1], undefined, 'newArr[1]'); diff --git a/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js b/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js index d751645de..b48d4970f 100644 --- a/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js +++ b/test/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js @@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-iii-1 description: > Array.prototype.filter - getOwnPropertyDescriptor(all true) of returned array element -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj){ if(val % 2) return true; @@ -19,14 +16,12 @@ function testcase() { } var srcArr = [0,1,2,3,4]; var resArr = srcArr.filter(callbackfn); - if (resArr.length > 0){ - var desc = Object.getOwnPropertyDescriptor(resArr, 1) - if(desc.value === 3 && //srcArr[1] = true - desc.writable === true && - desc.enumerable === true && - desc.configurable === true){ - return true; - } - } - } -runTestCase(testcase); + +assert(resArr.length > 0, 'resArr.length > 0'); + +var desc = Object.getOwnPropertyDescriptor(resArr, 1); + +assert.sameValue(desc.value, 3, 'desc.value'); //srcArr[1] = true +assert.sameValue(desc.writable, true, 'desc.writable'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); diff --git a/test/built-ins/Array/prototype/forEach/15.4.4.18-4-10.js b/test/built-ins/Array/prototype/forEach/15.4.4.18-4-10.js index 3f73a9150..1be5b6a0e 100644 --- a/test/built-ins/Array/prototype/forEach/15.4.4.18-4-10.js +++ b/test/built-ins/Array/prototype/forEach/15.4.4.18-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.18-4-10 description: > Array.prototype.forEach - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.forEach.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/forEach/15.4.4.18-4-11.js b/test/built-ins/Array/prototype/forEach/15.4.4.18-4-11.js index 9c2d16263..a033598f1 100644 --- a/test/built-ins/Array/prototype/forEach/15.4.4.18-4-11.js +++ b/test/built-ins/Array/prototype/forEach/15.4.4.18-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.18-4-11 description: > Array.prototype.forEach - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.forEach.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/forEach/15.4.4.18-5-1.js b/test/built-ins/Array/prototype/forEach/15.4.4.18-5-1.js index 500c57c37..80b584e9f 100644 --- a/test/built-ins/Array/prototype/forEach/15.4.4.18-5-1.js +++ b/test/built-ins/Array/prototype/forEach/15.4.4.18-5-1.js @@ -5,10 +5,9 @@ es5id: 15.4.4.18-5-1 description: Array.prototype.forEach - thisArg is passed flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { +(function() { this._15_4_4_18_5_1 = false; var _15_4_4_18_5_1 = true; var result; @@ -17,6 +16,6 @@ function testcase() { } var arr = [1]; arr.forEach(callbackfn) - return !result; - } -runTestCase(testcase); + +assert.sameValue(result, false, 'result'); +})(); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-10-1.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-10-1.js index e4021265a..f3cea59e8 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-10-1.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-10-1.js @@ -6,10 +6,8 @@ es5id: 15.4.4.14-10-1 description: > Array.prototype.indexOf returns -1 for elements not present in array -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(); a[100] = 1; a[99999] = ""; @@ -17,21 +15,15 @@ function testcase() { a[5555] = 5.5; a[123456] = "str"; a[5] = 1E+309; - if (a.indexOf(1) !== 100 || - a.indexOf("") !== 99999 || - a.indexOf("str") !== 123456 || - a.indexOf(1E+309) !== 5 || //Infinity - a.indexOf(5.5) !== 5555 ) - { - return false; - } - if (a.indexOf(true) === -1 && - a.indexOf(5) === -1 && - a.indexOf("str1") === -1 && - a.indexOf(null) === -1 && - a.indexOf(new Object()) === -1) - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(1), 100, 'a.indexOf(1)'); +assert.sameValue(a.indexOf(""), 99999, 'a.indexOf("")'); +assert.sameValue(a.indexOf("str"), 123456, 'a.indexOf("str")'); +assert.sameValue(a.indexOf(1E+309), 5, 'a.indexOf(1E+309)'); //Infinity +assert.sameValue(a.indexOf(5.5), 5555, 'a.indexOf(5.5)'); + +assert.sameValue(a.indexOf(true), -1, 'a.indexOf(true)'); +assert.sameValue(a.indexOf(5), -1, 'a.indexOf(5)'); +assert.sameValue(a.indexOf("str1"), -1, 'a.indexOf("str1")'); +assert.sameValue(a.indexOf(null), -1, 'a.indexOf(null)'); +assert.sameValue(a.indexOf(new Object()), -1, 'a.indexOf(new Object())'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-2-15.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-2-15.js index c192a52a8..5ccbbf084 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-2-15.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-2-15.js @@ -4,30 +4,19 @@ /*--- es5id: 15.4.4.14-2-15 description: Array.prototype.indexOf - 'length' is property of the global object -includes: - - runTestCase.js - - fnGlobalObject.js +includes: [fnGlobalObject.js] ---*/ -function testcase() { var targetObj = {}; - try { + var oldLen = fnGlobalObject().length; fnGlobalObject().length = 2; fnGlobalObject()[1] = targetObj; - if (Array.prototype.indexOf.call(fnGlobalObject(), targetObj) !== 1) { - return false; - } + +assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), 1, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)'); fnGlobalObject()[1] = {}; fnGlobalObject()[2] = targetObj; - return Array.prototype.indexOf.call(fnGlobalObject(), targetObj) === -1; - } finally { - delete fnGlobalObject()[1]; - delete fnGlobalObject()[2]; - fnGlobalObject().length = oldLen; - } - } -runTestCase(testcase); +assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), -1, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-3-22.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-3-22.js index 836185e20..8c37bec86 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-3-22.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-3-22.js @@ -7,11 +7,8 @@ description: > Array.prototype.indexOf throws TypeError exception when 'length' is an object with toString and valueOf methods that don�t return primitive values -includes: [runTestCase.js] ---*/ -function testcase() { - var toStringAccessed = false; var valueOfAccessed = false; @@ -29,11 +26,9 @@ function testcase() { } }; - try { +assert.throws(TypeError, function() { Array.prototype.indexOf.call(obj); - return false; - } catch (e) { - return toStringAccessed && valueOfAccessed; - } - } -runTestCase(testcase); +}); + +assert(toStringAccessed, 'toStringAccessed'); +assert(valueOfAccessed, 'valueOfAccessed'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-1.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-1.js index d56c7c1b8..4159d5b91 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-1.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-1.js @@ -4,14 +4,9 @@ /*--- es5id: 15.4.4.14-5-1 description: Array.prototype.indexOf when fromIndex is string -includes: [runTestCase.js] ---*/ -function testcase() { var a = [1,2,1,2,1,2]; - if (a.indexOf(2,"2") === 3 && // "2" resolves to 2 - a.indexOf(2,"one") === 1) { // "one" resolves to 0 - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(2,"2"), 3, '"2" resolves to 2'); +assert.sameValue(a.indexOf(2,"one"), 1, '"one" resolves to 0'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-2.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-2.js index 96daf206f..40c7dac87 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-2.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-2.js @@ -4,15 +4,10 @@ /*--- es5id: 15.4.4.14-5-2 description: Array.prototype.indexOf when fromIndex is floating point number -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(1,2,3); - if (a.indexOf(3,0.49) === 2 && // 0.49 resolves to 0 - a.indexOf(1,0.51) === 0 && // 0.51 resolves to 0 - a.indexOf(1,1.51) === -1) { // 1.01 resolves to 1 - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(3,0.49), 2, '0.49 resolves to 0'); +assert.sameValue(a.indexOf(1,0.51), 0, '0.51 resolves to 0'); +assert.sameValue(a.indexOf(1,1.51), -1, '1.51 resolves to 1'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-24.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-24.js index bb3f7774d..a414dc122 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-24.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-24.js @@ -7,11 +7,8 @@ description: > Array.prototype.indexOf throws TypeError exception when value of 'fromIndex' is an object with toString and valueOf methods that don�t return primitive values -includes: [runTestCase.js] ---*/ -function testcase() { - var toStringAccessed = false; var valueOfAccessed = false; var fromIndex = { @@ -26,11 +23,9 @@ function testcase() { } }; - try { +assert.throws(TypeError, function() { [0, true].indexOf(true, fromIndex); - return false; - } catch (e) { - return toStringAccessed && valueOfAccessed; - } - } -runTestCase(testcase); +}); + +assert(toStringAccessed, 'toStringAccessed'); +assert(valueOfAccessed, 'valueOfAccessed'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-26.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-26.js index 1d52bad07..de49b5837 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-26.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-26.js @@ -6,10 +6,8 @@ es5id: 15.4.4.14-5-26 description: > Array.prototype.indexOf - side effects produced by step 2 are visible when an exception occurs -includes: [runTestCase.js] ---*/ -function testcase() { var stepTwoOccurs = false; var stepFiveOccurs = false; @@ -33,11 +31,7 @@ function testcase() { } }; - try { Array.prototype.indexOf.call(obj, undefined, fromIndex); - return stepTwoOccurs && stepFiveOccurs; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert(stepTwoOccurs, 'stepTwoOccurs !== true'); +assert(stepFiveOccurs, 'stepFiveOccurs !== true'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-27.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-27.js index b48daf47e..e09ca5857 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-27.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-27.js @@ -6,10 +6,8 @@ es5id: 15.4.4.14-5-27 description: > Array.prototype.indexOf - side effects produced by step 3 are visible when an exception occurs -includes: [runTestCase.js] ---*/ -function testcase() { var stepThreeOccurs = false; var stepFiveOccurs = false; @@ -37,11 +35,7 @@ function testcase() { } }; - try { Array.prototype.indexOf.call(obj, undefined, fromIndex); - return stepThreeOccurs && stepFiveOccurs; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert(stepThreeOccurs, 'stepThreeOccurs !== true'); +assert(stepFiveOccurs, 'stepFiveOccurs !== true'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-3.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-3.js index 540410d8a..07634100d 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-3.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-3.js @@ -4,14 +4,9 @@ /*--- es5id: 15.4.4.14-5-3 description: Array.prototype.indexOf when fromIndex is boolean -includes: [runTestCase.js] ---*/ -function testcase() { var a = [1,2,3]; - if (a.indexOf(1,true) === -1 && // true resolves to 1 - a.indexOf(1,false) === 0 ) { // false resolves to 0 - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(1,true), -1, 'true resolves to 1'); +assert.sameValue(a.indexOf(1,false), 0, 'false resolves to 0'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-4.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-4.js index 92c6e4519..53a914ea2 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-4.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-4.js @@ -4,13 +4,9 @@ /*--- es5id: 15.4.4.14-5-4 description: Array.prototype.indexOf returns 0 if fromIndex is 'undefined' -includes: [runTestCase.js] ---*/ -function testcase() { var a = [1,2,3]; - if (a.indexOf(1,undefined) === 0) { // undefined resolves to 0 - return true; - } - } -runTestCase(testcase); + +// undefined resolves to 0 +assert.sameValue(a.indexOf(1,undefined), 0, 'a.indexOf(1,undefined)'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-5.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-5.js index e35c5d347..c3bdaaa83 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-5.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-5-5.js @@ -4,13 +4,9 @@ /*--- es5id: 15.4.4.14-5-5 description: Array.prototype.indexOf returns 0 if fromIndex is null -includes: [runTestCase.js] ---*/ -function testcase() { var a = [1,2,3]; - if (a.indexOf(1,null) === 0 ) { // null resolves to 0 - return true; - } - } -runTestCase(testcase); + +// null resolves to 0 +assert.sameValue(a.indexOf(1,null), 0, 'a.indexOf(1,null)'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-1.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-1.js index 8f480f2dc..fd75573cf 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-1.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-1.js @@ -4,17 +4,11 @@ /*--- es5id: 15.4.4.14-9-1 description: Array.prototype.indexOf must return correct index (boolean) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return true}}; var _false = false; var a = [obj,"true", undefined,0,_false,null,1,"str",0,1,true,false,true,false]; - if (a.indexOf(true) === 10 && //a[10]=true - a.indexOf(false) === 4) //a[4] =_false - { - return true; - } - } -runTestCase(testcase); + + assert.sameValue(a.indexOf(true), 10, 'a[10]=true'); + assert.sameValue(a.indexOf(false), 4, 'a[4] =_false'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-10.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-10.js index 41d62527c..ec885dadd 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-10.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-10.js @@ -7,15 +7,9 @@ info: > and hence NaNs could be found using indexOf * es5id: 15.4.4.14-9-10 description: Array.prototype.indexOf must return correct index (NaN) -includes: [runTestCase.js] ---*/ -function testcase() { var _NaN = NaN; var a = new Array("NaN",undefined,0,false,null,{toString:function (){return NaN}},"false",_NaN,NaN); - if (a.indexOf(NaN) === -1) // NaN is equal to nothing, including itself. - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(NaN), -1, 'NaN is equal to nothing, including itself.'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-2.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-2.js index 1a9195d83..a6f57a9a1 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-2.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-2.js @@ -4,20 +4,14 @@ /*--- es5id: 15.4.4.14-9-2 description: Array.prototype.indexOf must return correct index (Number) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return 0}}; var one = 1; var _float = -(4/3); var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3)); - if (a.indexOf(-(4/3)) === 14 && // a[14]=_float===-(4/3) - a.indexOf(0) === 7 && // a[7] = +0, 0===+0 - a.indexOf(-0) === 7 && // a[7] = +0, -0===+0 - a.indexOf(1) === 10 ) // a[10] =one=== 1 - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(-(4/3)), 14, 'a[14]=_float===-(4/3)'); +assert.sameValue(a.indexOf(0), 7, 'a[7] = +0, 0===+0'); +assert.sameValue(a.indexOf(-0), 7, 'a[7] = +0, -0===+0'); +assert.sameValue(a.indexOf(1), 10, 'a[10] =one=== 1'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-3.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-3.js index a12835441..7fbb3f76c 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-3.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-3.js @@ -4,16 +4,10 @@ /*--- es5id: 15.4.4.14-9-3 description: Array.prototype.indexOf must return correct index(string) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return "false"}}; var szFalse = "false"; var a = new Array("false1",undefined,0,false,null,1,obj,0,szFalse, "false"); - if (a.indexOf("false") === 8) //a[8]=szFalse - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf("false"), 8, 'a[8]=szFalse'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-4.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-4.js index dc31bba67..79c1bfbdc 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-4.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-4.js @@ -4,17 +4,11 @@ /*--- es5id: 15.4.4.14-9-4 description: Array.prototype.indexOf must return correct index(undefined) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return undefined;}}; var _undefined1 = undefined; var _undefined2; var a = new Array(true,0,false,null,1,"undefined",obj,1,_undefined2,_undefined1,undefined); - if (a.indexOf(undefined) === 8) //a[8]=_undefined2 - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(undefined), 8, 'a[8]=_undefined2'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-5.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-5.js index 4129a36d2..770a1e61a 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-5.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-5.js @@ -4,17 +4,11 @@ /*--- es5id: 15.4.4.14-9-5 description: Array.prototype.indexOf must return correct index (Object) -includes: [runTestCase.js] ---*/ -function testcase() { var obj1 = {toString:function (){return "false"}}; var obj2 = {toString:function (){return "false"}}; var obj3 = obj1; var a = new Array(false,undefined,0,false,null,{toString:function (){return "false"}},"false",obj2,obj1,obj3); - if (a.indexOf(obj3) === 8) //a[8] = obj1; - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(obj3), 8, 'a[8] = obj1'); diff --git a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-6.js b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-6.js index 1a30df03e..2723ca3b5 100644 --- a/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-6.js +++ b/test/built-ins/Array/prototype/indexOf/15.4.4.14-9-6.js @@ -4,16 +4,10 @@ /*--- es5id: 15.4.4.14-9-6 description: Array.prototype.indexOf must return correct index(null) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return null}}; var _null = null; var a = new Array(true,undefined,0,false,_null,1,"str",0,1,obj,true,false,null); - if (a.indexOf(null) === 4 ) //a[4]=_null - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.indexOf(null), 4, 'a[4]=_null'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-2-15.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-2-15.js index 50f4d6bae..c6e5c55e5 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-2-15.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-2-15.js @@ -6,30 +6,19 @@ es5id: 15.4.4.15-2-15 description: > Array.prototype.lastIndexOf - 'length' is property of the global object -includes: - - runTestCase.js - - fnGlobalObject.js +includes: [fnGlobalObject.js] ---*/ -function testcase() { var targetObj = {}; - try { + var oldLen = fnGlobalObject().length; fnGlobalObject().length = 2; fnGlobalObject()[1] = targetObj; - if (Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) !== 1) { - return false; - } + +assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), 1); fnGlobalObject()[1] = {}; fnGlobalObject()[2] = targetObj; - return Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) === -1; - } finally { - delete fnGlobalObject()[1]; - delete fnGlobalObject()[2]; - fnGlobalObject().length = oldLen; - } - } -runTestCase(testcase); +assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), -1); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-22.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-22.js index 0d3e63509..859db8d19 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-22.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-22.js @@ -7,11 +7,8 @@ description: > Array.prototype.lastIndexOf throws TypeError exception when 'length' is an object with toString and valueOf methods that don�t return primitive values -includes: [runTestCase.js] ---*/ -function testcase() { - var toStringAccessed = false; var valueOfAccessed = false; @@ -30,11 +27,9 @@ function testcase() { } }; - try { +assert.throws(TypeError, function() { Array.prototype.lastIndexOf.call(obj, true); - return false; - } catch (e) { - return toStringAccessed && valueOfAccessed; - } - } -runTestCase(testcase); +}); + +assert(toStringAccessed, 'toStringAccessed'); +assert(valueOfAccessed, 'valueOfAccessed'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-28.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-28.js index 15dbb8f1b..f5e6829a4 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-28.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-3-28.js @@ -6,11 +6,8 @@ es5id: 15.4.4.15-3-28 description: > Array.prototype.lastIndexOf - value of 'length' is boundary value (2^32) -includes: [runTestCase.js] ---*/ -function testcase() { - var targetObj = {}; var obj = { 0: targetObj, @@ -19,6 +16,4 @@ function testcase() { length: 4294967296 }; - return Array.prototype.lastIndexOf.call(obj, targetObj) === 4294967295; //verify length is 4294967296 finally - } -runTestCase(testcase); +assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), 4294967295, 'verify length is 4294967296 finally'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-1.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-1.js index a151520a9..0b38e59b1 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-1.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-1.js @@ -4,14 +4,9 @@ /*--- es5id: 15.4.4.15-5-1 description: Array.prototype.lastIndexOf when fromIndex is string -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(0,1,1); - if (a.lastIndexOf(1,"1") === 1 && // "1" resolves to 1 - a.lastIndexOf(1,"one") === -1) { // NaN string resolves to 0 - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(1,"1"), 1, '"1" resolves to 1'); +assert.sameValue(a.lastIndexOf(1,"one"), -1, 'NaN string resolves to 01'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-2.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-2.js index 68ba3657c..aba55fc82 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-2.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-2.js @@ -4,15 +4,10 @@ /*--- es5id: 15.4.4.15-5-2 description: Array.prototype.lastIndexOf when fromIndex is floating point number -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(1,2,1); - if (a.lastIndexOf(2,1.49) === 1 && // 1.49 resolves to 1 - a.lastIndexOf(2,0.51) === -1 && // 0.51 resolves to 0 - a.lastIndexOf(1,0.51) === 0){ // 0.51 resolves to 0 - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(2,1.49), 1, '1.49 resolves to 1'); +assert.sameValue(a.lastIndexOf(2,0.51), -1, '0.51 resolves to 0'); +assert.sameValue(a.lastIndexOf(1,0.51), 0, '0.51 resolves to 0'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-24.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-24.js index e2c7c4964..b67e73d4e 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-24.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-24.js @@ -7,11 +7,8 @@ description: > Array.prototype.lastIndexOf throws TypeError exception when value of 'fromIndex' is an object that both toString and valueOf methods than don't return primitive value -includes: [runTestCase.js] ---*/ -function testcase() { - var toStringAccessed = false; var valueOfAccessed = false; @@ -27,11 +24,9 @@ function testcase() { } }; - try { +assert.throws(TypeError, function() { [0, null].lastIndexOf(null, fromIndex); - return false; - } catch (e) { - return toStringAccessed && valueOfAccessed; - } - } -runTestCase(testcase); +}); + +assert(toStringAccessed, 'toStringAccessed'); +assert(valueOfAccessed, 'valueOfAccessed'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-26.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-26.js index 276d540c7..b46e57f36 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-26.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-26.js @@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-26 description: > Array.prototype.lastIndexOf - side effects produced by step 2 are visible when an exception occurs -includes: [runTestCase.js] ---*/ -function testcase() { - var stepTwoOccurs = false; var stepFiveOccurs = false; var obj = {}; @@ -33,11 +30,7 @@ function testcase() { } }; - try { Array.prototype.lastIndexOf.call(obj, undefined, fromIndex); - return stepTwoOccurs && stepFiveOccurs; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert(stepTwoOccurs, 'stepTwoOccurs !== true'); +assert(stepFiveOccurs, 'stepFiveOccurs !== true'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-27.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-27.js index 838f3d003..79d50042f 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-27.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-27.js @@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-27 description: > Array.prototype.lastIndexOf - side effects produced by step 3 are visible when an exception occurs -includes: [runTestCase.js] ---*/ -function testcase() { - var stepThreeOccurs = false; var stepFiveOccurs = false; @@ -38,11 +35,7 @@ function testcase() { } }; - try { Array.prototype.lastIndexOf.call(obj, undefined, fromIndex); - return stepThreeOccurs && stepFiveOccurs; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert(stepThreeOccurs, 'stepThreeOccurs !== true'); +assert(stepFiveOccurs, 'stepFiveOccurs !== true'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-3.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-3.js index df0c43001..8f17e00a5 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-3.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-3.js @@ -4,14 +4,9 @@ /*--- es5id: 15.4.4.15-5-3 description: Array.prototype.lastIndexOf when fromIndex is boolean -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(1,2,1); - if (a.lastIndexOf(2,true) === 1 && // true resolves to 1 - a.lastIndexOf(2,false) === -1 ) { // false resolves to 0 - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(2,true), 1, 'true resolves to 1'); +assert.sameValue(a.lastIndexOf(2,false), -1, 'false resolves to 0'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-4.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-4.js index 8f41d59c0..3dca6d6f9 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-4.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-4.js @@ -4,15 +4,11 @@ /*--- es5id: 15.4.4.15-5-4 description: Array.prototype.lastIndexOf when fromIndex is undefined -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(1,2,1); - if (a.lastIndexOf(2,undefined) === -1 && - a.lastIndexOf(1,undefined) === 0 && - a.lastIndexOf(1) === 2) { // undefined resolves to 0, no second argument resolves to len - return true; - } - } -runTestCase(testcase); + +// undefined resolves to 0, no second argument resolves to len +assert.sameValue(a.lastIndexOf(2,undefined), -1, 'a.lastIndexOf(2,undefined)'); +assert.sameValue(a.lastIndexOf(1,undefined), 0, 'a.lastIndexOf(1,undefined)'); +assert.sameValue(a.lastIndexOf(1), 2, 'a.lastIndexOf(1)'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-5.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-5.js index 1417d08aa..0b3066dd7 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-5.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-5.js @@ -4,13 +4,10 @@ /*--- es5id: 15.4.4.15-5-5 description: Array.prototype.lastIndexOf when fromIndex is null -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(1,2,1); - if (a.lastIndexOf(2,null) === -1 && a.lastIndexOf(1,null) === 0) { // null resolves to 0 - return true; - } - } -runTestCase(testcase); + +// null resolves to 0 +assert.sameValue(a.lastIndexOf(2,null), -1, 'a.lastIndexOf(2,null)'); +assert.sameValue(a.lastIndexOf(1,null), 0, 'a.lastIndexOf(1,null)'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-7.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-7.js index 621c9d9a9..c5ff0e677 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-7.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-7.js @@ -6,12 +6,7 @@ es5id: 15.4.4.15-5-7 description: > Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is 0) -includes: [runTestCase.js] ---*/ -function testcase() { - - return [0, 100].lastIndexOf(100, 0) === -1 && // verify fromIndex is not more than 0 - [200, 0].lastIndexOf(200, 0) === 0; // verify fromIndex is not less than 0 - } -runTestCase(testcase); +assert.sameValue([0, 100].lastIndexOf(100, 0), -1, 'verify fromIndex is not more than 0'); +assert.sameValue([200, 0].lastIndexOf(200, 0), 0, 'verify fromIndex is not less than 0'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-1.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-1.js index 2aa728955..4bd0f4d09 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-1.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-1.js @@ -4,17 +4,11 @@ /*--- es5id: 15.4.4.15-8-1 description: Array.prototype.lastIndexOf must return correct index(boolean) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return true}}; var _false = false; var a = new Array(false,true,false,obj,_false,true,"true", undefined,0,null,1,"str",0,1); - if (a.lastIndexOf(true) === 5 && //a[5]=true - a.lastIndexOf(false) === 4) //a[4] =_false - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(true), 5, 'a[5]=true'); +assert.sameValue(a.lastIndexOf(false), 4, 'a[4] =_false'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-10.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-10.js index fa3db84c6..fdeb4532e 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-10.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-10.js @@ -7,15 +7,9 @@ info: > and hence NaNs could be found using lastIndexOf * es5id: 15.4.4.15-8-10 description: Array.prototype.lastIndexOf must return correct index (NaN) -includes: [runTestCase.js] ---*/ -function testcase() { var _NaN = NaN; var a = new Array("NaN",_NaN,NaN, undefined,0,false,null,{toString:function (){return NaN}},"false"); - if (a.lastIndexOf(NaN) === -1) // NaN matches nothing, not even itself - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(NaN), -1, 'NaN matches nothing, not even itself'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-2.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-2.js index e749deb93..680c9db64 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-2.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-2.js @@ -4,20 +4,14 @@ /*--- es5id: 15.4.4.15-8-2 description: Array.prototype.lastIndexOf must return correct index(Number) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {toString:function (){return 0}}; var one = 1; var _float = -(4/3); var a = new Array(+0,true,0,-0, false,undefined,null,"0",obj, _float,-(4/3),-1.3333333333333,"str",one, 1, false); - if (a.lastIndexOf(-(4/3)) === 10 && // a[10]=-(4/3) - a.lastIndexOf(0) === 3 && // a[3] = -0, but using === -0 and 0 are equal - a.lastIndexOf(-0) ===3 && // a[3] = -0 - a.lastIndexOf(1) === 14 ) // a[14] = 1 - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(-(4/3)), 10, 'a[10]=-(4/3)'); +assert.sameValue(a.lastIndexOf(0), 3, 'a[3] = -0, but using === -0 and 0 are equal'); +assert.sameValue(a.lastIndexOf(-0), 3, 'a[3] = -0'); +assert.sameValue(a.lastIndexOf(1), 14, 'a[14] = 1'); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-27.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-27.js index f28fa9d06..b43f2cc47 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-27.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-27.js @@ -7,17 +7,14 @@ description: > Array.prototype.lastIndexOf applied to Arguments object which implements its own property get method (number of arguments is greater than number of parameters) -includes: [runTestCase.js] ---*/ -function testcase() { +var func = function (a, b) { + assert.sameValue(Array.prototype.lastIndexOf.call(arguments, arguments[0]), 2); + assert.sameValue(Array.prototype.lastIndexOf.call(arguments, arguments[3]), 3); + assert.sameValue(Array.prototype.lastIndexOf.call(arguments, arguments[4]), -1); +}; - var func = function (a, b) { - return 2 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) && - 3 === Array.prototype.lastIndexOf.call(arguments, arguments[3]) && - -1 === Array.prototype.lastIndexOf.call(arguments, arguments[4]); - }; - - return func(0, arguments, 0, Object.prototype); - } -runTestCase(testcase); +(function() { + func(0, arguments, 0, Object.prototype); +})(); diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-9-1.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-9-1.js index 56e8f6149..c23ef0dd5 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-9-1.js +++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-9-1.js @@ -4,10 +4,8 @@ /*--- es5id: 15.4.4.15-9-1 description: Array.prototype.lastIndexOf returns -1 for elements not present -includes: [runTestCase.js] ---*/ -function testcase() { var a = new Array(); a[100] = 1; a[99999] = ""; @@ -15,21 +13,15 @@ function testcase() { a[5555] = 5.5; a[123456] = "str"; a[5] = 1E+309; - if (a.lastIndexOf(1) !== 100 || - a.lastIndexOf("") !== 99999 || - a.lastIndexOf("str") !== 123456 || - a.lastIndexOf(5.5) !== 5555 || - a.lastIndexOf(1E+309) !== 5 ) - { - return false; - } - if (a.lastIndexOf(true) === -1 && - a.lastIndexOf(5) === -1 && - a.lastIndexOf("str1") === -1 && - a.lastIndexOf(null) === -1 && - a.lastIndexOf(new Object()) === -1 ) - { - return true; - } - } -runTestCase(testcase); + +assert.sameValue(a.lastIndexOf(1), 100, 'a.lastIndexOf(1)'); +assert.sameValue(a.lastIndexOf(""), 99999, 'a.lastIndexOf("")'); +assert.sameValue(a.lastIndexOf("str"), 123456, 'a.lastIndexOf("str")'); +assert.sameValue(a.lastIndexOf(5.5), 5555, 'a.lastIndexOf(5.5)'); +assert.sameValue(a.lastIndexOf(1E+309), 5, 'a.lastIndexOf(1E+309)'); + +assert.sameValue(a.lastIndexOf(true), -1, 'a.lastIndexOf(true)'); +assert.sameValue(a.lastIndexOf(5), -1, 'a.lastIndexOf(5)'); +assert.sameValue(a.lastIndexOf("str1"), -1, 'a.lastIndexOf("str1")'); +assert.sameValue(a.lastIndexOf(null), -1, 'a.lastIndexOf(null)'); +assert.sameValue(a.lastIndexOf(new Object()), -1, 'a.lastIndexOf(new Object())'); diff --git a/test/built-ins/Array/prototype/map/15.4.4.19-4-10.js b/test/built-ins/Array/prototype/map/15.4.4.19-4-10.js index e6a883657..f68465873 100644 --- a/test/built-ins/Array/prototype/map/15.4.4.19-4-10.js +++ b/test/built-ins/Array/prototype/map/15.4.4.19-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.19-4-10 description: > Array.prototype.map - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.map.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/map/15.4.4.19-4-11.js b/test/built-ins/Array/prototype/map/15.4.4.19-4-11.js index 8ebf4a8be..1c7334a52 100644 --- a/test/built-ins/Array/prototype/map/15.4.4.19-4-11.js +++ b/test/built-ins/Array/prototype/map/15.4.4.19-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.19-4-11 description: > Array.prototype.map - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.map.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-1.js b/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-1.js index 6aa15e999..75cb39c70 100644 --- a/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-1.js +++ b/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-1.js @@ -6,10 +6,7 @@ es5id: 15.4.4.19-8-c-iii-1 description: > Array.prototype.map - getOwnPropertyDescriptor(all true) of returned array element -includes: [runTestCase.js] ---*/ - -function testcase() { function callbackfn(val, idx, obj){ if(val % 2) @@ -19,14 +16,12 @@ function testcase() { } var srcArr = [0,1,2,3,4]; var resArr = srcArr.map(callbackfn); - if (resArr.length > 0){ - var desc = Object.getOwnPropertyDescriptor(resArr, 1) - if(desc.value === 3 && //srcArr[1] = 2*1+1 = 3 - desc.writable === true && - desc.enumerable === true && - desc.configurable === true){ - return true; - } - } - } -runTestCase(testcase); + +assert(resArr.length > 0, 'resArr.length > 0'); + +var desc = Object.getOwnPropertyDescriptor(resArr, 1); + +assert.sameValue(desc.value, 3, 'desc.value'); //srcArr[1] = 2*1+1 = 3 +assert.sameValue(desc.writable, true, 'desc.writable'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); diff --git a/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-3.js b/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-3.js index 622ff378b..5dd26a8fd 100644 --- a/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-3.js +++ b/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-3.js @@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-iii-3 description: > Array.prototype.map - value of returned array element can be overwritten -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj) { return 11; } @@ -18,12 +15,7 @@ function testcase() { var obj = { 0: 11, 1: 9, length: 2 }; var newArr = Array.prototype.map.call(obj, callbackfn); - try { var tempVal = newArr[1]; newArr[1] += 1; - return newArr[1] !== tempVal; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert.notSameValue(newArr[1], tempVal, 'newArr[1]'); diff --git a/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-5.js b/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-5.js index 2d04906b5..bd70709dd 100644 --- a/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-5.js +++ b/test/built-ins/Array/prototype/map/15.4.4.19-8-c-iii-5.js @@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-iii-5 description: > Array.prototype.map - value of returned array element can be changed or deleted -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(val, idx, obj) { return true; } @@ -18,12 +15,8 @@ function testcase() { var obj = { 0: 11, 1: 9, length: 2 }; var newArr = Array.prototype.map.call(obj, callbackfn); - try { var tempVal = newArr[1]; delete newArr[1]; - return tempVal !== undefined && newArr[1] === undefined; - } catch (ex) { - return false; - } - } -runTestCase(testcase); + +assert.notSameValue(tempVal, undefined, 'tempVal'); +assert.sameValue(newArr[1], undefined, 'newArr[1]'); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-4-10.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-4-10.js index 20e18205e..5b665af15 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-4-10.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.21-4-10 description: > Array.prototype.reduce - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduce.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-4-11.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-4-11.js index 2b77f84c0..3c6dce4a6 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-4-11.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.21-4-11 description: > Array.prototype.reduce - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduce.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-5-12.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-5-12.js index 8b1dbfc22..8228c57d2 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-5-12.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-5-12.js @@ -6,11 +6,8 @@ es5id: 15.4.4.21-5-12 description: > Array.prototype.reduce - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(prevVal, curVal, idx, obj) { return (curVal > 10); } @@ -19,16 +16,11 @@ function testcase() { Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduce.call(obj, callbackfn); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-5-13.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-5-13.js index 09e577207..f2b22add7 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-5-13.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-5-13.js @@ -6,11 +6,8 @@ es5id: 15.4.4.21-5-13 description: > Array.prototype.reduce - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(prevVal, curVal, idx, obj) { return (curVal > 10); } @@ -21,19 +18,13 @@ function testcase() { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - - try { +assert.throws(Test262Error, function() { Array.prototype.reduce.call(obj, callbackfn); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-1.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-1.js index 911f588e6..453ce6bf4 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-1.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-1.js @@ -4,11 +4,8 @@ /*--- es5id: 15.4.4.21-8-b-1 description: Array.prototype.reduce - no observable effects occur if 'len' is 0 -includes: [runTestCase.js] ---*/ -function testcase() { - var accessed = false; var obj = { length: 0 }; @@ -21,11 +18,8 @@ function testcase() { configurable: true }); - try { +assert.throws(TypeError, function() { Array.prototype.reduce.call(obj, function () { }); - return false; - } catch (ex) { - return !accessed; - } - } -runTestCase(testcase); +}); + +assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-7.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-7.js index 084a2c049..a74acf7bd 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-7.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-7.js @@ -6,25 +6,17 @@ es5id: 15.4.4.21-8-c-7 description: > Array.prototype.reduce - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = {}; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduce.call(obj, function () { }); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-8.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-8.js index 019b6eddf..689579062 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-8.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-c-8.js @@ -6,29 +6,21 @@ es5id: 15.4.4.21-8-c-8 description: > Array.prototype.reduce - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = {}; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduce.call(obj, function () { }); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-3.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-3.js index 027029012..b92e59ff2 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-3.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-3.js @@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-3 description: > Array.prototype.reduce doesn't visit deleted elements in array after the call -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(prevVal, curVal, idx, obj) { delete arr[3]; @@ -19,8 +16,6 @@ function testcase() { } var arr = ['1',2,3,4,5]; - if(arr.reduce(callbackfn) === "123" ) // two elements deleted - return true; - - } -runTestCase(testcase); + +// two elements deleted +assert.sameValue(arr.reduce(callbackfn), "123", 'arr.reduce(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-6.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-6.js index aa3c35f04..709c1db2f 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-6.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-6.js @@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-6 description: > Array.prototype.reduce visits deleted element in array after the call when same index is also present in prototype -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(prevVal, curVal, idx, obj) { delete arr[3]; @@ -23,8 +20,5 @@ function testcase() { var res = arr.reduce(callbackfn); delete Array.prototype[4]; - if(res === "1235" ) //one element acually deleted - return true; - - } -runTestCase(testcase); +//one element acually deleted +assert.sameValue(res, "1235", 'res'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js index b19c529f7..fe98b763d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.22-4-10 description: > Array.prototype.reduceRight - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js index 3927b9dd6..49a1c44b7 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.22-4-11 description: > Array.prototype.reduceRight - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js index 113fa4097..84adaf4ef 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js @@ -6,25 +6,17 @@ es5id: 15.4.4.22-5-12 description: > Array.prototype.reduceRight - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, function () { }); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js index 4f5873aaa..d0f06ac91 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js @@ -6,29 +6,21 @@ es5id: 15.4.4.22-5-13 description: > Array.prototype.reduceRight - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, function () { }); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js index 646150b2b..ac7c7dd05 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js @@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-1 description: > Array.prototype.reduceRight - no observable effects occur if 'len' is 0 -includes: [runTestCase.js] ---*/ -function testcase() { - var accessed = false; var obj = { length: 0 }; @@ -23,11 +20,8 @@ function testcase() { configurable: true }); - try { +assert.throws(TypeError, function() { Array.prototype.reduceRight.call(obj, function () { }); - return false; - } catch (ex) { - return !accessed; - } - } -runTestCase(testcase); +}); + +assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js index 7c9c24c94..f5a7c93c3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js @@ -6,25 +6,17 @@ es5id: 15.4.4.22-8-c-7 description: > Array.prototype.reduceRight - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = {}; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, function () { }); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js index c83379d5d..d049897bd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js @@ -6,29 +6,21 @@ es5id: 15.4.4.22-8-c-8 description: > Array.prototype.reduceRight - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = {}; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, function () { }); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js index eafe439e8..e7e827c77 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js @@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-3 description: > Array.prototype.reduceRight doesn't consider unvisited deleted elements in array after the call -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(prevVal, curVal, idx, obj) { delete arr[1]; @@ -19,8 +16,6 @@ function testcase() { } var arr = ['1',2,3,4,5]; - if(arr.reduceRight(callbackfn) === "121" ) // two elements deleted - return true; - - } -runTestCase(testcase); + +// two elements deleted +assert.sameValue(arr.reduceRight(callbackfn), "121", 'arr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js index 435f5ebc9..dccd40ec5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js @@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-6 description: > Array.prototype.reduceRight visits deleted element in array after the call when same index is also present in prototype -includes: [runTestCase.js] ---*/ -function testcase() { - function callbackfn(prevVal, curVal, idx, obj) { delete arr[1]; @@ -22,8 +19,5 @@ function testcase() { var res = arr.reduceRight(callbackfn); delete Array.prototype[2]; - if(res === "151" ) //one element deleted - return true; - - } -runTestCase(testcase); +//one element deleted +assert.sameValue(res, "151", 'res'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js index 6eeac93a3..3e31b8ffa 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js @@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-c-i-33 description: > Array.prototype.reduceRight - unnhandled exceptions happened in getter terminate iteration on an Array -includes: [runTestCase.js] ---*/ -function testcase() { - var accessed = false; function callbackfn(prevVal, curVal, idx, obj) { if (idx <= 1) { @@ -22,16 +19,13 @@ function testcase() { Object.defineProperty(arr, "1", { get: function () { - throw new RangeError("unhandle exception happened in getter"); + throw new Test262Error("unhandle exception happened in getter"); }, configurable: true }); - try { +assert.throws(Test262Error, function() { arr.reduceRight(callbackfn, "initialValue"); - return true; - } catch (ex) { - return (ex instanceof RangeError) && !accessed; - } - } -runTestCase(testcase); +}); + +assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js index 8315b75ce..f4d88297e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js @@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-c-ii-7 description: > Array.prototype.reduceRight - unhandled exceptions happened in callbackfn terminate iteration -includes: [runTestCase.js] ---*/ -function testcase() { - var accessed = false; function callbackfn(prevVal, curVal, idx, obj) { @@ -18,17 +15,14 @@ function testcase() { accessed = true; } if (idx === 10) { - throw new Error("Exception occurred in callbackfn"); + throw new Test262Error("Exception occurred in callbackfn"); } } var obj = { 0: 11, 4: 10, 10: 8, length: 20 }; - try { +assert.throws(Test262Error, function() { Array.prototype.reduceRight.call(obj, callbackfn, 1); - return false; - } catch (ex) { - return !accessed; - } - } -runTestCase(testcase); +}); + +assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/some/15.4.4.17-4-10.js b/test/built-ins/Array/prototype/some/15.4.4.17-4-10.js index 4b27b4d5c..e20cbf01c 100644 --- a/test/built-ins/Array/prototype/some/15.4.4.17-4-10.js +++ b/test/built-ins/Array/prototype/some/15.4.4.17-4-10.js @@ -6,25 +6,17 @@ es5id: 15.4.4.17-4-10 description: > Array.prototype.some - the exception is not thrown if exception was thrown by step 2 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { - throw new SyntaxError(); + throw new Test262Error(); }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.some.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/some/15.4.4.17-4-11.js b/test/built-ins/Array/prototype/some/15.4.4.17-4-11.js index dd5b4e379..2d8747ff5 100644 --- a/test/built-ins/Array/prototype/some/15.4.4.17-4-11.js +++ b/test/built-ins/Array/prototype/some/15.4.4.17-4-11.js @@ -6,29 +6,21 @@ es5id: 15.4.4.17-4-11 description: > Array.prototype.some - the exception is not thrown if exception was thrown by step 3 -includes: [runTestCase.js] ---*/ -function testcase() { - var obj = { 0: 11, 1: 12 }; Object.defineProperty(obj, "length", { get: function () { return { toString: function () { - throw new SyntaxError(); + throw new Test262Error(); } }; }, configurable: true }); - try { +assert.throws(Test262Error, function() { Array.prototype.some.call(obj, undefined); - return false; - } catch (ex) { - return !(ex instanceof TypeError); - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Array/prototype/some/15.4.4.17-5-1.js b/test/built-ins/Array/prototype/some/15.4.4.17-5-1.js index 6a72406c2..b33dd69f2 100644 --- a/test/built-ins/Array/prototype/some/15.4.4.17-5-1.js +++ b/test/built-ins/Array/prototype/some/15.4.4.17-5-1.js @@ -5,10 +5,9 @@ es5id: 15.4.4.17-5-1 description: Array.prototype.some - thisArg is passed flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase() { +(function() { this._15_4_4_17_5_1 = false; var _15_4_4_17_5_1 = true; @@ -16,6 +15,6 @@ function testcase() { return this._15_4_4_17_5_1; } var arr = [1]; - return !arr.some(callbackfn); - } -runTestCase(testcase); + +assert.sameValue(arr.some(callbackfn), false, 'arr.some(callbackfn)'); +})(); diff --git a/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js b/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js index c26fdbbe4..bb2f0c928 100644 --- a/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js +++ b/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js @@ -7,28 +7,21 @@ description: > Date.prototype.toISOString - RangeError is not thrown when value of date is Date(1970, 0, -99999999, 0, 0, 0, 1), the time zone is UTC(0) -includes: [runTestCase.js] ---*/ -function testcase() { var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); var date, dateStr; if (timeZoneMinutes > 0) { date = new Date(1970, 0, -99999999, 0, 0, 0, 1); - try { + assert.throws(RangeError, function() { date.toISOString(); - return false; - } catch (e) { - return e instanceof RangeError; - } + }); } else { date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes + 60, 0, 1); dateStr = date.toISOString(); - return dateStr[dateStr.length - 1] === "Z"; + assert.sameValue(dateStr[dateStr.length - 1], "Z"); } - } -runTestCase(testcase); diff --git a/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js b/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js index 86882fa91..5840e5daa 100644 --- a/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js +++ b/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js @@ -7,24 +7,17 @@ description: > Date.prototype.toISOString - RangeError is thrown when value of date is Date(1970, 0, 100000001, 0, 0, 0, 1), the time zone is UTC(0) -includes: [runTestCase.js] ---*/ -function testcase() { var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); var date, dateStr; - try { + +assert.throws(RangeError, function() { if (timeZoneMinutes > 0) { date = new Date(1970, 0, 100000001, 0, 0 + timeZoneMinutes + 60, 0, 1); dateStr = date.toISOString(); - return false; } else { date = new Date(1970, 0, 100000001, 0, 0, 0, 1); dateStr = date.toISOString(); - return false; } - } catch (e) { - return e instanceof RangeError; - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js b/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js index 4b4cd380c..966c2575d 100644 --- a/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js +++ b/test/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js @@ -7,28 +7,21 @@ description: > Date.prototype.toISOString - RangeError is not thrown when value of date is Date(1970, 0, -99999999, 0, 0, 0, 0), the time zone is UTC(0) -includes: [runTestCase.js] ---*/ -function testcase() { var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); var date, dateStr; if (timeZoneMinutes > 0) { date = new Date(1970, 0, -99999999, 0, 0, 0, 0); - try { + assert.throws(RangeError, function() { date.toISOString(); - return false; - } catch (e) { - return e instanceof RangeError; - } + }); } else { date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes + 60, 0, 0); dateStr = date.toISOString(); - return dateStr[dateStr.length - 1] === "Z"; + assert.sameValue(dateStr[dateStr.length - 1], "Z"); } - } -runTestCase(testcase); diff --git a/test/built-ins/Error/prototype/message/15.11.4.3-1.js b/test/built-ins/Error/prototype/message/15.11.4.3-1.js index 862334e05..6860135a9 100644 --- a/test/built-ins/Error/prototype/message/15.11.4.3-1.js +++ b/test/built-ins/Error/prototype/message/15.11.4.3-1.js @@ -4,15 +4,8 @@ /*--- es5id: 15.11.4.3-1 description: Error.prototype.message is not enumerable. -includes: [runTestCase.js] ---*/ -function testcase() { for (var i in Error.prototype) { - if (i==="message") { - return false; - } + assert.notSameValue(i, "message", 'i'); } - return true; -} -runTestCase(testcase); diff --git a/test/built-ins/Error/prototype/name/15.11.4.2-1.js b/test/built-ins/Error/prototype/name/15.11.4.2-1.js index f8aeabc75..7df0656c1 100644 --- a/test/built-ins/Error/prototype/name/15.11.4.2-1.js +++ b/test/built-ins/Error/prototype/name/15.11.4.2-1.js @@ -4,15 +4,8 @@ /*--- es5id: 15.11.4.2-1 description: Error.prototype.name is not enumerable. -includes: [runTestCase.js] ---*/ -function testcase() { for (var i in Error.prototype) { - if (i==="name") { - return false; - } + assert.notSameValue(i, "name", 'i'); } - return true; -} -runTestCase(testcase); diff --git a/test/built-ins/Function/15.3.2.1-11-2-s.js b/test/built-ins/Function/15.3.2.1-11-2-s.js index ca72758c8..7f670f147 100644 --- a/test/built-ins/Function/15.3.2.1-11-2-s.js +++ b/test/built-ins/Function/15.3.2.1-11-2-s.js @@ -7,16 +7,6 @@ description: > Duplicate seperate parameter name in Function constructor called from strict mode allowed if body not strict flags: [onlyStrict] -includes: [runTestCase.js] ---*/ -function testcase() -{ - try { Function('a','a','return;'); - return true; - } catch (e) { - return false; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Function/15.3.2.1-11-4-s.js b/test/built-ins/Function/15.3.2.1-11-4-s.js index 86cd60f4a..858a9d7ac 100644 --- a/test/built-ins/Function/15.3.2.1-11-4-s.js +++ b/test/built-ins/Function/15.3.2.1-11-4-s.js @@ -8,16 +8,6 @@ description: > named 'eval' does not throws SyntaxError if function body is not strict mode flags: [onlyStrict] -includes: [runTestCase.js] ---*/ -function testcase() { - try { Function('eval', 'return;'); - return true; - } catch (e) { - return false; - } - - } -runTestCase(testcase); diff --git a/test/built-ins/Function/15.3.2.1-11-6-s.js b/test/built-ins/Function/15.3.2.1-11-6-s.js index d5bb33460..5d5362cbb 100644 --- a/test/built-ins/Function/15.3.2.1-11-6-s.js +++ b/test/built-ins/Function/15.3.2.1-11-6-s.js @@ -7,17 +7,6 @@ description: > Duplicate combined parameter name allowed in Function constructor called in strict mode if body not strict flags: [onlyStrict] -includes: [runTestCase.js] ---*/ -function testcase() -{ - try { Function('a,a','return a;'); - return true; - } catch (e) { - return false; - } - - } -runTestCase(testcase); diff --git a/test/built-ins/Function/15.3.2.1-11-7-s.js b/test/built-ins/Function/15.3.2.1-11-7-s.js index 22b70f0f6..dd1d6e55a 100644 --- a/test/built-ins/Function/15.3.2.1-11-7-s.js +++ b/test/built-ins/Function/15.3.2.1-11-7-s.js @@ -8,16 +8,6 @@ description: > named arguments does not throws SyntaxError if function body is not strict mode flags: [onlyStrict] -includes: [runTestCase.js] ---*/ -function testcase() { - try { Function('arguments', 'return;'); - return true; - - } catch (e) { - return false; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Function/prototype/bind/15.3.4.5-2-16.js b/test/built-ins/Function/prototype/bind/15.3.4.5-2-16.js index 198888297..4d72a31fe 100644 --- a/test/built-ins/Function/prototype/bind/15.3.4.5-2-16.js +++ b/test/built-ins/Function/prototype/bind/15.3.4.5-2-16.js @@ -4,16 +4,8 @@ /*--- es5id: 15.3.4.5-2-16 description: Function.prototype.bind - 'Target' is a function -includes: [runTestCase.js] ---*/ -function testcase() { function testFunc() {} - try { + testFunc.bind(); - return true; - } catch (e) { - return false; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Function/prototype/bind/15.3.4.5-20-2.js b/test/built-ins/Function/prototype/bind/15.3.4.5-20-2.js index 0504fb6ce..c07b78a05 100644 --- a/test/built-ins/Function/prototype/bind/15.3.4.5-20-2.js +++ b/test/built-ins/Function/prototype/bind/15.3.4.5-20-2.js @@ -6,17 +6,11 @@ es5id: 15.3.4.5-20-2 description: > Function.prototype.bind - [[Get]] attribute of 'caller' property in 'F' is thrower -includes: [runTestCase.js] ---*/ -function testcase() { - function foo() { } var obj = foo.bind({}); - try { - return obj.caller && false; - } catch (ex) { - return (ex instanceof TypeError); - } - } -runTestCase(testcase); + +assert.throws(TypeError, function() { + obj.caller; +}); diff --git a/test/built-ins/Function/prototype/bind/15.3.4.5-21-2.js b/test/built-ins/Function/prototype/bind/15.3.4.5-21-2.js index 376124ecb..8779bc06d 100644 --- a/test/built-ins/Function/prototype/bind/15.3.4.5-21-2.js +++ b/test/built-ins/Function/prototype/bind/15.3.4.5-21-2.js @@ -6,17 +6,11 @@ es5id: 15.3.4.5-21-2 description: > Function.prototype.bind - [[Get]] attribute of 'arguments' property in 'F' is thrower -includes: [runTestCase.js] ---*/ -function testcase() { - function foo() { } var obj = foo.bind({}); - try { - return obj.arguments && false; - } catch (ex) { - return (ex instanceof TypeError); - } - } -runTestCase(testcase); + +assert.throws(TypeError, function() { + obj.arguments; +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-1.js b/test/built-ins/JSON/parse/15.12.1.1-0-1.js index 003fcf02f..d1bb9eecd 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-1.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-1.js @@ -4,16 +4,8 @@ /*--- es5id: 15.12.1.1-0-1 description: The JSON lexical grammar treats whitespace as a token seperator -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('12\t\r\n 34'); // should produce a syntax error as whitespace results in two tokens - } - catch (e) { - if (e.name === 'SyntaxError') return true; - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-2.js b/test/built-ins/JSON/parse/15.12.1.1-0-2.js index 76e5cd179..8254a4d62 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-2.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-2.js @@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-2 description: > <VT> is not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('\u000b1234'); // should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-3.js b/test/built-ins/JSON/parse/15.12.1.1-0-3.js index 38c7b6947..fb213cb00 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-3.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-3.js @@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-3 description: > <FF> is not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('\u000c1234'); // should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-4.js b/test/built-ins/JSON/parse/15.12.1.1-0-4.js index 6a7d75a21..34b31816c 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-4.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-4.js @@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-4 description: > <NBSP> is not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('\u00a01234'); // should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-5.js b/test/built-ins/JSON/parse/15.12.1.1-0-5.js index 0655622a1..e18222fd2 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-5.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-5.js @@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-5 description: > <ZWSPP> is not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('\u200b1234'); // should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-6.js b/test/built-ins/JSON/parse/15.12.1.1-0-6.js index eb0a10a95..cfaf7d050 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-6.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-6.js @@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-6 description: > <BOM> is not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('\ufeff1234'); // should produce a syntax error a - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-7.js b/test/built-ins/JSON/parse/15.12.1.1-0-7.js index 25aee06eb..25e408786 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-7.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-7.js @@ -6,17 +6,9 @@ es5id: 15.12.1.1-0-7 description: > other category z spaces are not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { // the following should produce a syntax error JSON.parse('\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u30001234'); - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-0-8.js b/test/built-ins/JSON/parse/15.12.1.1-0-8.js index 6b1d7360f..fa7bb87b3 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-0-8.js +++ b/test/built-ins/JSON/parse/15.12.1.1-0-8.js @@ -6,16 +6,8 @@ es5id: 15.12.1.1-0-8 description: > U+2028 and U+2029 are not valid JSON whitespace as specified by the production JSONWhitespace. -includes: [runTestCase.js] ---*/ -function testcase() { - - try { +assert.throws(SyntaxError, function() { JSON.parse('\u2028\u20291234'); // should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-1.js b/test/built-ins/JSON/parse/15.12.1.1-g1-1.js index 9cc442b58..4325a2899 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g1-1.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g1-1.js @@ -4,16 +4,10 @@ /*--- es5id: 15.12.1.1-g1-1 description: The JSON lexical grammar treats <TAB> as a whitespace character -includes: [runTestCase.js] ---*/ -function testcase() { - if (JSON.parse('\t1234')!==1234) return false; // <TAB> should be ignored - try { - JSON.parse('12\t34'); // <TAB> should produce a syntax error as whitespace results in two tokens - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +assert.sameValue(JSON.parse('\t1234'), 1234, '<TAB> should be ignored'); + +assert.throws(SyntaxError, function() { + JSON.parse('12\t34'); +}, '<TAB> should produce a syntax error as whitespace results in two tokens'); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-2.js b/test/built-ins/JSON/parse/15.12.1.1-g1-2.js index aa1f04d21..4c71c01a7 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g1-2.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g1-2.js @@ -4,16 +4,10 @@ /*--- es5id: 15.12.1.1-g1-2 description: The JSON lexical grammar treats <CR> as a whitespace character -includes: [runTestCase.js] ---*/ -function testcase() { - if (JSON.parse('\r1234')!==1234) return false; // <cr> should be ignored - try { - JSON.parse('12\r34'); // <CR> should produce a syntax error as whitespace results in two tokens - } - catch (e) { - if (e.name === 'SyntaxError') return true; - } - } -runTestCase(testcase); +assert.sameValue(JSON.parse('\r1234'), 1234, '<cr> should be ignored'); + +assert.throws(SyntaxError, function() { + JSON.parse('12\r34'); +}, '<CR> should produce a syntax error as whitespace results in two tokens'); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-3.js b/test/built-ins/JSON/parse/15.12.1.1-g1-3.js index 8e30dac0a..80e533c41 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g1-3.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g1-3.js @@ -4,16 +4,10 @@ /*--- es5id: 15.12.1.1-g1-3 description: The JSON lexical grammar treats <LF> as a whitespace character -includes: [runTestCase.js] ---*/ -function testcase() { - if (JSON.parse('\n1234')!==1234) return false; // <LF> should be ignored - try { - JSON.parse('12\n34'); // <LF> should produce a syntax error as whitespace results in two tokens - } - catch (e) { - if (e.name === 'SyntaxError') return true; - } - } -runTestCase(testcase); +assert.sameValue(JSON.parse('\n1234'), 1234, '<LF> should be ignored'); + +assert.throws(SyntaxError, function() { + JSON.parse('12\n34'); +}, '<LF> should produce a syntax error as whitespace results in two tokens'); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g1-4.js b/test/built-ins/JSON/parse/15.12.1.1-g1-4.js index 3b1494c0e..b00e82b55 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g1-4.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g1-4.js @@ -4,16 +4,10 @@ /*--- es5id: 15.12.1.1-g1-4 description: The JSON lexical grammar treats <SP> as a whitespace character -includes: [runTestCase.js] ---*/ -function testcase() { - if (JSON.parse(' 1234')!=1234) return false; // <SP> should be ignored - try { - JSON.parse('12 34'); // <SP> should produce a syntax error as whitespace results in two tokens - } - catch (e) { - if (e.name === 'SyntaxError') return true; - } - } -runTestCase(testcase); +assert.sameValue(JSON.parse(' 1234'), 1234, '<SP> should be ignored'); + +assert.throws(SyntaxError, function() { + JSON.parse('12 34'); +}, '<SP> should produce a syntax error as whitespace results in two tokens'); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g2-2.js b/test/built-ins/JSON/parse/15.12.1.1-g2-2.js index 4e5be737a..dcef87ac5 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g2-2.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g2-2.js @@ -4,15 +4,8 @@ /*--- es5id: 15.12.1.1-g2-2 description: A JSONString may not be delimited by single quotes -includes: [runTestCase.js] ---*/ -function testcase() { - try { - if (JSON.parse("'abc'") ==='abc') return false; - } - catch (e) { - return true; - } - } -runTestCase(testcase); +assert.throws(SyntaxError, function() { + JSON.parse("'abc'"); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g2-3.js b/test/built-ins/JSON/parse/15.12.1.1-g2-3.js index 93c6de5a3..4809d4225 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g2-3.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g2-3.js @@ -4,15 +4,8 @@ /*--- es5id: 15.12.1.1-g2-3 description: A JSONString may not be delimited by Uncode escaped quotes -includes: [runTestCase.js] ---*/ -function testcase() { - try { - if (JSON.parse("\\u0022abc\\u0022") ==='abc') return false; - } - catch (e) { - return true; - } - } -runTestCase(testcase); +assert.throws(SyntaxError, function() { + JSON.parse("\\u0022abc\\u0022"); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g2-4.js b/test/built-ins/JSON/parse/15.12.1.1-g2-4.js index 54492523d..cf4a5d47f 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g2-4.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g2-4.js @@ -4,15 +4,8 @@ /*--- es5id: 15.12.1.1-g2-4 description: A JSONString must both begin and end with double quotes -includes: [runTestCase.js] ---*/ -function testcase() { - try { - if (JSON.parse('"ab'+"c'") ==='abc') return false; - } - catch (e) { - return true; - } - } -runTestCase(testcase); +assert.throws(SyntaxError, function() { + JSON.parse('"ab'+"c'"); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-1.js b/test/built-ins/JSON/parse/15.12.1.1-g4-1.js index 2bcfc01e8..d7b8a4584 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g4-1.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g4-1.js @@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-1 description: > The JSON lexical grammar does not allow a JSONStringCharacter to be any of the Unicode characters U+0000 thru U+0007 -includes: [runTestCase.js] ---*/ -function testcase() { - try { +assert.throws(SyntaxError, function() { JSON.parse('"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007"'); // invalid string characters should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-2.js b/test/built-ins/JSON/parse/15.12.1.1-g4-2.js index 44ae7812f..5022dcbca 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g4-2.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g4-2.js @@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-2 description: > The JSON lexical grammar does not allow a JSONStringCharacter to be any of the Unicode characters U+0008 thru U+000F -includes: [runTestCase.js] ---*/ -function testcase() { - try { +assert.throws(SyntaxError, function() { JSON.parse('"\u0008\u0009\u000a\u000b\u000c\u000d\u000e\u000f"'); // invalid string characters should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-3.js b/test/built-ins/JSON/parse/15.12.1.1-g4-3.js index fa298dce2..9d13dbb69 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g4-3.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g4-3.js @@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-3 description: > The JSON lexical grammar does not allow a JSONStringCharacter to be any of the Unicode characters U+0010 thru U+0017 -includes: [runTestCase.js] ---*/ -function testcase() { - try { +assert.throws(SyntaxError, function() { JSON.parse('"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"'); // invalid string characters should produce a syntax error - } - catch (e) { - return true; // treat any exception as a pass, other tests ensure that JSON.parse throws SyntaxError exceptions - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g4-4.js b/test/built-ins/JSON/parse/15.12.1.1-g4-4.js index 0370960f4..e222184eb 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g4-4.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g4-4.js @@ -6,15 +6,8 @@ es5id: 15.12.1.1-g4-4 description: > The JSON lexical grammar does not allow a JSONStringCharacter to be any of the Unicode characters U+0018 thru U+001F -includes: [runTestCase.js] ---*/ -function testcase() { - try { +assert.throws(SyntaxError, function() { JSON.parse('"\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"'); // invalid string characters should produce a syntax error - } - catch (e) { - if (e.name === 'SyntaxError') return true; - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g5-2.js b/test/built-ins/JSON/parse/15.12.1.1-g5-2.js index 8d0a1c053..d03a29920 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g5-2.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g5-2.js @@ -6,15 +6,8 @@ es5id: 15.12.1.1-g5-2 description: > A JSONStringCharacter UnicodeEscape may not have fewer than 4 hex characters -includes: [runTestCase.js] ---*/ -function testcase() { - try { +assert.throws(SyntaxError, function() { JSON.parse('"\\u005"') - } - catch (e) { - return e.name==='SyntaxError' - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.1.1-g5-3.js b/test/built-ins/JSON/parse/15.12.1.1-g5-3.js index 7ed0b8e89..e577bd6f6 100644 --- a/test/built-ins/JSON/parse/15.12.1.1-g5-3.js +++ b/test/built-ins/JSON/parse/15.12.1.1-g5-3.js @@ -6,15 +6,8 @@ es5id: 15.12.1.1-g5-3 description: > A JSONStringCharacter UnicodeEscape may not include any non=hex characters -includes: [runTestCase.js] ---*/ -function testcase() { - try { +assert.throws(SyntaxError, function() { JSON.parse('"\\u0X50"') - } - catch (e) { - return e.name==='SyntaxError' - } - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/parse/15.12.2-2-1.js b/test/built-ins/JSON/parse/15.12.2-2-1.js index c2b3a5731..a2a42946f 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-1.js +++ b/test/built-ins/JSON/parse/15.12.2-2-1.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-1 description: > JSON.parse - parsing an object where property name is a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ ' + nullChars[index] + ' : "John" } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-10.js b/test/built-ins/JSON/parse/15.12.2-2-10.js index ef0291f48..0f3c73ac1 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-10.js +++ b/test/built-ins/JSON/parse/15.12.2-2-10.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-10 description: > JSON.parse - parsing an object where property value middles with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ "name" : ' + "Jo" + nullChars[index] + "hn" + ' } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-2.js b/test/built-ins/JSON/parse/15.12.2-2-2.js index 9be1f9711..d577d5b76 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-2.js +++ b/test/built-ins/JSON/parse/15.12.2-2-2.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-2 description: > JSON.parse - parsing an object where property name starts with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ ' + nullChars[index] + "name" + ' : "John" } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-3.js b/test/built-ins/JSON/parse/15.12.2-2-3.js index 524b8badd..20f19e1b2 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-3.js +++ b/test/built-ins/JSON/parse/15.12.2-2-3.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-3 description: > JSON.parse - parsing an object where property name ends with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{' + "name" + nullChars[index] + ' : "John" } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-4.js b/test/built-ins/JSON/parse/15.12.2-2-4.js index dc1d6654e..755f4578f 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-4.js +++ b/test/built-ins/JSON/parse/15.12.2-2-4.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-4 description: > JSON.parse - parsing an object where property name starts and ends with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{' + nullChars[index] + "name" + nullChars[index] + ' : "John" } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-5.js b/test/built-ins/JSON/parse/15.12.2-2-5.js index f2149cbd8..1b0a6240b 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-5.js +++ b/test/built-ins/JSON/parse/15.12.2-2-5.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-5 description: > JSON.parse - parsing an object where property name middles with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ ' + "na" + nullChars[index] + "me" + ' : "John" } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-6.js b/test/built-ins/JSON/parse/15.12.2-2-6.js index dd2e2e7a0..c4fb8b863 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-6.js +++ b/test/built-ins/JSON/parse/15.12.2-2-6.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-6 description: > JSON.parse - parsing an object where property value is a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ "name" : ' + nullChars[index] + ' } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-7.js b/test/built-ins/JSON/parse/15.12.2-2-7.js index 6612ec016..2cb912b1f 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-7.js +++ b/test/built-ins/JSON/parse/15.12.2-2-7.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-7 description: > JSON.parse - parsing an object where property value starts with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + ' } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-8.js b/test/built-ins/JSON/parse/15.12.2-2-8.js index 2d4feb42c..ab571c59f 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-8.js +++ b/test/built-ins/JSON/parse/15.12.2-2-8.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-8 description: > JSON.parse - parsing an object where property value ends with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ "name" : ' + "John" + nullChars[index] + ' } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/parse/15.12.2-2-9.js b/test/built-ins/JSON/parse/15.12.2-2-9.js index cbd697bf6..ab7ca39cc 100644 --- a/test/built-ins/JSON/parse/15.12.2-2-9.js +++ b/test/built-ins/JSON/parse/15.12.2-2-9.js @@ -6,13 +6,8 @@ es5id: 15.12.2-2-9 description: > JSON.parse - parsing an object where property value starts and ends with a null character -includes: [runTestCase.js] ---*/ -function testcase() { - - var result = true; - var nullChars = new Array(); nullChars[0] = '\"\u0000\"'; nullChars[1] = '\"\u0001\"'; @@ -48,13 +43,7 @@ function testcase() { nullChars[31] = '\"\u001F\"'; for (var index in nullChars) { - try { + assert.throws(SyntaxError, function() { var obj = JSON.parse('{ "name" : ' + nullChars[index] + "John" + nullChars[index] + ' } '); - result = (result && false); - } catch (e) { - result = (result && (e instanceof SyntaxError)); - } + }); } - return result; - } -runTestCase(testcase); diff --git a/test/built-ins/JSON/stringify/15.12.3-6-b-1.js b/test/built-ins/JSON/stringify/15.12.3-6-b-1.js index d6d96ff33..d5eea1024 100644 --- a/test/built-ins/JSON/stringify/15.12.3-6-b-1.js +++ b/test/built-ins/JSON/stringify/15.12.3-6-b-1.js @@ -5,12 +5,10 @@ es5id: 15.12.3-6-b-1 description: > JSON.stringify treats numeric space arguments less than 1 - (0.999999)the same as emptry string space argument. -includes: [runTestCase.js] + (0.999999)the same as empty string space argument. ---*/ -function testcase() { var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'}; - return JSON.stringify(obj,null, 0.999999)=== JSON.stringify(obj); /* emptry string should be same as no space arg */ - } -runTestCase(testcase); + +/* empty string should be same as no space arg */ +assert.sameValue(JSON.stringify(obj,null, 0.999999), JSON.stringify(obj)); diff --git a/test/built-ins/JSON/stringify/15.12.3-6-b-2.js b/test/built-ins/JSON/stringify/15.12.3-6-b-2.js index 925f41bc3..d1bf8401b 100644 --- a/test/built-ins/JSON/stringify/15.12.3-6-b-2.js +++ b/test/built-ins/JSON/stringify/15.12.3-6-b-2.js @@ -5,12 +5,10 @@ es5id: 15.12.3-6-b-2 description: > JSON.stringify treats numeric space arguments less than 1 (0)the - same as emptry string space argument. -includes: [runTestCase.js] + same as empty string space argument. ---*/ -function testcase() { var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'}; - return JSON.stringify(obj,null, 0)=== JSON.stringify(obj); /* emptry string should be same as no space arg */ - } -runTestCase(testcase); + +/* empty string should be same as no space arg */ +assert.sameValue(JSON.stringify(obj,null, 0), JSON.stringify(obj)); diff --git a/test/built-ins/JSON/stringify/15.12.3-6-b-3.js b/test/built-ins/JSON/stringify/15.12.3-6-b-3.js index 97a087a43..9310f9470 100644 --- a/test/built-ins/JSON/stringify/15.12.3-6-b-3.js +++ b/test/built-ins/JSON/stringify/15.12.3-6-b-3.js @@ -5,12 +5,10 @@ es5id: 15.12.3-6-b-3 description: > JSON.stringify treats numeric space arguments less than 1 (-5) the - same as emptry string space argument. -includes: [runTestCase.js] + same as empty string space argument. ---*/ -function testcase() { var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'}; - return JSON.stringify(obj,null, -5)=== JSON.stringify(obj); /* emptry string should be same as no space arg */ - } -runTestCase(testcase); + + /* empty string should be same as no space arg */ + assert.sameValue(JSON.stringify(obj,null, -5), JSON.stringify(obj)); diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-1.js b/test/built-ins/JSON/stringify/15.12.3_4-1-1.js index fc6dd799c..f9b5f68ab 100644 --- a/test/built-ins/JSON/stringify/15.12.3_4-1-1.js +++ b/test/built-ins/JSON/stringify/15.12.3_4-1-1.js @@ -4,16 +4,11 @@ /*--- es5id: 15.12.3_4-1-1 description: JSON.stringify a circular object throws a error -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; obj.prop = obj; - try { + +assert.throws(TypeError, function() { JSON.stringify(obj); - return false; // should not reach here - } - catch (e) {return true} - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-2.js b/test/built-ins/JSON/stringify/15.12.3_4-1-2.js index 9a960b007..a79907bd0 100644 --- a/test/built-ins/JSON/stringify/15.12.3_4-1-2.js +++ b/test/built-ins/JSON/stringify/15.12.3_4-1-2.js @@ -4,16 +4,11 @@ /*--- es5id: 15.12.3_4-1-2 description: JSON.stringify a circular object throws a TypeError -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; obj.prop = obj; - try { + +assert.throws(TypeError, function() { JSON.stringify(obj); - return false; // should not reach here - } - catch (e) {return e.name==='TypeError'} - } -runTestCase(testcase); +}); diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-3.js b/test/built-ins/JSON/stringify/15.12.3_4-1-3.js index e772cddfd..30d0a4339 100644 --- a/test/built-ins/JSON/stringify/15.12.3_4-1-3.js +++ b/test/built-ins/JSON/stringify/15.12.3_4-1-3.js @@ -4,16 +4,11 @@ /*--- es5id: 15.12.3_4-1-3 description: JSON.stringify a indirectly circular object throws a error -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {p1: {p2: {}}}; obj.p1.p2.prop = obj; - try { + +assert.throws(TypeError, function() { JSON.stringify(obj); - return false; // should not reach here - } - catch (e) {return true} - } -runTestCase(testcase); +}); diff --git a/test/built-ins/Object/create/15.2.3.5-1-2.js b/test/built-ins/Object/create/15.2.3.5-1-2.js index 38cccf56f..36226f322 100644 --- a/test/built-ins/Object/create/15.2.3.5-1-2.js +++ b/test/built-ins/Object/create/15.2.3.5-1-2.js @@ -4,15 +4,6 @@ /*--- es5id: 15.2.3.5-1-2 description: Object.create TypeError is not thrown if 'O' is null -includes: [runTestCase.js] ---*/ -function testcase() { - try { Object.create(null); - return true; - } catch (e) { - return false; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/create/15.2.3.5-4-305.js b/test/built-ins/Object/create/15.2.3.5-4-305.js index 0e3fe0585..225047a59 100644 --- a/test/built-ins/Object/create/15.2.3.5-4-305.js +++ b/test/built-ins/Object/create/15.2.3.5-4-305.js @@ -6,20 +6,12 @@ es5id: 15.2.3.5-4-305 description: > Object.create defines a data property when one property in 'Properties' is generic descriptor (8.12.9 step 4.a) -includes: [runTestCase.js] ---*/ -function testcase() { - - try { var newObj = Object.create({}, { prop: { enumerable: true } }); - return newObj.hasOwnProperty("prop"); - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); diff --git a/test/built-ins/Object/create/15.2.3.5-4-306.js b/test/built-ins/Object/create/15.2.3.5-4-306.js index 4965a6edf..328c209d4 100644 --- a/test/built-ins/Object/create/15.2.3.5-4-306.js +++ b/test/built-ins/Object/create/15.2.3.5-4-306.js @@ -6,12 +6,8 @@ es5id: 15.2.3.5-4-306 description: > Object.create - [[Value]] is set as undefined if it is absent in data descriptor of one property in 'Properties' (8.12.9 step 4.a.i) -includes: [runTestCase.js] ---*/ -function testcase() { - - try { var newObj = Object.create({}, { prop: { writable: true, @@ -19,9 +15,6 @@ function testcase() { enumerable: true } }); - return newObj.hasOwnProperty("prop") && newObj.prop === undefined; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, undefined, 'newObj.prop'); diff --git a/test/built-ins/Object/create/15.2.3.5-4-39.js b/test/built-ins/Object/create/15.2.3.5-4-39.js index 251b496d6..6bd0d2a9a 100644 --- a/test/built-ins/Object/create/15.2.3.5-4-39.js +++ b/test/built-ins/Object/create/15.2.3.5-4-39.js @@ -7,11 +7,8 @@ description: > Object.create - ensure that side-effects of gets occur in the same order as they would for: for (P in props) props[P] (15.2.3.7 step 5.a) -includes: [runTestCase.js] ---*/ -function testcase() { - var props = {}; props.prop1 = { value: 12, enumerable: true }; props.prop2 = { value: true, enumerable: true }; @@ -26,10 +23,5 @@ function testcase() { var newObj = Object.create({}, props); var index = 0; for (var q in newObj) { - if (tempArray[index++] !== q && newObj.hasOwnProperty(q)) { - return false; - } + assert.sameValue(tempArray[index++] !== q && newObj.hasOwnProperty(q), false, 'tempArray[index++] !== q && newObj.hasOwnProperty(q)'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js index ba43a0327..5003f3e48 100644 --- a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js @@ -6,11 +6,8 @@ es5id: 15.2.3.7-5-b-252 description: > Object.defineProperties - value of 'set' property of 'descObj' is undefined (8.10.5 step 8.b) -includes: [runTestCase.js] ---*/ -function testcase() { - var getFun = function () { return 11; }; @@ -23,11 +20,7 @@ function testcase() { } }); - try { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); - return obj.hasOwnProperty("prop") && typeof (desc.set) === "undefined"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof (desc.set), "undefined", 'typeof (desc.set)'); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js index 66e8c1695..b765653ef 100644 --- a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js @@ -9,23 +9,17 @@ description: > greater than value of the length property is defined into 'O' without deleting any property with large index named (15.4.5.1 step 3.f) -includes: [runTestCase.js] ---*/ -function testcase() { - var arr = [0, , 2]; - try { Object.defineProperties(arr, { length: { value: 5 } }); - return arr.length === 5 && arr[0] === 0 && !arr.hasOwnProperty("1") && arr[2] === 2; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert.sameValue(arr.length, 5, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[2], 2, 'arr[2]'); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js index b461067e3..f2bd0349c 100644 --- a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js @@ -8,22 +8,17 @@ description: > property of 'O', test the [[Value]] field of 'desc' which equals to value of the length property is defined into 'O' without deleting any property with large index named (15.4.5.1 step 3.f) -includes: [runTestCase.js] ---*/ -function testcase() { - var arr = [0, , 2]; - try { + Object.defineProperties(arr, { length: { value: 3 } }); - return arr.length === 3 && arr[0] === 0 && !arr.hasOwnProperty("1") && arr[2] === 2; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert.sameValue(arr.length, 3, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[2], 2, 'arr[2]'); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js index b95d3457a..51e462ce4 100644 --- a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js @@ -8,26 +8,18 @@ description: > property of 'O', the [[Value]] field of 'desc' equals to value of the length property, test TypeError wouldn't be thrown when the length property is not writable (15.4.5.1 step 3.f.i) -includes: [runTestCase.js] ---*/ -function testcase() { - var arr = []; Object.defineProperty(arr, "length", { writable: false }); - try { Object.defineProperties(arr, { length: { value: 0 } }); - return true && arr.length === 0; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(arr.length, 0, 'arr.length'); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js index c3b5ac575..39d5ee0a6 100644 --- a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js @@ -9,10 +9,8 @@ description: > [[Enumerable]] of 'P' property in 'Attributes' is set as false value if [[Enumerable]] is absent in accessor descriptor 'desc' (15.4.5.1 step 4.c) -includes: [runTestCase.js] ---*/ -function testcase() { var arr = []; Object.defineProperties(arr, { @@ -24,10 +22,5 @@ function testcase() { }); for (var i in arr) { - if (i === "0" && arr.hasOwnProperty("0")) { - return false; - } + assert.sameValue(i === "0" && arr.hasOwnProperty("0"), false, 'i === "0" && arr.hasOwnProperty("0")'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js index 0b3ab37f6..3080c1615 100644 --- a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js @@ -7,10 +7,8 @@ description: > Object.defineProperties - 'P' doesn't exist in 'O', test [[Enumerable]] of 'P' is set as false value if absent in data descriptor 'desc' (8.12.9 step 4.a.i) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperties(obj, { @@ -19,11 +17,6 @@ function testcase() { for (var prop in obj) { if (obj.hasOwnProperty(prop)) { - if (prop === "prop") { - return false; - } + assert.notSameValue(prop, "prop", 'prop'); } } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-116.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-116.js index 90730a1bb..65a3d68c6 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-116.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-116.js @@ -6,24 +6,22 @@ es5id: 15.2.3.6-4-116 description: > Object.defineProperty - 'O' is an Array, test the length property of 'O' is own data property (15.4.5.1 step 1) -includes: [runTestCase.js] ---*/ -function testcase() { - var arrObj = [0, 1]; Object.defineProperty(arrObj, "1", { value: 1, configurable: false }); - try { - Object.defineProperty(arrObj, "length", { value: 1 }); - return false; - } catch (e) { - var desc = Object.getOwnPropertyDescriptor(arrObj, "length"); - return Object.hasOwnProperty.call(arrObj, "length") && desc.value === 2 && - desc.writable === true && desc.configurable === false && desc.enumerable === false; - } - } -runTestCase(testcase); +assert.throws(TypeError, function() { + Object.defineProperty(arrObj, "length", { value: 1 }); +}); + +var desc = Object.getOwnPropertyDescriptor(arrObj, "length"); + +assert(Object.hasOwnProperty.call(arrObj, "length"), 'Object.hasOwnProperty.call(arrObj, "length")'); +assert.sameValue(desc.value, 2, 'desc.value'); +assert.sameValue(desc.writable, true, 'desc.writable'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-163.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-163.js index 20c373a46..99ad98928 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-163.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-163.js @@ -8,24 +8,14 @@ description: > property of 'O', the [[Value]] field of 'desc' equals to value of the length property, test no TypeError is thrown when the length property is not writable (15.4.5.1 step 3.f.i) -includes: [runTestCase.js] ---*/ -function testcase() { - var arrObj = []; Object.defineProperty(arrObj, "length", { writable: false }); - try { Object.defineProperty(arrObj, "length", { value: 0 }); - return true; - } catch (e) { - return false; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-187.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-187.js index f1580d62b..e6050fceb 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-187.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-187.js @@ -9,24 +9,15 @@ description: > attribute of the length property in 'O' is false and value of 'name' is less than value of the length property (15.4.5.1 step 4.b) -includes: [runTestCase.js] ---*/ -function testcase() { var arrObj = [1, 2, 3]; Object.defineProperty(arrObj, "length", { writable: false }); - try { Object.defineProperty(arrObj, 1, { value: "abc" }); - return true; - } catch (e) { - return false; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-2.js index 392cff8df..d78cae826 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-2.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-2.js @@ -10,22 +10,16 @@ es5id: 15.2.3.6-4-2 description: > Object.defineProperty sets missing attributes to their default values (data properties)(8.12.9 step 4.a.i) -includes: [runTestCase.js] ---*/ -function testcase() { var o = {}; var desc = { value: 1 }; Object.defineProperty(o, "foo", desc); - + var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); - - if (propDesc.value === 1 && // this is the value that was set - propDesc.writable === false && // false by default - propDesc.enumerable === false && // false by default - propDesc.configurable === false) { // false by default - return true; - } - } -runTestCase(testcase); + +assert.sameValue(propDesc.value, 1, 'propDesc.value'); // this is the value that was set +assert.sameValue(propDesc.writable, false, 'propDesc.writable'); // false by default +assert.sameValue(propDesc.enumerable, false, 'propDesc.enumerable'); // false by default +assert.sameValue(propDesc.configurable, false, 'propDesc.configurable'); // false by default diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-3.js index ffbfc155b..a3873b1e0 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-3.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-3.js @@ -10,10 +10,8 @@ es5id: 15.2.3.6-4-3 description: > Object.defineProperty sets missing attributes to their default values (accessor)(8.12.9 step 4.b.i) -includes: [runTestCase.js] ---*/ -function testcase() { var o = {}; var getter = function () { return 1; }; @@ -23,11 +21,8 @@ function testcase() { var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); - if (typeof(propDesc.get) === "function" && // the getter must be the function that was provided - propDesc.get === getter && - propDesc.enumerable === false && // false by default - propDesc.configurable === false) { // false by default - return true; - } - } -runTestCase(testcase); +assert.sameValue(typeof(propDesc.get), "function", 'typeof(propDesc.get)'); +assert.sameValue(propDesc.get, getter, 'propDesc.get'); // the getter must be the function that was provided +assert.sameValue(propDesc.set, undefined, 'propDesc.set'); // undefined by default +assert.sameValue(propDesc.enumerable, false, 'propDesc.enumerable'); // false by default +assert.sameValue(propDesc.configurable, false, 'propDesc.configurable'); // false by default
\ No newline at end of file diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-327.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-327.js index 787aecbc3..97d2ddcc7 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-327.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-327.js @@ -6,10 +6,10 @@ es5id: 15.2.3.6-4-327 description: > ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is true, [[Configurable]] is true) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; Object.defineProperty(obj, "prop", { @@ -22,9 +22,11 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var property in obj) { if (property === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); + +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-334.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-334.js index 851160e7a..f4322915e 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-334.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-334.js @@ -6,10 +6,10 @@ es5id: 15.2.3.6-4-334 description: > ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is true, [[Configurable]] is false) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; Object.defineProperty(obj, "prop", { @@ -22,9 +22,11 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); + +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-341.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-341.js index 87bfe8538..1a2324b5f 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-341.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-341.js @@ -6,10 +6,8 @@ es5id: 15.2.3.6-4-341 description: > ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is false, [[Configurable]] is true) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { @@ -21,10 +19,8 @@ function testcase() { var propertyDefineCorrect = obj.hasOwnProperty("prop"); var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); + +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-348.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-348.js index 701a132fb..90804ded5 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-348.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-348.js @@ -6,10 +6,8 @@ es5id: 15.2.3.6-4-348 description: > ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is false, [[Configurable]] is false) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { @@ -21,10 +19,8 @@ function testcase() { var propertyDefineCorrect = obj.hasOwnProperty("prop"); var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); + +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-355.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-355.js index b5d9f515f..7b08f6ee6 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-355.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-355.js @@ -6,10 +6,10 @@ es5id: 15.2.3.6-4-355 description: > ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] is true, [[Configurable]] is true) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; Object.defineProperty(obj, "prop", { @@ -22,9 +22,11 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var property in obj) { if (property === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); + +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-362.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-362.js index b829fc5a0..1e5d40c2e 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-362.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-362.js @@ -6,10 +6,10 @@ es5id: 15.2.3.6-4-362 description: > ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] is true, [[Configurable]] is false) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; Object.defineProperty(obj, "prop", { value: 2010, @@ -21,9 +21,11 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var property in obj) { if (property === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); + +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-369.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-369.js index 3104d404d..1950c4a80 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-369.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-369.js @@ -6,10 +6,8 @@ es5id: 15.2.3.6-4-369 description: > ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] is false, [[Configurable]] is true) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { @@ -21,10 +19,8 @@ function testcase() { var propertyDefineCorrect = obj.hasOwnProperty("prop"); var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); + +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-376.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-376.js index bffdefece..310fee16e 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-376.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-376.js @@ -6,10 +6,8 @@ es5id: 15.2.3.6-4-376 description: > ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] is false, [[Configurable]] is false) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { @@ -21,10 +19,8 @@ function testcase() { var propertyDefineCorrect = obj.hasOwnProperty("prop"); var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); + +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-4.js index efe4a2288..5e08bb35a 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-4.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-4.js @@ -10,21 +10,16 @@ es5id: 15.2.3.6-4-4 description: > Object.defineProperty defines a data property if given a generic desc(8.12.9 step 4.a.i) -includes: [runTestCase.js] ---*/ -function testcase() { var o = {}; var desc = {}; Object.defineProperty(o, "foo", desc); var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); - if (propDesc.value === undefined && // this is the value that was set - propDesc.writable === false && // false by default - propDesc.enumerable === false && // false by default - propDesc.configurable === false) { // false by default - return true; - } - } -runTestCase(testcase); + +assert.sameValue(propDesc.value, undefined, 'propDesc.value'); // undefined by default +assert.sameValue(propDesc.writable, false, 'propDesc.writable'); // false by default +assert.sameValue(propDesc.enumerable, false, 'propDesc.enumerable'); // false by default +assert.sameValue(propDesc.configurable, false, 'propDesc.configurable'); // false by default diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-424.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-424.js index 4d09765c2..1cfca488e 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-424.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-424.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is undefined, [[Enumerable]] is true, [[Configurable]] is true) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; Object.defineProperty(obj, "prop", { @@ -25,10 +25,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-433.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-433.js index 225bf4f4b..e374de5ab 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-433.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-433.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is undefined, [[Enumerable]] is true, [[Configurable]] is false) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; Object.defineProperty(obj, "prop", { @@ -25,10 +25,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-442.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-442.js index 8ba4f14f5..72f9bf32f 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-442.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-442.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is undefined, [[Enumerable]] is false, [[Configurable]] is true) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { @@ -24,11 +22,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-451.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-451.js index 538b67f16..ef9fb05c2 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-451.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-451.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is undefined, [[Enumerable]] is false, [[Configurable]] is false) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop", { @@ -24,11 +22,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-460.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-460.js index 17bb0bf7f..0ff4a8016 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-460.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-460.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a Function, [[Enumerable]] is true, [[Configurable]] is true) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; var verifySetFunc = "data"; @@ -30,10 +30,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-469.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-469.js index 1b7d816c2..391bbf7ae 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-469.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-469.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a Function, [[Enumerable]] is true, [[Configurable]] is false) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; var verifySetFunc = "data"; @@ -30,10 +30,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-478.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-478.js index 62d633da0..519d80e7b 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-478.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-478.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a Function, [[Enumerable]] is false, [[Configurable]] is true) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var verifySetFunc = "data"; @@ -29,11 +27,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-487.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-487.js index a9595e094..8aaf8e2ba 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-487.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-487.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a Function, [[Enumerable]] is false, [[Configurable]] is false) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var verifySetFunc = "data"; @@ -29,11 +27,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-496.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-496.js index 9610f8355..2e63e773b 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-496.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-496.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is undefined, [[Enumerable]] is true, [[Configurable]] is true) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; var getFunc = function () { @@ -29,10 +29,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-505.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-505.js index aa37ba9ce..f15171ddc 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-505.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-505.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is undefined, [[Enumerable]] is true, [[Configurable]] is false) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; var getFunc = function () { @@ -29,10 +29,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-514.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-514.js index b611b187e..6b80aa137 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-514.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-514.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is undefined, [[Enumerable]] is false, [[Configurable]] is true) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var getFunc = function () { @@ -28,11 +26,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-523.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-523.js index 7355599c5..8c1377dc0 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-523.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-523.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is undefined, [[Enumerable]] is false, [[Configurable]] is false) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var getFunc = function () { @@ -28,11 +26,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-532.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-532.js index 2dcacdd23..ee3370eaf 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-532.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-532.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a Function, [[Enumerable]] is true, [[Configurable]] is true) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; var getFunc = function () { @@ -34,10 +34,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-541.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-541.js index d340a4fdf..4651f86e4 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-541.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-541.js @@ -7,10 +7,10 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a Function, [[Enumerable]] is true, [[Configurable]] is false) is enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = {}; var getFunc = function () { @@ -34,10 +34,11 @@ function testcase() { for (var p in obj) { if (p === "prop") { - return propertyDefineCorrect && desc.enumerable === true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-550.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-550.js index 85840516a..bb17ddc1b 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-550.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-550.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a Function, [[Enumerable]] is false, [[Configurable]] is true) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var getFunc = function () { @@ -33,11 +31,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-559.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-559.js index 40bbe96d5..f2f308b34 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-559.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-559.js @@ -7,10 +7,8 @@ description: > ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a Function, [[Enumerable]] is false, [[Configurable]] is false) is non-enumerable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var getFunc = function () { @@ -33,11 +31,8 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "prop"); for (var p in obj) { - if (p === "prop") { - return false; - } + assert.notSameValue(p, "prop", 'p'); } - return propertyDefineCorrect && desc.enumerable === false; - } -runTestCase(testcase); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-224.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-224.js index d1673e085..1c84fe826 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-224.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-224.js @@ -6,19 +6,12 @@ es5id: 15.2.3.3-4-224 description: > Object.getOwnPropertyDescriptor - ensure that 'value' property of returned object is data property with correct 'writable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); - try { desc.value = "overwriteDataProperty"; - return desc.value === "overwriteDataProperty"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(desc.value, "overwriteDataProperty", 'desc.value'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-226.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-226.js index 7e0bfdb82..326e8d419 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-226.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-226.js @@ -7,23 +7,16 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'value' property of returned object is data property with correct 'configurable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); var propDefined = "value" in desc; - try { delete desc.value; var propDeleted = "value" in desc; - return propDefined && !propDeleted; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert(propDefined, 'propDefined !== true'); +assert.sameValue(propDeleted, false, 'propDeleted'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-228.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-228.js index 45c701c80..7bd355aae 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-228.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-228.js @@ -7,19 +7,12 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'writable' property of returned object is data property with correct 'writable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); - try { desc.writable = "overwriteDataProperty"; - return desc.writable === "overwriteDataProperty"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(desc.writable, "overwriteDataProperty", 'desc.writable'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-230.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-230.js index 76fabb368..0e8d7c920 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-230.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-230.js @@ -7,23 +7,16 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'writable' property of returned object is data property with correct 'configurable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); var propDefined = ("writable" in desc); - try { delete desc.writable; var propDeleted = "writable" in desc; - return propDefined && !propDeleted; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert(propDefined, 'propDefined !== true'); +assert.sameValue(propDeleted, false, 'propDeleted'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-232.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-232.js index 11ba00c9d..43203e281 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-232.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-232.js @@ -7,19 +7,12 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'enumerable' property of returned object is data property with correct 'writable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); - try { desc.enumerable = "overwriteDataProperty"; - return desc.enumerable === "overwriteDataProperty"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(desc.enumerable, "overwriteDataProperty", 'desc.enumerable'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-234.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-234.js index 1152a9b84..d4c6ea9d8 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-234.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-234.js @@ -7,23 +7,16 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'enumerable' property of returned object is data property with correct 'configurable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); var propDefined = "enumerable" in desc; - try { delete desc.enumerable; var propDeleted = "enumerable" in desc; - return propDefined && !propDeleted; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert(propDefined, 'propDefined !== true'); +assert.sameValue(propDeleted, false, 'propDeleted'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-236.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-236.js index e427e8dc2..960fc5cf3 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-236.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-236.js @@ -7,19 +7,12 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'configurable' property of returned object is data property with correct 'writable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); - try { desc.writable = "overwriteDataProperty"; - return desc.writable === "overwriteDataProperty"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(desc.writable, "overwriteDataProperty", 'desc.writable'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-238.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-238.js index d60065d40..5e877a51d 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-238.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-238.js @@ -7,23 +7,16 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'configurable' property of returned object is data property with correct 'configurable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "property": "ownDataProperty" }; var desc = Object.getOwnPropertyDescriptor(obj, "property"); var propDefined = "configurable" in desc; - - try { + delete desc.configurable; var propDeleted = "configurable" in desc; - return propDefined && !propDeleted; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert(propDefined, 'propDefined !== true'); +assert.sameValue(propDeleted, false, 'propDeleted'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-240.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-240.js index 41124f7b2..35f469594 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-240.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-240.js @@ -6,10 +6,8 @@ es5id: 15.2.3.3-4-240 description: > Object.getOwnPropertyDescriptor - ensure that 'get' property of returned object is data property with correct 'writable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var fun = function () { return "ownGetProperty"; @@ -21,11 +19,6 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "property"); - try { desc.get = "overwriteGetProperty"; - return desc.get === "overwriteGetProperty"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(desc.get, "overwriteGetProperty", 'desc.get'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-242.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-242.js index 3ec150628..d7800ba62 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-242.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-242.js @@ -7,10 +7,8 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'get' property of returned object is data property with correct 'configurable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var fun = function () { return "ownDataProperty"; @@ -24,13 +22,8 @@ function testcase() { var propDefined = "get" in desc; - try { delete desc.get; var propDeleted = "get" in desc; - return propDefined && !propDeleted; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert(propDefined, 'propDefined !== true'); +assert.sameValue(propDeleted, false, 'propDeleted'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-244.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-244.js index 38ff3c445..143521597 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-244.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-244.js @@ -6,10 +6,8 @@ es5id: 15.2.3.3-4-244 description: > Object.getOwnPropertyDescriptor - ensure that 'set' property of returned object is data property with correct 'writable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var fun = function () { return "ownSetProperty"; @@ -21,11 +19,6 @@ function testcase() { var desc = Object.getOwnPropertyDescriptor(obj, "property"); - try { desc.set = "overwriteSetProperty"; - return desc.set === "overwriteSetProperty"; - } catch (e) { - return false; - } - } -runTestCase(testcase); + +assert.sameValue(desc.set, "overwriteSetProperty", 'desc.set'); diff --git a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-246.js b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-246.js index fb0f91a86..210ace76f 100644 --- a/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-246.js +++ b/test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-246.js @@ -7,10 +7,8 @@ description: > Object.getOwnPropertyDescriptor - ensure that 'set' property of returned object is data property with correct 'configurable' attribute -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; var fun = function () { return "ownSetProperty"; @@ -24,13 +22,8 @@ function testcase() { var propDefined = "set" in desc; - try { delete desc.set; var propDeleted = "set" in desc; - return propDefined && !propDeleted; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert(propDefined, 'propDefined !== true'); +assert.sameValue(propDeleted, false, 'propDeleted'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-1.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-1.js index 5d0dca14c..6af3d418e 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-1.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-1.js @@ -4,12 +4,9 @@ /*--- es5id: 15.2.3.4-4-1 description: Object.getOwnPropertyNames returns array of property names (Global) -includes: - - runTestCase.js - - fnGlobalObject.js +includes: [fnGlobalObject.js] ---*/ -function testcase() { var result = Object.getOwnPropertyNames(fnGlobalObject()); var expResult = ["NaN", "Infinity", "undefined", "eval", "parseInt", "parseFloat", "isNaN", "isFinite", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "Object", "Function", "Array", "String", "Boolean", "Number", "Date", "Date", "RegExp", "Error", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Math", "JSON"]; @@ -19,11 +16,5 @@ function testcase() { } for (var p1 in expResult) { - if (!result1[expResult[p1]]) { - return false; - } + assert(result1[expResult[p1]], 'result1[expResult[p1]] !== true'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-36.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-36.js index 80a7b1a10..8348c8209 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-36.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-36.js @@ -6,11 +6,8 @@ es5id: 15.2.3.4-4-36 description: > Object.getOwnPropertyNames - inherited data properties are not pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { - var proto = { "parent": "parent" }; var Con = function () { }; @@ -21,10 +18,5 @@ function testcase() { var result = Object.getOwnPropertyNames(child); for (var p in result) { - if (result[p] === "parent") { - return false; - } + assert.notSameValue(result[p], "parent", 'result[p]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-37.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-37.js index 14090af8d..7ee68cada 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-37.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-37.js @@ -6,10 +6,8 @@ es5id: 15.2.3.4-4-37 description: > Object.getOwnPropertyNames - inherited accessor properties are not pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "parent", { get: function () { @@ -26,10 +24,5 @@ function testcase() { var result = Object.getOwnPropertyNames(child); for (var p in result) { - if (result[p] === "parent") { - return false; - } + assert.notSameValue(result[p], "parent", 'result[p]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-40.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-40.js index 07650d4da..1597725f1 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-40.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-40.js @@ -6,11 +6,8 @@ es5id: 15.2.3.4-4-40 description: > Object.getOwnPropertyNames - inherited data property of String object 'O' is not pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { - try { var str = new String("abc"); String.prototype.protoProperty = "protoString"; @@ -18,14 +15,5 @@ function testcase() { var result = Object.getOwnPropertyNames(str); for (var p in result) { - if (result[p] === "protoProperty") { - return false; - } + assert.notSameValue(result[p], "protoProperty", 'result[p]'); } - - return true; - } finally { - delete String.prototype.protoProperty; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-41.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-41.js index e4990e311..376e30846 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-41.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-41.js @@ -6,11 +6,8 @@ es5id: 15.2.3.4-4-41 description: > Object.getOwnPropertyNames - inherited accessor property of String object 'O' is not pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { - try { var str = new String("abc"); Object.defineProperty(String.prototype, "protoProperty", { @@ -23,13 +20,5 @@ function testcase() { var result = Object.getOwnPropertyNames(str); for (var p in result) { - if (result[p] === "protoProperty") { - return false; - } + assert.notSameValue(result[p], "protoProperty", 'result[p]'); } - return true; - } finally { - delete String.prototype.protoProperty; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-42.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-42.js index 2e975c3bb..4f81f8454 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-42.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-42.js @@ -6,10 +6,10 @@ es5id: 15.2.3.4-4-42 description: > Object.getOwnPropertyNames - own data property of String object 'O' is pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var str = new String("abc"); Object.defineProperty(str, "ownProperty", { @@ -21,10 +21,9 @@ function testcase() { for (var p in result) { if (result[p] === "ownProperty") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-43.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-43.js index 4e0b29f67..b3ae879d9 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-43.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-43.js @@ -6,10 +6,10 @@ es5id: 15.2.3.4-4-43 description: > Object.getOwnPropertyNames - own accessor property of String object 'O' is pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var str = new String("abc"); Object.defineProperty(str, "ownProperty", { @@ -23,10 +23,9 @@ function testcase() { for (var p in result) { if (result[p] === "ownProperty") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-45.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-45.js index aba29dca2..5772ef4d0 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-45.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-45.js @@ -6,11 +6,8 @@ es5id: 15.2.3.4-4-45 description: > Object.getOwnPropertyNames - inherited data property of Array object 'O' is not pushed into the returned array. -includes: [runTestCase.js] ---*/ -function testcase() { - try { var arr = [0, 1, 2]; Array.prototype.protoProperty = "protoArray"; @@ -18,13 +15,5 @@ function testcase() { var result = Object.getOwnPropertyNames(arr); for (var p in result) { - if (result[p] === "protoProperty") { - return false; - } + assert.notSameValue(result[p], "protoProperty", 'result[p]'); } - return true; - } finally { - delete Array.prototype.protoProperty; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-46.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-46.js index b103c34b7..85773d0cd 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-46.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-46.js @@ -6,11 +6,8 @@ es5id: 15.2.3.4-4-46 description: > Object.getOwnPropertyNames - inherited accessor property of Array object 'O' is not pushed into the returned array. -includes: [runTestCase.js] ---*/ -function testcase() { - try { var arr = [0, 1, 2]; Object.defineProperty(Array.prototype, "protoProperty", { @@ -23,13 +20,5 @@ function testcase() { var result = Object.getOwnPropertyNames(arr); for (var p in result) { - if (result[p] === "protoProperty") { - return false; - } + assert.notSameValue(result[p], "protoProperty", 'result[p]'); } - return true; - } finally { - delete Array.prototype.protoProperty; - } - } -runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-47.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-47.js index 4bbba028c..ac4193f20 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-47.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-47.js @@ -6,10 +6,10 @@ es5id: 15.2.3.4-4-47 description: > Object.getOwnPropertyNames - own data property of Array object 'O' is pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var arr = [0, 1, 2]; arr.ownProperty = "ownArray"; @@ -17,10 +17,9 @@ function testcase() { for (var p in result) { if (result[p] === "ownProperty") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-48.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-48.js index f09d5b145..61299ad64 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-48.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-48.js @@ -6,10 +6,10 @@ es5id: 15.2.3.4-4-48 description: > Object.getOwnPropertyNames - own accessor property of Array object 'O' is pushed into the returned array. -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var arr = [0, 1, 2]; Object.defineProperty(arr, "ownProperty", { @@ -23,10 +23,9 @@ function testcase() { for (var p in result) { if (result[p] === "ownProperty") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-3.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-3.js index f1c3fb7d3..27e4eaaf9 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-3.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-3.js @@ -6,20 +6,19 @@ es5id: 15.2.3.4-4-b-3 description: > Object.getOwnPropertyNames - own property named empty('') is pushed into the returned array -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = { "": "empty" }; var result = Object.getOwnPropertyNames(obj); for (var p in result) { if (result[p] === "") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-4.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-4.js index 9b826fbda..fdcec3355 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-4.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-4.js @@ -6,22 +6,15 @@ es5id: 15.2.3.4-4-b-4 description: > Object.getOwnPropertyNames - elements of the returned array are writable -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { "a": "a" }; var result = Object.getOwnPropertyNames(obj); - try { var beforeOverride = (result[0] === "a"); result[0] = "b"; var afterOverride = (result[0] === "b"); - return beforeOverride && afterOverride; - } catch (ex) { - return false; - } - } -runTestCase(testcase); +assert(beforeOverride, 'beforeOverride !== true'); +assert(afterOverride, 'afterOverride !== true'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-5.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-5.js index 22962ec74..d6c3a2528 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-5.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-5.js @@ -6,20 +6,19 @@ es5id: 15.2.3.4-4-b-5 description: > Object.getOwnPropertyNames - elements of the returned array are enumerable -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = { "a": "a" }; var result = Object.getOwnPropertyNames(obj); for (var p in result) { if (result[p] === "a") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/keys/15.2.3.14-3-5.js b/test/built-ins/Object/keys/15.2.3.14-3-5.js index 035dd63c2..ed4c7b7cb 100644 --- a/test/built-ins/Object/keys/15.2.3.14-3-5.js +++ b/test/built-ins/Object/keys/15.2.3.14-3-5.js @@ -4,15 +4,13 @@ /*--- es5id: 15.2.3.14-3-5 description: Object.keys must return a fresh array on each invocation -includes: [runTestCase.js] ---*/ -function testcase() { var literal = {a: 1}; var keysBefore = Object.keys(literal); - if (keysBefore[0] != 'a') return false; + assert.sameValue(keysBefore[0], 'a', 'keysBefore[0]'); keysBefore[0] = 'x'; var keysAfter = Object.keys(literal); - return (keysBefore[0] == 'x') && (keysAfter[0] == 'a'); - } -runTestCase(testcase); + +assert.sameValue(keysBefore[0], 'x', 'keysBefore[0]'); +assert.sameValue(keysAfter[0], 'a', 'keysAfter[0]'); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-10.js b/test/built-ins/Object/keys/15.2.3.14-5-10.js index 1464abd16..7c78da96c 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-10.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-10.js @@ -7,10 +7,8 @@ description: > Object.keys - inherted enumerable accessor property that is over-ridden by non-enumerable own accessor property is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "prop", { get: function () { }, @@ -30,11 +28,5 @@ function testcase() { var arr = Object.keys(obj); for (var p in arr) { - if (arr[p] === "prop") { - return false; - } + assert.notSameValue(arr[p], "prop", 'arr[p]'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-11.js b/test/built-ins/Object/keys/15.2.3.14-5-11.js index 2b34b9927..3a6c31e0c 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-11.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-11.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-11 description: > Object.keys - own enumerable indexed data property of dense array 'O' is defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var obj = [1, 2, 3, 4, 5]; var arr = Object.keys(obj); @@ -17,13 +15,7 @@ function testcase() { var initValue = 0; for (var p in arr) { if (arr.hasOwnProperty(p)) { - if (arr[p] !== initValue.toString()) { - return false; - } + assert.sameValue(arr[p], initValue.toString(), 'arr[p]'); initValue++; } } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-12.js b/test/built-ins/Object/keys/15.2.3.14-5-12.js index b4f7a73ea..0e565cc0d 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-12.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-12.js @@ -6,10 +6,10 @@ es5id: 15.2.3.14-5-12 description: > Object.keys - own enumerable indexed accessor property of dense array 'O' is defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = [2, 3, 4, 5]; Object.defineProperty(obj, "prop", { @@ -25,11 +25,10 @@ function testcase() { for (var p in arr) { if (arr.hasOwnProperty(p)) { if (arr[p] === "prop") { - return true; + propertyFound = true; + break; } } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-13.js b/test/built-ins/Object/keys/15.2.3.14-5-13.js index 61115cfca..1dd461cab 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-13.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-13.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-13 description: > Object.keys - own enumerable indexed data property of sparse array 'O' is defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var obj = [1, , 3, , 5]; Object.defineProperty(obj, 5, { @@ -29,16 +27,9 @@ function testcase() { var index; var initValue = 0; for (index = 0; index < 3; index++) { - if (arr[index] !== initValue.toString()) { - return false; - } + assert.sameValue(arr[index], initValue.toString(), 'Unexpected property at index: ' + index); initValue += 2; } - if (arr.length !== 4 || arr[3] !== "10000") { - return false; - } - - return true; - } -runTestCase(testcase); +assert.sameValue(arr.length, 4, 'arr.length'); +assert.sameValue(arr[3], "10000", 'arr[3]'); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-14.js b/test/built-ins/Object/keys/15.2.3.14-5-14.js index 9d151e965..6b9c3ae25 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-14.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-14.js @@ -6,10 +6,10 @@ es5id: 15.2.3.14-5-14 description: > Object.keys - own enumerable indexed accessor property of sparse array 'O' is defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { +var propertyFound = false; + var obj = [1, , 3, , 5]; Object.defineProperty(obj, "10000", { @@ -24,10 +24,9 @@ function testcase() { for (var p in arr) { if (arr[p] === "10000") { - return true; + propertyFound = true; + break; } } - return false; - } -runTestCase(testcase); +assert(propertyFound, 'Property not found'); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-15.js b/test/built-ins/Object/keys/15.2.3.14-5-15.js index 963e05313..c7805c030 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-15.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-15.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-15 description: > Object.keys - own enumerable indexed data property of String object 'O' is defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var obj = new String("xyz"); obj[-20] = -20; obj[20] = 20; @@ -23,11 +21,5 @@ function testcase() { var arr = Object.keys(obj); for (var i = 0; i < arr.length; i++) { - if (!obj.hasOwnProperty(arr[i])) { - return false; - } + assert(obj.hasOwnProperty(arr[i]), 'obj.hasOwnProperty(arr[i]) !== true'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-16.js b/test/built-ins/Object/keys/15.2.3.14-5-16.js index d16516703..1031fd08c 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-16.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-16.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-16 description: > Object.keys - own enumerable indexed accessor property of String object 'O' is defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var obj = new String("xyz"); obj[-20] = -20; obj[20] = 20; @@ -28,11 +26,5 @@ function testcase() { var arr = Object.keys(obj); for (var i = 0; i < arr.length; i++) { - if (!obj.hasOwnProperty(arr[i])) { - return false; - } + assert(obj.hasOwnProperty(arr[i]), 'obj.hasOwnProperty(arr[i]) !== true'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-3.js b/test/built-ins/Object/keys/15.2.3.14-5-3.js index 034d6b171..45d321cfe 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-3.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-3.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-3 description: > Object.keys - non-enumerable own data property of 'O' is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { prop1: 1001, prop2: 1002 }; Object.defineProperty(obj, "prop3", { @@ -28,12 +26,6 @@ function testcase() { for (var p in arr) { if (arr.hasOwnProperty(p)) { - if (arr[p] === "prop4") { - return false; - } + assert.notSameValue(arr[p], "prop4", 'arr[p]'); } } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-4.js b/test/built-ins/Object/keys/15.2.3.14-5-4.js index 8a81da67b..ed6346c08 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-4.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-4.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-4 description: > Object.keys - non-enumerable own accessor property of 'O' is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var obj = {}; Object.defineProperty(obj, "prop1", { @@ -32,12 +30,6 @@ function testcase() { for (var p in arr) { if (arr.hasOwnProperty(p)) { - if (arr[p] === "prop2") { - return false; - } + assert.notSameValue(arr[p], "prop2", 'arr[p]'); } } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-5.js b/test/built-ins/Object/keys/15.2.3.14-5-5.js index 253272d94..996f595a1 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-5.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-5.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-5 description: > Object.keys - inherited enumerable data property of 'O' is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "inheritedProp", { value: 1003, @@ -25,11 +23,5 @@ function testcase() { var arr = Object.keys(obj); for (var p in arr) { - if (arr[p] === "inheritedProp") { - return false; - } + assert.notSameValue(arr[p], "inheritedProp", 'arr[p]'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-6.js b/test/built-ins/Object/keys/15.2.3.14-5-6.js index aeee771d6..104055137 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-6.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-6.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-5-6 description: > Object.keys - inherited enumerable accessor property of 'O' is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "inheritedProp", { get: function () { @@ -33,11 +31,5 @@ function testcase() { var arr = Object.keys(obj); for (var p in arr) { - if (arr[p] === "inheritedProp") { - return false; - } + assert.notSameValue(arr[p], "inheritedProp", 'arr[p]'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-7.js b/test/built-ins/Object/keys/15.2.3.14-5-7.js index c855bf7d9..8fb146cd2 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-7.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-7.js @@ -7,10 +7,8 @@ description: > Object.keys - inherted enumerable data property that is over-ridden by non-enumerable own data property is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "prop", { value: 1003, @@ -30,11 +28,5 @@ function testcase() { var arr = Object.keys(obj); for (var p in arr) { - if (arr[p] === "prop") { - return false; - } + assert.notSameValue(arr[p], "prop", 'arr[p]'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-8.js b/test/built-ins/Object/keys/15.2.3.14-5-8.js index d664f67f8..37acf9b4f 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-8.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-8.js @@ -7,10 +7,8 @@ description: > Object.keys - inherted enumerable data property that is over-ridden by non-enumerable own accessor property is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "prop", { value: 1003, @@ -30,11 +28,5 @@ function testcase() { var arr = Object.keys(obj); for (var p in arr) { - if (arr[p] === "prop") { - return false; - } + assert.notSameValue(arr[p], "prop", 'arr[p]'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-9.js b/test/built-ins/Object/keys/15.2.3.14-5-9.js index 00f5ae514..f88c546c0 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-9.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-9.js @@ -7,10 +7,8 @@ description: > Object.keys - inherted enumerable accessor property that is over-ridden by non-enumerable own data property is not defined in returned array -includes: [runTestCase.js] ---*/ -function testcase() { var proto = {}; Object.defineProperty(proto, "prop", { get: function () { }, @@ -30,11 +28,5 @@ function testcase() { var arr = Object.keys(obj); for (var p in arr) { - if (arr[p] === "prop") { - return false; - } + assert.notSameValue(arr[p], "prop", 'arr[p]'); } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-a-2.js b/test/built-ins/Object/keys/15.2.3.14-5-a-2.js index 06dd86fac..10f811ac6 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-a-2.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-a-2.js @@ -6,22 +6,16 @@ es5id: 15.2.3.14-5-a-2 description: > Object.keys - 'writable' attribute of element of returned array is correct -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { prop1: 100 }; var array = Object.keys(obj); - try { array[0] = "isWritable"; var desc = Object.getOwnPropertyDescriptor(array, "0"); - return array[0] === "isWritable" && desc.hasOwnProperty("writable") && desc.writable === true; - } catch (e) { - return false; - } - } -runTestCase(testcase); +assert.sameValue(array[0], "isWritable", 'array[0]'); +assert(desc.hasOwnProperty("writable"), 'desc.hasOwnProperty("writable") !== true'); +assert.sameValue(desc.writable, true, 'desc.writable'); diff --git a/test/built-ins/Object/keys/15.2.3.14-5-b-1.js b/test/built-ins/Object/keys/15.2.3.14-5-b-1.js index 72af838c1..6c5766333 100644 --- a/test/built-ins/Object/keys/15.2.3.14-5-b-1.js +++ b/test/built-ins/Object/keys/15.2.3.14-5-b-1.js @@ -4,10 +4,8 @@ /*--- es5id: 15.2.3.14-5-b-1 description: Object.keys - Verify that 'index' of returned array is ascend by 1 -includes: [runTestCase.js] ---*/ -function testcase() { var obj = { prop1: 100, prop2: 200, prop3: 300 }; var array = Object.keys(obj); @@ -15,13 +13,7 @@ function testcase() { var idx = 0; for (var index in array) { if (array.hasOwnProperty(index)) { - if (index !== idx.toString()) { - return false; - } + assert.sameValue(index, idx.toString(), 'index'); idx++; } } - - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-6-1.js b/test/built-ins/Object/keys/15.2.3.14-6-1.js index bb9e7da6b..884abd796 100644 --- a/test/built-ins/Object/keys/15.2.3.14-6-1.js +++ b/test/built-ins/Object/keys/15.2.3.14-6-1.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-6-1 description: > Object.keys - the order of elements in returned array is the same with the order of properties in 'O' (dense array) -includes: [runTestCase.js] ---*/ -function testcase() { var denseArray = [1, 2, 3]; var tempArray = []; @@ -22,11 +20,5 @@ function testcase() { var returnedArray = Object.keys(denseArray); for (var index in returnedArray) { - if (tempArray[index] !== returnedArray[index]) { - return false; - } + assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); } - return true; - - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-6-2.js b/test/built-ins/Object/keys/15.2.3.14-6-2.js index 4d9d980c6..c3a1537e0 100644 --- a/test/built-ins/Object/keys/15.2.3.14-6-2.js +++ b/test/built-ins/Object/keys/15.2.3.14-6-2.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-6-2 description: > Object.keys - the order of elements in returned array is the same with the order of properties in 'O' (sparse array) -includes: [runTestCase.js] ---*/ -function testcase() { var sparseArray = [1, 2, , 4, , 6]; var tempArray = []; @@ -22,10 +20,5 @@ function testcase() { var returnedArray = Object.keys(sparseArray); for (var index in returnedArray) { - if (tempArray[index] !== returnedArray[index]) { - return false; - } + assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-6-3.js b/test/built-ins/Object/keys/15.2.3.14-6-3.js index 26ff8a89e..108056b33 100644 --- a/test/built-ins/Object/keys/15.2.3.14-6-3.js +++ b/test/built-ins/Object/keys/15.2.3.14-6-3.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-6-3 description: > Object.keys - the order of elements in returned array is the same with the order of properties in 'O' (String object) -includes: [runTestCase.js] ---*/ -function testcase() { var str = new String("abc"); var tempArray = []; @@ -22,10 +20,5 @@ function testcase() { var returnedArray = Object.keys(str); for (var index in returnedArray) { - if (tempArray[index] !== returnedArray[index]) { - return false; - } + assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-6-4.js b/test/built-ins/Object/keys/15.2.3.14-6-4.js index 02cd2f124..b10ea7615 100644 --- a/test/built-ins/Object/keys/15.2.3.14-6-4.js +++ b/test/built-ins/Object/keys/15.2.3.14-6-4.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-6-4 description: > Object.keys - the order of elements in returned array is the same with the order of properties in 'O' (Arguments object) -includes: [runTestCase.js] ---*/ -function testcase() { var func = function (a, b, c) { return arguments; }; @@ -26,10 +24,5 @@ function testcase() { var returnedArray = Object.keys(args); for (var index in returnedArray) { - if (tempArray[index] !== returnedArray[index]) { - return false; - } + assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-6-5.js b/test/built-ins/Object/keys/15.2.3.14-6-5.js index 53a1516df..9e5984a78 100644 --- a/test/built-ins/Object/keys/15.2.3.14-6-5.js +++ b/test/built-ins/Object/keys/15.2.3.14-6-5.js @@ -6,10 +6,8 @@ es5id: 15.2.3.14-6-5 description: > Object.keys - the order of elements in returned array is the same with the order of properties in 'O' (any other built-in object) -includes: [runTestCase.js] ---*/ -function testcase() { var obj = new Date(); obj.prop1 = 100; obj.prop2 = "prop2"; @@ -24,10 +22,5 @@ function testcase() { var returnedArray = Object.keys(obj); for (var index in returnedArray) { - if (tempArray[index] !== returnedArray[index]) { - return false; - } + assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/Object/keys/15.2.3.14-6-6.js b/test/built-ins/Object/keys/15.2.3.14-6-6.js index ba6114358..5322bd3b5 100644 --- a/test/built-ins/Object/keys/15.2.3.14-6-6.js +++ b/test/built-ins/Object/keys/15.2.3.14-6-6.js @@ -6,12 +6,9 @@ es5id: 15.2.3.14-6-6 description: > Object.keys - the order of elements in returned array is the same with the order of properties in 'O' (global Object) -includes: - - runTestCase.js - - fnGlobalObject.js +includes: [fnGlobalObject.js] ---*/ -function testcase() { var obj = fnGlobalObject(); var tempArray = []; @@ -24,10 +21,5 @@ function testcase() { var returnedArray = Object.keys(obj); for (var index in returnedArray) { - if (tempArray[index] !== returnedArray[index]) { - return false; - } + assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); } - return true; - } -runTestCase(testcase); diff --git a/test/built-ins/undefined/15.1.1.3-1.js b/test/built-ins/undefined/15.1.1.3-1.js index 586e7b5c9..8f07eb4e2 100644 --- a/test/built-ins/undefined/15.1.1.3-1.js +++ b/test/built-ins/undefined/15.1.1.3-1.js @@ -5,17 +5,10 @@ es5id: 15.1.1.3-1 description: undefined is not writable, should not throw in non-strict mode flags: [noStrict] -includes: [runTestCase.js] ---*/ -function testcase(){ - undefined = 5; - if(typeof undefined !== "undefined") return false; +undefined = 5; +assert.sameValue(typeof undefined, "undefined", 'typeof undefined'); - var nosuchproperty; - if(nosuchproperty !== undefined) return false; - - return true; -} - -runTestCase(testcase); +var nosuchproperty; +assert.sameValue(nosuchproperty, undefined, 'nosuchproperty'); |