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

This commit is contained in:
André Bargull 2015-08-06 18:17:56 +02:00
parent 354b7cc11b
commit e2e4fa4c93
173 changed files with 394 additions and 1079 deletions

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-0-1 es5id: 15.4.4.20-0-1
description: Array.prototype.filter must exist as a function description: Array.prototype.filter must exist as a function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var f = Array.prototype.filter; var f = Array.prototype.filter;
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.20-0-2 es5id: 15.4.4.20-0-2
description: Array.prototype.filter.length must be 1 description: Array.prototype.filter.length must be 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.prototype.filter.length, 1, 'Array.prototype.filter.length');
if (Array.prototype.filter.length === 1) {
return true;
}
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-11 es5id: 15.4.4.20-1-11
description: Array.prototype.filter applied to Date object description: Array.prototype.filter applied to Date object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Date; return obj instanceof Date;
} }
@ -19,6 +16,4 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === 1; assert.sameValue(newArr[0], 1, 'newArr[0]');
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-12 es5id: 15.4.4.20-1-12
description: Array.prototype.filter applied to RegExp object description: Array.prototype.filter applied to RegExp object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof RegExp; return obj instanceof RegExp;
} }
@ -18,6 +15,5 @@ function testcase() {
obj[1] = true; obj[1] = true;
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === true;
} assert.sameValue(newArr[0], true, 'newArr[0]');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-14 es5id: 15.4.4.20-1-14
description: Array.prototype.filter applied to Error object description: Array.prototype.filter applied to Error object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Error; return obj instanceof Error;
} }
@ -19,6 +16,4 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === 1; assert.sameValue(newArr[0], 1, 'newArr[0]');
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-15 es5id: 15.4.4.20-1-15
description: Array.prototype.filter applied to the Arguments object description: Array.prototype.filter applied to the Arguments object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return '[object Arguments]' === Object.prototype.toString.call(obj); return '[object Arguments]' === Object.prototype.toString.call(obj);
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === "a" && newArr[1] === "b"; assert.sameValue(newArr[0], "a", 'newArr[0]');
} assert.sameValue(newArr[1], "b", 'newArr[1]');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-4 es5id: 15.4.4.20-1-4
description: Array.prototype.filter applied to Boolean Object description: Array.prototype.filter applied to Boolean Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Boolean; return obj instanceof Boolean;
} }
@ -20,6 +17,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === 11 && newArr[1] === 12; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert.sameValue(newArr[1], 12, 'newArr[1]');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-6 es5id: 15.4.4.20-1-6
description: Array.prototype.filter applied to Number object description: Array.prototype.filter applied to Number object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Number; return obj instanceof Number;
} }
@ -19,6 +16,6 @@ function testcase() {
obj[1] = 12; obj[1] = 12;
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === 11 && newArr[1] === 12;
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase); assert.sameValue(newArr[1], 12, 'newArr[1]');

View File

