Replace runTestCase with assert helpers [test/built-ins/Array/prototype/forEach]

This commit is contained in:
André Bargull 2015-08-06 18:14:23 +02:00
parent ce98c25647
commit e8246fd9f0
140 changed files with 243 additions and 852 deletions

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-0-1 es5id: 15.4.4.18-0-1
description: Array.prototype.forEach must exist as a function description: Array.prototype.forEach must exist as a function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var f = Array.prototype.forEach; var f = Array.prototype.forEach;
if (typeof(f) === "function") {
return true; assert.sameValue(typeof(f), "function", 'typeof(f)');
}
}
runTestCase(testcase);

View File

@ -4,12 +4,6 @@
/*--- /*---
es5id: 15.4.4.18-0-2 es5id: 15.4.4.18-0-2
description: Array.prototype.forEach.length must be 1 description: Array.prototype.forEach.length must be 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.prototype.forEach.length, 1, 'Array.prototype.forEach.length');
if (Array.prototype.forEach.length === 1) {
return true;
}
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-11 es5id: 15.4.4.18-1-11
description: Array.prototype.forEach applied to Date object description: Array.prototype.forEach applied to Date object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Date; result = obj instanceof Date;
@ -18,6 +16,5 @@ function testcase() {
obj[0] = 1; obj[0] = 1;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-12 es5id: 15.4.4.18-1-12
description: Array.prototype.forEach applied to RegExp object description: Array.prototype.forEach applied to RegExp object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof RegExp; result = obj instanceof RegExp;
@ -18,6 +16,5 @@ function testcase() {
obj[0] = 1; obj[0] = 1;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-14 es5id: 15.4.4.18-1-14
description: Array.prototype.forEach applied to Error object description: Array.prototype.forEach applied to Error object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Error; result = obj instanceof Error;
@ -18,6 +16,5 @@ function testcase() {
obj[0] = 1; obj[0] = 1;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-15 es5id: 15.4.4.18-1-15
description: Array.prototype.forEach applied to the Arguments object description: Array.prototype.forEach applied to the Arguments object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = ('[object Arguments]' === Object.prototype.toString.call(obj)); result = ('[object Arguments]' === Object.prototype.toString.call(obj));
@ -18,6 +16,5 @@ function testcase() {
}("a", "b")); }("a", "b"));
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-4 es5id: 15.4.4.18-1-4
description: Array.prototype.forEach applied to Boolean object description: Array.prototype.forEach applied to Boolean object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Boolean; result = obj instanceof Boolean;
@ -19,6 +17,5 @@ function testcase() {
obj[1] = 12; obj[1] = 12;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-6 es5id: 15.4.4.18-1-6
description: Array.prototype.forEach applied to Number object description: Array.prototype.forEach applied to Number object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Number; result = obj instanceof Number;
@ -20,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result; assert(result, 'result !== true');
}
runTestCase(testcase);

View File

@ -4,16 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-1-7 es5id: 15.4.4.18-1-7
description: Array.prototype.forEach applied to string primitive description: Array.prototype.forEach applied to string primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof String; result = obj instanceof String;
} }
Array.prototype.forEach.call("abc", callbackfn); Array.prototype.forEach.call("abc", callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-8 es5id: 15.4.4.18-1-8
description: Array.prototype.forEach applied to String object description: Array.prototype.forEach applied to String object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof String; result = obj instanceof String;
@ -16,6 +14,4 @@ function testcase() {
var obj = new String("abc"); var obj = new String("abc");
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result; assert(result, 'result !== true');
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-1-9 es5id: 15.4.4.18-1-9
description: Array.prototype.forEach applied to Function object description: Array.prototype.forEach applied to Function object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Function; result = obj instanceof Function;
@ -20,6 +18,5 @@ function testcase() {
obj[1] = 9; obj[1] = 9;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-1
description: > description: >
Array.prototype.forEach - 'length' is own data property on an Array.prototype.forEach - 'length' is own data property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -23,6 +21,5 @@ function testcase() {
}; };
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-10
description: > description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an inherited accessor property an inherited accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -33,6 +31,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-2-11
description: > description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an own accessor property without a get function an own accessor property without a get function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
@ -26,6 +23,5 @@ function testcase() {
}); });
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed;
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-2-13
description: > description: >
Array.prototype.forEach applied to the Array-like object that Array.prototype.forEach applied to the Array-like object that
'length' is inherited accessor property without a get function 'length' is inherited accessor property without a get function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -31,6 +28,5 @@ function testcase() {
child[1] = 12; child[1] = 12;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return !accessed;
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-2-14
description: > description: >
Array.prototype.forEach applied to the Array-like object that Array.prototype.forEach applied to the Array-like object that
'length' property doesn't exist 'length' property doesn't exist
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,7 +17,5 @@ function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed;
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-17
description: > description: >
Array.prototype.forEach applied to the Arguments object, which Array.prototype.forEach applied to the Arguments object, which
implements its own property get method implements its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -21,6 +19,4 @@ function testcase() {
return result; return result;
}; };
return func(12, 11); assert(func(12, 11), 'func(12, 11) !== true');
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-18
description: > description: >
Array.prototype.forEach applied to String object, which implements Array.prototype.forEach applied to String object, which implements
its own property get method its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 3); result = (obj.length === 3);
@ -18,6 +16,5 @@ function testcase() {
var str = new String("012"); var str = new String("012");
Array.prototype.forEach.call(str, callbackfn); Array.prototype.forEach.call(str, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-19
description: > description: >
Array.prototype.forEach applied to Function object, which Array.prototype.forEach applied to Function object, which
implements its own property get method implements its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -23,6 +21,5 @@ function testcase() {
fun[2] = 9; fun[2] = 9;
Array.prototype.forEach.call(fun, callbackfn); Array.prototype.forEach.call(fun, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,16 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-2-2 es5id: 15.4.4.18-2-2
description: Array.prototype.forEach - 'length' is own data property on an Array description: Array.prototype.forEach - 'length' is own data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
} }
[12, 11].forEach(callbackfn); [12, 11].forEach(callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-3
description: > description: >
Array.prototype.forEach - 'length' is an own data property that Array.prototype.forEach - 'length' is an own data property that
overrides an inherited data property on an Array-like object overrides an inherited data property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -27,6 +25,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-5
description: > description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an own data property that overrides an inherited accessor property an own data property that overrides an inherited accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -37,6 +35,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-6
description: > description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an inherited data property an inherited data property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -26,6 +24,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-7
description: > description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an own accessor property an own accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -29,6 +27,5 @@ function testcase() {
obj[2] = 9; obj[2] = 9;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-2-8
description: > description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an own accessor property that overrides an inherited data property an own accessor property that overrides an inherited data property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -34,6 +32,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.forEach applied to Array-like object, 'length' is Array.prototype.forEach applied to Array-like object, 'length' is
an own accessor property that overrides an inherited accessor an own accessor property that overrides an inherited accessor
property property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
@ -42,6 +40,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-3-1 es5id: 15.4.4.18-3-1
description: Array.prototype.forEach - value of 'length' is undefined description: Array.prototype.forEach - value of 'length' is undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -19,6 +16,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-10
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
NaN) NaN)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-11
description: > description: >
Array.prototype.forEach - 'length' is a string containing a Array.prototype.forEach - 'length' is a string containing a
positive number positive number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-12
description: > description: >
Array.prototype.forEach - 'length' is a string containing a Array.prototype.forEach - 'length' is a string containing a
negative number negative number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !testResult; assert.sameValue(testResult, false, 'testResult');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-13
description: > description: >
Array.prototype.forEach - 'length' is a string containing a Array.prototype.forEach - 'length' is a string containing a
decimal number decimal number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,6 +17,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-3-14 es5id: 15.4.4.18-3-14
description: Array.prototype.forEach - 'length' is a string containing -Infinity description: Array.prototype.forEach - 'length' is a string containing -Infinity
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed2 = false; var accessed2 = false;
function callbackfn2(val, idx, obj) { function callbackfn2(val, idx, obj) {
@ -19,6 +16,4 @@ function testcase() {
Array.prototype.forEach.call(obj2, callbackfn2); Array.prototype.forEach.call(obj2, callbackfn2);
return !accessed2; assert.sameValue(accessed2, false, 'accessed2');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-15
description: > description: >
Array.prototype.forEach - 'length' is a string containing an Array.prototype.forEach - 'length' is a string containing an
exponential number exponential number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,6 +17,5 @@ function testcase() {
var obj = { 1: 11, 2: 9, length: "2E0" }; var obj = { 1: 11, 2: 9, length: "2E0" };
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult;
} assert(testResult, 'testResult !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-16
description: > description: >
Array.prototype.forEach - 'length' is a string containing a hex Array.prototype.forEach - 'length' is a string containing a hex
number number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-17
description: > description: >
Array.prototype.forEach - 'length' is a string containing a number Array.prototype.forEach - 'length' is a string containing a number
with leading zeros with leading zeros
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-18
description: > description: >
Array.prototype.forEach - value of 'length' is a string that can't Array.prototype.forEach - value of 'length' is a string that can't
convert to a number convert to a number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-19
description: > description: >
Array.prototype.forEach - value of 'length' is an Object which has Array.prototype.forEach - value of 'length' is an Object which has
an own toString method. an own toString method.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -29,6 +26,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-2
description: > description: >
Array.prototype.forEach - value of 'length' is a boolean (value is Array.prototype.forEach - value of 'length' is a boolean (value is
true) true)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
testResult = (val > 10); testResult = (val > 10);
@ -20,6 +17,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-20
description: > description: >
Array.prototype.forEach - value of 'length' is an Object which has Array.prototype.forEach - value of 'length' is an Object which has
an own valueOf method. an own valueOf method.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -29,6 +26,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - 'length' is an object that has an own Array.prototype.forEach - 'length' is an object that has an own
valueOf method that returns an object and toString method that valueOf method that returns an object and toString method that
returns a string returns a string
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
var firstStepOccured = false; var firstStepOccured = false;
var secondStepOccured = false; var secondStepOccured = false;
@ -37,6 +34,6 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult && firstStepOccured && secondStepOccured; assert(testResult, 'testResult !== true');
} assert(firstStepOccured, 'firstStepOccured !== true');
runTestCase(testcase); assert(secondStepOccured, 'secondStepOccured !== true');

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach uses inherited valueOf method when Array.prototype.forEach uses inherited valueOf method when
'length' is an object with an own toString and inherited valueOf 'length' is an object with an own toString and inherited valueOf
methods methods
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
var valueOfAccessed = false; var valueOfAccessed = false;
var toStringAccessed = false; var toStringAccessed = false;
@ -45,6 +42,6 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult && valueOfAccessed && !toStringAccessed; assert(testResult, 'testResult !== true');
} assert(valueOfAccessed, 'valueOfAccessed !== true');
runTestCase(testcase); assert.sameValue(toStringAccessed, false, 'toStringAccessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-24
description: > description: >
Array.prototype.forEach - value of 'length' is a positive Array.prototype.forEach - value of 'length' is a positive
non-integer, ensure truncation occurs in the proper direction non-integer, ensure truncation occurs in the proper direction
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -25,6 +22,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-25
description: > description: >
Array.prototype.forEach - value of 'length' is a negative Array.prototype.forEach - value of 'length' is a negative
non-integer non-integer
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -25,6 +22,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !testResult; assert.sameValue(testResult, false, 'testResult');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-3
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
0) 0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-4
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
+0) +0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-5
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
-0) -0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-6
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
positive) positive)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult1 = false; var testResult1 = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult1; assert(testResult1, 'testResult1 !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-7
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
negative) negative)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult1 = false; var testResult1 = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !testResult1; assert.sameValue(testResult1, false, 'testResult1');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-3-9
description: > description: >
Array.prototype.forEach - value of 'length' is a number (value is Array.prototype.forEach - value of 'length' is a number (value is
-Infinity) -Infinity)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed; assert.sameValue(accessed, false, 'accessed');
}
runTestCase(testcase);

View File

@ -4,17 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-4-12 es5id: 15.4.4.18-4-12
description: Array.prototype.forEach - 'callbackfn' is a function description: Array.prototype.forEach - 'callbackfn' is a function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
} }
[11, 9].forEach(callbackfn); [11, 9].forEach(callbackfn);
return accessed;
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -5,10 +5,8 @@
es5id: 15.4.4.18-5-1-s es5id: 15.4.4.18-5-1-s
description: Array.prototype.forEach - thisArg not passed to strict callbackfn description: Array.prototype.forEach - thisArg not passed to strict callbackfn
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var innerThisCorrect = false; var innerThisCorrect = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,6 +16,5 @@ function testcase() {
} }
[1].forEach(callbackfn); [1].forEach(callbackfn);
return innerThisCorrect;
} assert(innerThisCorrect, 'innerThisCorrect !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-10 es5id: 15.4.4.18-5-10
description: Array.prototype.forEach - Array Object can be used as thisArg description: Array.prototype.forEach - Array Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objArray = []; var objArray = [];
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objArray); [11].forEach(callbackfn, objArray);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-11 es5id: 15.4.4.18-5-11
description: Array.prototype.forEach - String Object can be used as thisArg description: Array.prototype.forEach - String Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objString = new String(); var objString = new String();
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objString); [11].forEach(callbackfn, objString);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-12 es5id: 15.4.4.18-5-12
description: Array.prototype.forEach - Boolean Object can be used as thisArg description: Array.prototype.forEach - Boolean Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objBoolean = new Boolean(); var objBoolean = new Boolean();
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objBoolean); [11].forEach(callbackfn, objBoolean);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-13 es5id: 15.4.4.18-5-13
description: Array.prototype.forEach - Number Object can be used as thisArg description: Array.prototype.forEach - Number Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objNumber = new Number(); var objNumber = new Number();
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objNumber); [11].forEach(callbackfn, objNumber);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,17 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-5-14 es5id: 15.4.4.18-5-14
description: Array.prototype.forEach - the Math object can be used as thisArg description: Array.prototype.forEach - the Math object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (this === Math); result = (this === Math);
} }
[11].forEach(callbackfn, Math); [11].forEach(callbackfn, Math);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-15 es5id: 15.4.4.18-5-15
description: Array.prototype.forEach - Date Object can be used as thisArg description: Array.prototype.forEach - Date Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objDate = new Date(); var objDate = new Date();
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objDate); [11].forEach(callbackfn, objDate);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-16 es5id: 15.4.4.18-5-16
description: Array.prototype.forEach - RegExp Object can be used as thisArg description: Array.prototype.forEach - RegExp Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objRegExp = new RegExp(); var objRegExp = new RegExp();
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objRegExp); [11].forEach(callbackfn, objRegExp);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,17 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-5-17 es5id: 15.4.4.18-5-17
description: Array.prototype.forEach - the JSON object can be used as thisArg description: Array.prototype.forEach - the JSON object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (this === JSON); result = (this === JSON);
} }
[11].forEach(callbackfn, JSON); [11].forEach(callbackfn, JSON);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-18 es5id: 15.4.4.18-5-18
description: Array.prototype.forEach - Error Object can be used as thisArg description: Array.prototype.forEach - Error Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objError = new RangeError(); var objError = new RangeError();
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objError); [11].forEach(callbackfn, objError);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-5-19
description: > description: >
Array.prototype.forEach - the Arguments object can be used as Array.prototype.forEach - the Arguments object can be used as
thisArg thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var arg; var arg;
@ -23,6 +20,5 @@ function testcase() {
}(1, 2, 3)); }(1, 2, 3));
[11].forEach(callbackfn, arg); [11].forEach(callbackfn, arg);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-2 es5id: 15.4.4.18-5-2
description: Array.prototype.forEach - thisArg is Object description: Array.prototype.forEach - thisArg is Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
var o = new Object(); var o = new Object();
o.res = true; o.res = true;
@ -19,8 +17,5 @@ function testcase() {
var arr = [1]; var arr = [1];
arr.forEach(callbackfn,o) arr.forEach(callbackfn,o)
if( result === true)
return true;
} assert.sameValue(result, true, 'result');
runTestCase(testcase);

View File

@ -4,19 +4,14 @@
/*--- /*---
es5id: 15.4.4.18-5-21 es5id: 15.4.4.18-5-21
description: Array.prototype.forEach - the global object can be used as thisArg description: Array.prototype.forEach - the global object can be used as thisArg
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (this === fnGlobalObject()); result = (this === fnGlobalObject());
} }
[11].forEach(callbackfn, fnGlobalObject()); [11].forEach(callbackfn, fnGlobalObject());
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-22 es5id: 15.4.4.18-5-22
description: Array.prototype.forEach - boolean primitive can be used as thisArg description: Array.prototype.forEach - boolean primitive can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -16,6 +13,5 @@ function testcase() {
} }
[11].forEach(callbackfn, false); [11].forEach(callbackfn, false);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,17 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-5-23 es5id: 15.4.4.18-5-23
description: Array.prototype.forEach - number primitive can be used as thisArg description: Array.prototype.forEach - number primitive can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (this.valueOf() === 101); result = (this.valueOf() === 101);
} }
[11].forEach(callbackfn, 101); [11].forEach(callbackfn, 101);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,17 +4,13 @@
/*--- /*---
es5id: 15.4.4.18-5-24 es5id: 15.4.4.18-5-24
description: Array.prototype.forEach - string primitive can be used as thisArg description: Array.prototype.forEach - string primitive can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (this.valueOf() === "abc"); result = (this.valueOf() === "abc");
} }
[11].forEach(callbackfn, "abc"); [11].forEach(callbackfn, "abc");
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -5,10 +5,8 @@
es5id: 15.4.4.18-5-25 es5id: 15.4.4.18-5-25
description: Array.prototype.forEach - thisArg not passed description: Array.prototype.forEach - thisArg not passed
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function innerObj() { function innerObj() {
this._15_4_4_18_5_25 = true; this._15_4_4_18_5_25 = true;
var _15_4_4_18_5_25 = false; var _15_4_4_18_5_25 = false;
@ -20,6 +18,5 @@ function testcase() {
arr.forEach(callbackfn) arr.forEach(callbackfn)
this.retVal = !result; this.retVal = !result;
} }
return new innerObj().retVal;
} assert(new innerObj().retVal, 'new innerObj().retVal !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-3 es5id: 15.4.4.18-5-3
description: Array.prototype.forEach - thisArg is Array description: Array.prototype.forEach - thisArg is Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
var a = new Array(); var a = new Array();
a.res = true; a.res = true;
@ -19,8 +17,5 @@ function testcase() {
var arr = [1]; var arr = [1];
arr.forEach(callbackfn,a) arr.forEach(callbackfn,a)
if( result === true)
return true;
} assert.sameValue(result, true, 'result');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.18-5-4
description: > description: >
Array.prototype.forEach - thisArg is object from object Array.prototype.forEach - thisArg is object from object
template(prototype) template(prototype)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
var result; var result;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
@ -22,8 +20,5 @@ function testcase() {
var f = new foo(); var f = new foo();
var arr = [1]; var arr = [1];
arr.forEach(callbackfn,f) arr.forEach(callbackfn,f)
if( result === true)
return true;
} assert.sameValue(result, true, 'result');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-5 es5id: 15.4.4.18-5-5
description: Array.prototype.forEach - thisArg is object from object template description: Array.prototype.forEach - thisArg is object from object template
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
var result; var result;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
@ -21,8 +19,5 @@ function testcase() {
var arr = [1]; var arr = [1];
arr.forEach(callbackfn,f) arr.forEach(callbackfn,f)
if( result === true)
return true;
} assert.sameValue(result, true, 'result');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-6 es5id: 15.4.4.18-5-6
description: Array.prototype.forEach - thisArg is function description: Array.prototype.forEach - thisArg is function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
var result; var result;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
@ -20,8 +18,5 @@ function testcase() {
var arr = [1]; var arr = [1];
arr.forEach(callbackfn,foo) arr.forEach(callbackfn,foo)
if( result === true)
return true;
} assert.sameValue(result, true, 'result');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-7 es5id: 15.4.4.18-5-7
description: Array.prototype.forEach - built-in functions can be used as thisArg description: Array.prototype.forEach - built-in functions can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -16,6 +13,5 @@ function testcase() {
} }
[11].forEach(callbackfn, eval); [11].forEach(callbackfn, eval);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-5-9 es5id: 15.4.4.18-5-9
description: Array.prototype.forEach - Function Object can be used as thisArg description: Array.prototype.forEach - Function Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var objString = function () { }; var objString = function () { };
@ -17,6 +14,5 @@ function testcase() {
} }
[11].forEach(callbackfn, objString); [11].forEach(callbackfn, objString);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-1
description: > description: >
Array.prototype.forEach doesn't consider new elements added to Array.prototype.forEach doesn't consider new elements added to
array after the call array after the call
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -21,7 +18,5 @@ function testcase() {
var arr = [1,2,,4,5]; var arr = [1,2,,4,5];
arr.forEach(callbackfn); arr.forEach(callbackfn);
if( callCnt === 5)
return true; assert.sameValue(callCnt, 5, 'callCnt');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-2
description: > description: >
Array.prototype.forEach doesn't visit deleted elements in array Array.prototype.forEach doesn't visit deleted elements in array
after the call after the call
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -21,8 +18,5 @@ function testcase() {
var arr = [1,2,3,4,5]; var arr = [1,2,3,4,5];
arr.forEach(callbackfn) arr.forEach(callbackfn)
if( callCnt === 4)
return true; assert.sameValue(callCnt, 4, 'callCnt');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-3
description: > description: >
Array.prototype.forEach doesn't visit deleted elements when Array.prototype.forEach doesn't visit deleted elements when
Array.length is decreased Array.length is decreased
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -20,8 +17,5 @@ function testcase() {
var arr = [1,2,3,4,5]; var arr = [1,2,3,4,5];
arr.forEach(callbackfn); arr.forEach(callbackfn);
if( callCnt === 3)
return true; assert.sameValue(callCnt, 3, 'callCnt');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-4
description: > description: >
Array.prototype.forEach doesn't consider newly added elements in Array.prototype.forEach doesn't consider newly added elements in
sparse array sparse array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -22,8 +19,5 @@ function testcase() {
arr[1] = 1; arr[1] = 1;
arr[2] = 2; arr[2] = 2;
arr.forEach(callbackfn); arr.forEach(callbackfn);
if( callCnt === 2)
return true; assert.sameValue(callCnt, 2, 'callCnt');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-5
description: > description: >
Array.prototype.forEach visits deleted element in array after the Array.prototype.forEach visits deleted element in array after the
call when same index is also present in prototype call when same index is also present in prototype
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -23,8 +20,5 @@ function testcase() {
var arr = [1,2,3,4,5]; var arr = [1,2,3,4,5];
arr.forEach(callbackfn) arr.forEach(callbackfn)
delete Array.prototype[4]; delete Array.prototype[4];
if( callCnt === 5)
return true; assert.sameValue(callCnt, 5, 'callCnt');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-7
description: > description: >
Array.prototype.forEach - considers new value of elements in array Array.prototype.forEach - considers new value of elements in array
after the call after the call
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var arr = [1, 2, 3, 4, 5]; var arr = [1, 2, 3, 4, 5];
@ -22,6 +19,5 @@ function testcase() {
} }
arr.forEach(callbackfn); arr.forEach(callbackfn);
return result;
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.18-7-8 es5id: 15.4.4.18-7-8
description: Array.prototype.forEach - no observable effects occur if len is 0 description: Array.prototype.forEach - no observable effects occur if len is 0
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -17,6 +15,5 @@ function testcase() {
var obj = { 0: 11, 1: 12, length: 0 }; var obj = { 0: 11, 1: 12, length: 0 };
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed;
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-9
description: > description: >
Array.prototype.forEach - modifications to length don't change Array.prototype.forEach - modifications to length don't change
number of iterations number of iterations
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var called = 0; var called = 0;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
called++; called++;
@ -27,6 +24,5 @@ function testcase() {
}); });
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return 2 === called;
} assert.sameValue(called, 2, 'called');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-1
description: > description: >
Array.prototype.forEach - callbackfn not called for indexes never Array.prototype.forEach - callbackfn not called for indexes never
been assigned values been assigned values
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -20,7 +17,5 @@ function testcase() {
var arr = new Array(10); var arr = new Array(10);
arr[1] = undefined; arr[1] = undefined;
arr.forEach(callbackfn); arr.forEach(callbackfn);
if( callCnt === 1)
return true; assert.sameValue(callCnt, 1, 'callCnt');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-14
description: > description: >
Array.prototype.forEach - decreasing length of array causes index Array.prototype.forEach - decreasing length of array causes index
property not to be visited property not to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var testResult = true; var testResult = true;
@ -33,6 +30,5 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult && accessed; assert(testResult, 'testResult !== true');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - decreasing length of array does not Array.prototype.forEach - decreasing length of array does not
delete non-configurable properties delete non-configurable properties
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -39,6 +36,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-2
description: > description: >
Array.prototype.forEach - added properties in step 2 are visible Array.prototype.forEach - added properties in step 2 are visible
here here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -31,6 +28,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-3
description: > description: >
Array.prototype.forEach - deleted properties in step 2 are visible Array.prototype.forEach - deleted properties in step 2 are visible
here here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var testResult = true; var testResult = true;
@ -31,6 +28,6 @@ function testcase() {
}); });
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult && accessed;
} assert(testResult, 'testResult !== true');
runTestCase(testcase); assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-4
description: > description: >
Array.prototype.forEach - properties added into own object after Array.prototype.forEach - properties added into own object after
current position are visited on an Array-like object current position are visited on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -35,6 +32,5 @@ function testcase() {
}); });
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult;
} assert(testResult, 'testResult !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-5
description: > description: >
Array.prototype.forEach - properties added into own object after Array.prototype.forEach - properties added into own object after
current position are visited on an Array current position are visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -35,6 +32,5 @@ function testcase() {
}); });
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult;
} assert(testResult, 'testResult !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-8
description: > description: >
Array.prototype.forEach - deleting own property causes index Array.prototype.forEach - deleting own property causes index
property not to be visited on an Array-like object property not to be visited on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var testResult = true; var testResult = true;
@ -39,6 +36,6 @@ function testcase() {
}); });
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult && accessed;
} assert(testResult, 'testResult !== true');
runTestCase(testcase); assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-9
description: > description: >
Array.prototype.forEach - deleting own property causes index Array.prototype.forEach - deleting own property causes index
property not to be visited on an Array property not to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var testResult = true; var testResult = true;
@ -39,6 +36,6 @@ function testcase() {
}); });
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult && accessed;
} assert(testResult, 'testResult !== true');
runTestCase(testcase); assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-1
description: > description: >
Array.prototype.forEach - element to be retrieved is own data Array.prototype.forEach - element to be retrieved is own data
property on an Array-like object property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var kValue = { }; var kValue = { };
var testResult = false; var testResult = false;
@ -24,6 +21,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-10
description: > description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -30,6 +27,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property that overrides an inherited data property on an property that overrides an inherited data property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -37,6 +34,4 @@ function testcase() {
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property that overrides an inherited accessor property on an property that overrides an inherited accessor property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -45,6 +42,4 @@ function testcase() {
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-15
description: > description: >
Array.prototype.forEach - element to be retrieved is inherited Array.prototype.forEach - element to be retrieved is inherited
accessor property on an Array-like object accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -36,6 +33,4 @@ function testcase() {
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-17
description: > description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property without a get function on an Array-like object property without a get function on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -27,6 +24,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-18
description: > description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property without a get function on an Array property without a get function on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -28,6 +25,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-2
description: > description: >
Array.prototype.forEach - element to be retrieved is own data Array.prototype.forEach - element to be retrieved is own data
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,6 +18,4 @@ function testcase() {
[11].forEach(callbackfn); [11].forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-21
description: > description: >
Array.prototype.forEach - element to be retrieved is inherited Array.prototype.forEach - element to be retrieved is inherited
accessor property without a get function on an Array-like object accessor property without a get function on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -33,6 +30,4 @@ function testcase() {
Array.prototype.forEach.call(child, callbackfn); Array.prototype.forEach.call(child, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - This object is the Arguments object Array.prototype.forEach - This object is the Arguments object
which implements its own property get method (number of arguments which implements its own property get method (number of arguments
is less than number of parameters) is less than number of parameters)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -26,6 +23,4 @@ function testcase() {
func(11); func(11);
return testResult; assert(testResult, 'testResult !== true');
}
runTestCase(testcase);

Some files were not shown because too many files have changed in this diff Show More