@ -4,17 +4,12 @@
/*--- /*---
es5id: 15.4.4.20-1-7 es5id: 15.4.4.20-1-7
description: Array.prototype.filter applied to string primitive description: Array.prototype.filter applied to string primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof String; return obj instanceof String;
} }
var newArr = Array.prototype.filter.call("abc", callbackfn); var newArr = Array.prototype.filter.call("abc", callbackfn);
return newArr[0] === "a"; assert.sameValue(newArr[0], "a", 'newArr[0]');
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-8 es5id: 15.4.4.20-1-8
description: Array.prototype.filter applied to String object description: Array.prototype.filter applied to String object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof String; return obj instanceof String;
} }
@ -15,6 +13,4 @@ function testcase() {
var obj = new String("abc"); var obj = new String("abc");
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === "a"; assert.sameValue(newArr[0], "a", 'newArr[0]');
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-1-9 es5id: 15.4.4.20-1-9
description: Array.prototype.filter applied to Function object description: Array.prototype.filter applied to Function object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Function; return obj instanceof Function;
} }
@ -21,6 +18,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr[0] === 11 && newArr[1] === 9; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert.sameValue(newArr[1], 9, 'newArr[1]');
runTestCase(testcase);

View File

@ -6,25 +6,17 @@ es5id: 15.4.4.20-10-1
description: > description: >
Array.prototype.filter doesn't mutate the Array on which it is Array.prototype.filter doesn't mutate the Array on which it is
called on called on
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
return true; return true;
} }
var srcArr = [1,2,3,4,5]; var srcArr = [1,2,3,4,5];
srcArr.filter(callbackfn); srcArr.filter(callbackfn);
if(srcArr[0] === 1 &&
srcArr[1] === 2 &&
srcArr[2] === 3 &&
srcArr[3] === 4 &&
srcArr[4] === 5)
{
return true;
}
} assert.sameValue(srcArr[0], 1, 'srcArr[0]');
runTestCase(testcase); assert.sameValue(srcArr[1], 2, 'srcArr[1]');
assert.sameValue(srcArr[2], 3, 'srcArr[2]');
assert.sameValue(srcArr[3], 4, 'srcArr[3]');
assert.sameValue(srcArr[4], 5, 'srcArr[4]');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-10-2
description: > description: >
Array.prototype.filter returns new Array with length equal to Array.prototype.filter returns new Array with length equal to
number of true returned by callbackfn number of true returned by callbackfn
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
if(val % 2) if(val % 2)
@ -20,13 +17,8 @@ function testcase() {
} }
var srcArr = [1,2,3,4,5]; var srcArr = [1,2,3,4,5];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if(resArr.length === 3 &&
resArr[0] === 1 &&
resArr[1] === 3 &&
resArr[2] === 5)
{
return true;
}
} assert.sameValue(resArr.length, 3, 'resArr.length');
runTestCase(testcase); assert.sameValue(resArr[0], 1, 'resArr[0]');
assert.sameValue(resArr[1], 3, 'resArr[1]');
assert.sameValue(resArr[2], 5, 'resArr[2]');

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-10-3 es5id: 15.4.4.20-10-3
description: Array.prototype.filter - subclassed array when length is reduced description: Array.prototype.filter - subclassed array when length is reduced
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -16,9 +14,6 @@ function testcase() {
function cb(){return true;} function cb(){return true;}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 1) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 1, 'a.length');
}
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-10-4 es5id: 15.4.4.20-10-4
description: Array.prototype.filter doesn't visit expandos description: Array.prototype.filter doesn't visit expandos
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var callCnt = 0; var callCnt = 0;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -19,10 +16,5 @@ function testcase() {
srcArr[true] = 11; srcArr[true] = 11;
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if(callCnt == 5)
{
return true;
}
} assert.sameValue(callCnt, 5, 'callCnt');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-1
description: > description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter applied to Array-like object, 'length' is
own data property own data property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -24,6 +21,4 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 2; assert.sameValue(newArr.length, 2, 'newArr.length');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-10
description: > description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter applied to Array-like object, 'length' is
inherited accessor property inherited accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -33,6 +30,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
var newArr = Array.prototype.filter.call(child, callbackfn); var newArr = Array.prototype.filter.call(child, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-11
description: > description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter applied to Array-like object, 'length' is
own accessor property without a get function 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;
@ -27,6 +24,6 @@ function testcase() {
}); });
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed;
} assert.sameValue(newArr.length, 0, 'newArr.length');
runTestCase(testcase); assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-13
description: > description: >
Array.prototype.filter applied to the Array-like object that Array.prototype.filter 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) {
accessed = true; accessed = true;
@ -31,6 +28,6 @@ function testcase() {
child[1] = 12; child[1] = 12;
var newArr = Array.prototype.filter.call(child, callbackfn); var newArr = Array.prototype.filter.call(child, callbackfn);
return newArr.length === 0 && !accessed;
} assert.sameValue(newArr.length, 0, 'newArr.length');
runTestCase(testcase); assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-14
description: > description: >
Array.prototype.filter applied to the Array-like object that Array.prototype.filter 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) {
accessed = true; accessed = true;
@ -20,6 +17,6 @@ function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed;
} assert.sameValue(newArr.length, 0, 'newArr.length');
runTestCase(testcase); assert.sameValue(accessed, false, 'accessed');

View File

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

View File

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

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-19
description: > description: >
Array.prototype.filter applied to Function object, which Array.prototype.filter applied to Function object, which
implements its own property get method implements its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -23,6 +20,5 @@ function testcase() {
fun[2] = 9; fun[2] = 9;
var newArr = Array.prototype.filter.call(fun, callbackfn); var newArr = Array.prototype.filter.call(fun, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

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

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-3
description: > description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter applied to Array-like object, 'length' is
an own data property that overrides an inherited data property an own data property that overrides an inherited data property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -27,6 +24,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
var newArr = Array.prototype.filter.call(child, callbackfn); var newArr = Array.prototype.filter.call(child, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-5
description: > description: >
Array.prototype.filter to Array-like object, 'length' is an own Array.prototype.filter to Array-like object, 'length' is an own
data property that overrides an inherited accessor property data property that overrides an inherited accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -37,6 +34,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
var newArr = Array.prototype.filter.call(child, callbackfn); var newArr = Array.prototype.filter.call(child, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-6
description: > description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter applied to Array-like object, 'length' is
an inherited data property an inherited data property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -26,6 +23,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
var newArr = Array.prototype.filter.call(child, callbackfn); var newArr = Array.prototype.filter.call(child, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-2-7
description: > description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter applied to Array-like object, 'length' is
an own accessor property an own accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -29,6 +26,5 @@ function testcase() {
obj[2] = 9; obj[2] = 9;
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

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

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.filter applied to Array-like object, 'length' is Array.prototype.filter 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() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
@ -42,6 +39,5 @@ function testcase() {
child[2] = 9; child[2] = 9;
var newArr = Array.prototype.filter.call(child, callbackfn); var newArr = Array.prototype.filter.call(child, callbackfn);
return newArr.length === 2;
} assert.sameValue(newArr.length, 2, 'newArr.length');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-3-1 es5id: 15.4.4.20-3-1
description: Array.prototype.filter - value of 'length' is undefined description: Array.prototype.filter - 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) {
accessed = true; accessed = true;
@ -18,6 +15,5 @@ function testcase() {
var obj = { 0: 0, 1: 1, length: undefined }; var obj = { 0: 0, 1: 1, length: undefined };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-10
description: > description: >
Array.prototype.filter - value of 'length' is a number (value is Array.prototype.filter - 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) {
accessed = true; accessed = true;
@ -21,6 +18,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-11
description: > description: >
Array.prototype.filter - 'length' is a string containing a Array.prototype.filter - 'length' is a string containing a
positive number positive number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-12
description: > description: >
Array.prototype.filter - 'length' is a string containing a Array.prototype.filter - 'length' is a string containing a
negative number negative number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && newArr[0] === undefined; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(newArr[0], undefined, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-13
description: > description: >
Array.prototype.filter - 'length' is a string containing a decimal Array.prototype.filter - 'length' is a string containing a decimal
number number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-3-14 es5id: 15.4.4.20-3-14
description: Array.prototype.filter - 'length' is a string containing -Infinity description: Array.prototype.filter - '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) {
@ -20,6 +17,5 @@ function testcase() {
var newArr2 = Array.prototype.filter.call(obj2, callbackfn2); var newArr2 = Array.prototype.filter.call(obj2, callbackfn2);
return !accessed2 && newArr2.length === 0; assert.sameValue(accessed2, false, 'accessed2');
} assert.sameValue(newArr2.length, 0, 'newArr2.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-15
description: > description: >
Array.prototype.filter - 'length' is a string containing an Array.prototype.filter - 'length' is a string containing an
exponential number exponential number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-16
description: > description: >
Array.prototype.filter - 'length' is a string containing a hex Array.prototype.filter - 'length' is a string containing a hex
number number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-17
description: > description: >
Array.prototype.filter - 'length' is a string containing a number Array.prototype.filter - 'length' is a string containing a number
with leading zeros with leading zeros
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-18
description: > description: >
Array.prototype.filter - value of 'length' is a string that can't Array.prototype.filter - 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) {
accessed = true; accessed = true;
@ -21,6 +18,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return !accessed && newArr.length === 0; assert.sameValue(accessed, false, 'accessed');
} assert.sameValue(newArr.length, 0, 'newArr.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-19
description: > description: >
Array.prototype.filter - value of 'length' is an Object which has Array.prototype.filter - value of 'length' is an Object which has
an own toString method. an own toString method.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -27,6 +24,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-2
description: > description: >
Array.prototype.filter applied on an Array-like object if 'length' Array.prototype.filter applied on an Array-like object if 'length'
is 1 (length overridden to true(type conversion)) is 1 (length overridden to true(type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -18,6 +15,5 @@ function testcase() {
var obj = { 0: 11, 1: 9, length: true }; var obj = { 0: 11, 1: 9, length: true };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-20
description: > description: >
Array.prototype.filter - value of 'length' is an Object which has Array.prototype.filter - value of 'length' is an Object which has
an own valueOf method. an own valueOf method.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -27,6 +24,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.filter - 'length' is an object that has an own Array.prototype.filter - '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 firstStepOccured = false; var firstStepOccured = false;
var secondStepOccured = false; var secondStepOccured = false;
@ -36,6 +33,7 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11 && firstStepOccured && secondStepOccured; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase); assert(firstStepOccured, 'firstStepOccured !== true');
assert(secondStepOccured, 'secondStepOccured !== true');

View File

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

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-24
description: > description: >
Array.prototype.filter - value of 'length' is a positive Array.prototype.filter - 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() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -23,6 +20,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-25
description: > description: >
Array.prototype.filter - value of 'length' is a negative Array.prototype.filter - value of 'length' is a negative
non-integer non-integer
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -23,6 +20,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && newArr[0] === undefined; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(newArr[0], undefined, 'newArr[0]');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-3-3 es5id: 15.4.4.20-3-3
description: Array.prototype.filter - value of 'length' is a number (value is 0) description: Array.prototype.filter - value of 'length' is a number (value is 0)
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;
@ -18,6 +15,5 @@ function testcase() {
var obj = { 0: 11, length: 0 }; var obj = { 0: 11, length: 0 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-4
description: > description: >
Array.prototype.filter - value of 'length' is a number (value is Array.prototype.filter - 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) {
accessed = true; accessed = true;
@ -20,6 +17,5 @@ function testcase() {
var obj = { 0: 11, length: +0 }; var obj = { 0: 11, length: +0 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-5
description: > description: >
Array.prototype.filter - value of 'length' is a number (value is Array.prototype.filter - 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) {
accessed = true; accessed = true;
@ -20,6 +17,5 @@ function testcase() {
var obj = { 0: 11, length: -0 }; var obj = { 0: 11, length: -0 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-6
description: > description: >
Array.prototype.filter - value of 'length' is a number (value is Array.prototype.filter - value of 'length' is a number (value is
positive) positive)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -19,6 +16,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-7
description: > description: >
Array.prototype.filter - value of 'length' is a number (value is Array.prototype.filter - value of 'length' is a number (value is
negative) negative)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -18,6 +15,5 @@ function testcase() {
var obj = { 1: 11, 2: 9, length: -4294967294 }; var obj = { 1: 11, 2: 9, length: -4294967294 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && newArr[0] === undefined; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(newArr[0], undefined, 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-3-9
description: > description: >
Array.prototype.filter - value of 'length' is a number (value is Array.prototype.filter - 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) {
accessed = true; accessed = true;
@ -21,6 +18,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed; assert.sameValue(newArr.length, 0, 'newArr.length');
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-4-12 es5id: 15.4.4.20-4-12
description: Array.prototype.filter - 'callbackfn' is a function description: Array.prototype.filter - 'callbackfn' is a function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 1) { if (idx === 1) {
return val === 9; return val === 9;
@ -17,6 +14,6 @@ function testcase() {
} }
var newArr = [11, 9].filter(callbackfn); var newArr = [11, 9].filter(callbackfn);
return newArr.length === 1 && newArr[0] === 9;
} assert.sameValue(newArr.length, 1, 'newArr.length');
runTestCase(testcase); assert.sameValue(newArr[0], 9, 'newArr[0]');

View File

@ -5,10 +5,8 @@
es5id: 15.4.4.20-5-1-s es5id: 15.4.4.20-5-1-s
description: Array.prototype.filter - thisArg not passed to strict callbackfn description: Array.prototype.filter - 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].filter(callbackfn); [1].filter(callbackfn);
return innerThisCorrect;
} assert(innerThisCorrect, 'innerThisCorrect !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-10 es5id: 15.4.4.20-5-10
description: Array.prototype.filter - Array Object can be used as thisArg description: Array.prototype.filter - Array Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var objArray = new Array(10); var objArray = new Array(10);
@ -20,6 +17,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, objArray); var newArr = [11].filter(callbackfn, objArray);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-11 es5id: 15.4.4.20-5-11
description: Array.prototype.filter - String Object can be used as thisArg description: Array.prototype.filter - String Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var objString = new String(); var objString = new String();
@ -19,6 +16,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, objString); var newArr = [11].filter(callbackfn, objString);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-12 es5id: 15.4.4.20-5-12
description: Array.prototype.filter - Boolean Object can be used as thisArg description: Array.prototype.filter - Boolean Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var objBoolean = new Boolean(); var objBoolean = new Boolean();
@ -19,6 +16,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, objBoolean); var newArr = [11].filter(callbackfn, objBoolean);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-13 es5id: 15.4.4.20-5-13
description: Array.prototype.filter - Number Object can be used as thisArg description: Array.prototype.filter - Number Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var objNumber = new Number(); var objNumber = new Number();
@ -19,6 +16,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, objNumber); var newArr = [11].filter(callbackfn, objNumber);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-14 es5id: 15.4.4.20-5-14
description: Array.prototype.filter - the Math object can be used as thisArg description: Array.prototype.filter - the Math object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,6 +15,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, Math); var newArr = [11].filter(callbackfn, Math);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

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

View File

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

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-17 es5id: 15.4.4.20-5-17
description: Array.prototype.filter - the JSON object can be used as thisArg description: Array.prototype.filter - the JSON object can be used as thisArg
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 newArr = [11].filter(callbackfn, JSON); var newArr = [11].filter(callbackfn, JSON);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-18 es5id: 15.4.4.20-5-18
description: Array.prototype.filter - Error Object can be used as thisArg description: Array.prototype.filter - Error Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var objError = new RangeError(); var objError = new RangeError();
@ -19,6 +16,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, objError); var newArr = [11].filter(callbackfn, objError);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-5-19
description: > description: >
Array.prototype.filter - the Arguments object can be used as Array.prototype.filter - the Arguments object can be used as
thisArg thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var arg; var arg;
@ -24,6 +21,6 @@ function testcase() {
}(1, 2, 3)); }(1, 2, 3));
var newArr = [11].filter(callbackfn, arg); var newArr = [11].filter(callbackfn, arg);
return newArr[0] === 11 && accessed;
} assert.sameValue(newArr[0], 11, 'newArr[0]');
runTestCase(testcase); assert(accessed, 'accessed !== true');

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-2 es5id: 15.4.4.20-5-2
description: Array.prototype.filter - thisArg is Object description: Array.prototype.filter - 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;
@ -18,7 +16,5 @@ function testcase() {
var srcArr = [1]; var srcArr = [1];
var resArr = srcArr.filter(callbackfn,o); var resArr = srcArr.filter(callbackfn,o);
if( resArr.length === 1)
return true; assert.sameValue(resArr.length, 1, 'resArr.length');
}
runTestCase(testcase);

View File

@ -4,13 +4,9 @@
/*--- /*---
es5id: 15.4.4.20-5-21 es5id: 15.4.4.20-5-21
description: Array.prototype.filter - the global object can be used as thisArg description: Array.prototype.filter - the global object can be used as thisArg
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,6 +16,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, fnGlobalObject()); var newArr = [11].filter(callbackfn, fnGlobalObject());
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-22 es5id: 15.4.4.20-5-22
description: Array.prototype.filter - boolean primitive can be used as thisArg description: Array.prototype.filter - boolean primitive can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,6 +15,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, false); var newArr = [11].filter(callbackfn, false);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-23 es5id: 15.4.4.20-5-23
description: Array.prototype.filter - number primitive can be used as thisArg description: Array.prototype.filter - number primitive can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,6 +15,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, 101); var newArr = [11].filter(callbackfn, 101);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-24 es5id: 15.4.4.20-5-24
description: Array.prototype.filter - string primitive can be used as thisArg description: Array.prototype.filter - string primitive can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,6 +15,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, "abc"); var newArr = [11].filter(callbackfn, "abc");
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.20-5-27
description: > description: >
Array.prototype.filter - Array.isArray(arg) returns true when arg Array.prototype.filter - Array.isArray(arg) returns true when arg
is the returned array is the returned array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var newArr = [11].filter(function () { }); var newArr = [11].filter(function () { });
return Array.isArray(newArr); assert(Array.isArray(newArr), 'Array.isArray(newArr) !== true');
}
runTestCase(testcase);

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-28 es5id: 15.4.4.20-5-28
description: Array.prototype.filter - the returned array is instanceof Array description: Array.prototype.filter - the returned array is instanceof Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var newArr = [11].filter(function () { }); var newArr = [11].filter(function () { });
return newArr instanceof Array; assert(newArr instanceof Array, 'newArr instanceof Array !== true');
}
runTestCase(testcase);

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-29 es5id: 15.4.4.20-5-29
description: Array.prototype.filter - returns an array whose length is 0 description: Array.prototype.filter - returns an array whose length is 0
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var newArr = [11].filter(function () { }); var newArr = [11].filter(function () { });
return newArr.length === 0; assert.sameValue(newArr.length, 0, 'newArr.length');
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-3 es5id: 15.4.4.20-5-3
description: Array.prototype.filter - thisArg is Array description: Array.prototype.filter - 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;
@ -18,8 +16,5 @@ function testcase() {
var srcArr = [1]; var srcArr = [1];
var resArr = srcArr.filter(callbackfn,a); var resArr = srcArr.filter(callbackfn,a);
if( resArr.length === 1)
return true;
} assert.sameValue(resArr.length, 1, 'resArr.length');
runTestCase(testcase);

View File

@ -5,10 +5,8 @@
es5id: 15.4.4.20-5-30 es5id: 15.4.4.20-5-30
description: Array.prototype.filter - thisArg not passed description: Array.prototype.filter - thisArg not passed
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function innerObj() { function innerObj() {
this._15_4_4_20_5_30 = true; this._15_4_4_20_5_30 = true;
var _15_4_4_20_5_30 = false; var _15_4_4_20_5_30 = false;
@ -20,6 +18,5 @@ function testcase() {
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
this.retVal = resArr.length === 0; this.retVal = resArr.length === 0;
} }
return new innerObj().retVal;
} assert(new innerObj().retVal, 'new innerObj().retVal !== true');
runTestCase(testcase);

View File

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

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-5 es5id: 15.4.4.20-5-5
description: Array.prototype.filter - thisArg is object from object template description: Array.prototype.filter - thisArg is object from object template
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -20,8 +18,5 @@ function testcase() {
var srcArr = [1]; var srcArr = [1];
var resArr = srcArr.filter(callbackfn,f); var resArr = srcArr.filter(callbackfn,f);
if( resArr.length === 1)
return true;
} assert.sameValue(resArr.length, 1, 'resArr.length');
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-6 es5id: 15.4.4.20-5-6
description: Array.prototype.filter - thisArg is function description: Array.prototype.filter - thisArg is function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var res = false; var res = false;
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
@ -19,8 +17,5 @@ function testcase() {
var srcArr = [1]; var srcArr = [1];
var resArr = srcArr.filter(callbackfn,foo); var resArr = srcArr.filter(callbackfn,foo);
if( resArr.length === 1)
return true;
} assert.sameValue(resArr.length, 1, 'resArr.length');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-7 es5id: 15.4.4.20-5-7
description: Array.prototype.filter - built-in functions can be used as thisArg description: Array.prototype.filter - built-in functions can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,6 +15,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, eval); var newArr = [11].filter(callbackfn, eval);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-5-9 es5id: 15.4.4.20-5-9
description: Array.prototype.filter - Function Object can be used as thisArg description: Array.prototype.filter - Function Object can be used as thisArg
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var objFunction = function () { }; var objFunction = function () { };
@ -19,6 +16,5 @@ function testcase() {
var newArr = [11].filter(callbackfn, objFunction); var newArr = [11].filter(callbackfn, objFunction);
return newArr[0] === 11 && accessed; assert.sameValue(newArr[0], 11, 'newArr[0]');
} assert(accessed, 'accessed !== true');
runTestCase(testcase);

View File

@ -6,15 +6,10 @@ es5id: 15.4.4.20-6-1
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(empty array) (empty array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function cb(){} function cb(){}
var a = [].filter(cb); var a = [].filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-6-2
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden to null (type conversion)) (subclassed Array, length overridden to null (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -18,9 +16,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-6-3
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden to false (type conversion)) (subclassed Array, length overridden to false (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -18,9 +16,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-6-4
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden to 0 (type conversion)) (subclassed Array, length overridden to 0 (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -18,9 +16,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-6-5
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden to '0' (type conversion)) (subclassed Array, length overridden to '0' (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -18,9 +16,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-6-6
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden with obj with valueOf) (subclassed Array, length overridden with obj with valueOf)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -20,9 +18,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden with obj w/o valueOf (subclassed Array, length overridden with obj w/o valueOf
(toString)) (toString))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -27,9 +25,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-6-8
description: > description: >
Array.prototype.filter returns an empty array if 'length' is 0 Array.prototype.filter returns an empty array if 'length' is 0
(subclassed Array, length overridden with [] (subclassed Array, length overridden with []
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -33,9 +31,6 @@ function testcase() {
function cb(){} function cb(){}
var a = f.filter(cb); var a = f.filter(cb);
if (Array.isArray(a) &&
a.length === 0) { assert(Array.isArray(a), 'Array.isArray(a) !== true');
return true; assert.sameValue(a.length, 0, 'a.length');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-1
description: > description: >
Array.prototype.filter doesn't consider new elements added to Array.prototype.filter doesn't consider new elements added to
array after it is called array after it is called
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
srcArr[2] = 3; srcArr[2] = 3;
srcArr[5] = 6; srcArr[5] = 6;
@ -19,7 +16,5 @@ function testcase() {
var srcArr = [1, 2, , 4, 5]; var srcArr = [1, 2, , 4, 5];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
return resArr.length === 5;
} assert.sameValue(resArr.length, 5, 'resArr.length');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-2
description: > description: >
Array.prototype.filter considers new value of elements in array Array.prototype.filter considers new value of elements in array
after it is called after it is called
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
srcArr[2] = -1; srcArr[2] = -1;
@ -23,8 +20,7 @@ function testcase() {
var srcArr = [1,2,3,4,5]; var srcArr = [1,2,3,4,5];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if(resArr.length === 3 && resArr[0] === 1 && resArr[2] === 4)
return true; assert.sameValue(resArr.length, 3, 'resArr.length');
assert.sameValue(resArr[0], 1, 'resArr[0]');
} assert.sameValue(resArr[2], 4, 'resArr[2]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-4
description: > description: >
Array.prototype.filter doesn't visit deleted elements when Array.prototype.filter doesn't visit deleted elements when
Array.length is decreased Array.length is decreased
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
srcArr.length = 2; srcArr.length = 2;
@ -19,8 +16,5 @@ function testcase() {
var srcArr = [1,2,3,4,6]; var srcArr = [1,2,3,4,6];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if(resArr.length === 2 )
return true; assert.sameValue(resArr.length, 2, 'resArr.length');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-5
description: > description: >
Array.prototype.filter doesn't consider newly added elements in Array.prototype.filter doesn't consider newly added elements in
sparse array sparse array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
srcArr[1000] = 3; srcArr[1000] = 3;
@ -21,8 +18,5 @@ function testcase() {
srcArr[1] = 1; srcArr[1] = 1;
srcArr[2] = 2; srcArr[2] = 2;
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if( resArr.length === 2)
return true; assert.sameValue(resArr.length, 2, 'resArr.length');
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-9-7
description: > description: >
Array.prototype.filter stops calling callbackfn once the array is Array.prototype.filter stops calling callbackfn once the array is
deleted during the call deleted during the call
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var o = new Object(); var o = new Object();
o.srcArr = [1, 2, 3, 4, 5]; o.srcArr = [1, 2, 3, 4, 5];
@ -22,6 +20,6 @@ function testcase() {
} }
var resArr = o.srcArr.filter(callbackfn); var resArr = o.srcArr.filter(callbackfn);
return resArr.length === 5 && typeof o.srcArr === "undefined";
} assert.sameValue(resArr.length, 5, 'resArr.length');
runTestCase(testcase); assert.sameValue(typeof o.srcArr, "undefined", 'typeof o.srcArr');

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.20-9-8 es5id: 15.4.4.20-9-8
description: Array.prototype.filter - no observable effects occur if len is 0 description: Array.prototype.filter - 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) {
@ -20,6 +17,6 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return accessed === false && obj.length === 0 && newArr.length === 0; assert.sameValue(accessed, false, 'accessed');
} assert.sameValue(obj.length, 0, 'obj.length');
runTestCase(testcase); assert.sameValue(newArr.length, 0, 'newArr.length');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-9
description: > description: >
Array.prototype.filter - modifications to length don't change Array.prototype.filter - 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) {
@ -30,6 +27,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 2 && 2 === called; assert.sameValue(newArr.length, 2, 'newArr.length');
} assert.sameValue(called, 2, 'called');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-1
description: > description: >
Array.prototype.filter - callbackfn not called for indexes never Array.prototype.filter - 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)
{ {
@ -21,7 +18,6 @@ function testcase() {
var srcArr = new Array(10); var srcArr = new Array(10);
srcArr[1] = undefined; //explicitly assigning a value srcArr[1] = undefined; //explicitly assigning a value
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if( resArr.length === 0 && callCnt === 1)
return true; assert.sameValue(resArr.length, 0, 'resArr.length');
} assert.sameValue(callCnt, 1, 'callCnt');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-14
description: > description: >
Array.prototype.filter - decreasing length of array causes index Array.prototype.filter - decreasing length of array causes index
property not to be visited property not to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -27,6 +24,5 @@ function testcase() {
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 3 && newArr[2] === 2; assert.sameValue(newArr.length, 3, 'newArr.length');
} assert.sameValue(newArr[2], 2, 'newArr[2]');
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.filter - decreasing length of array does not Array.prototype.filter - decreasing length of array does not
delete non-configurable properties delete non-configurable properties
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -35,6 +32,5 @@ function testcase() {
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 3 && newArr[2] === "unconfigurable"; assert.sameValue(newArr.length, 3, 'newArr.length');
} assert.sameValue(newArr[2], "unconfigurable", 'newArr[2]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-2
description: > description: >
Array.prototype.filter - added properties in step 2 are visible Array.prototype.filter - added properties in step 2 are visible
here here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -27,6 +24,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === "length"; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.sameValue(newArr[0], "length", 'newArr[0]');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-3
description: > description: >
Array.prototype.filter - deleted properties in step 2 are visible Array.prototype.filter - deleted properties in step 2 are visible
here here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -26,6 +23,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] !== 6.99; assert.sameValue(newArr.length, 1, 'newArr.length');
} assert.notSameValue(newArr[0], 6.99, 'newArr[0]');
runTestCase(testcase);

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