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

This commit is contained in:
André Bargull 2015-08-07 18:40:21 +02:00
parent 39b5b7272c
commit 1b14708467
203 changed files with 246 additions and 1240 deletions

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-1 es5id: 15.4.3.2-1-1
description: Array.isArray applied to boolean primitive description: Array.isArray applied to boolean primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(true), false, 'Array.isArray(true)');
return !Array.isArray(true);
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-10 es5id: 15.4.3.2-1-10
description: Array.isArray applied to RegExp object description: Array.isArray applied to RegExp object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(new RegExp()), false, 'Array.isArray(new RegExp())');
return !Array.isArray(new RegExp());
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-11 es5id: 15.4.3.2-1-11
description: Array.isArray applied to the JSON object description: Array.isArray applied to the JSON object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(JSON), false, 'Array.isArray(JSON)');
return !Array.isArray(JSON);
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-12 es5id: 15.4.3.2-1-12
description: Array.isArray applied to Error object description: Array.isArray applied to Error object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(new SyntaxError()), false, 'Array.isArray(new SyntaxError())');
return !Array.isArray(new SyntaxError());
}
runTestCase(testcase);

View File

@ -4,13 +4,7 @@
/*--- /*---
es5id: 15.4.3.2-1-15 es5id: 15.4.3.2-1-15
description: Array.isArray applied to the global object description: Array.isArray applied to the global object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(fnGlobalObject()), false, 'Array.isArray(fnGlobalObject())');
return !Array.isArray(fnGlobalObject());
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-2 es5id: 15.4.3.2-1-2
description: Array.isArray applied to Boolean Object description: Array.isArray applied to Boolean Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(new Boolean(false)), false, 'Array.isArray(new Boolean(false))');
return !Array.isArray(new Boolean(false));
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-3 es5id: 15.4.3.2-1-3
description: Array.isArray applied to number primitive description: Array.isArray applied to number primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(5), false, 'Array.isArray(5)');
return !Array.isArray(5);
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-4 es5id: 15.4.3.2-1-4
description: Array.isArray applied to Number object description: Array.isArray applied to Number object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(new Number(-3)), false, 'Array.isArray(new Number(-3))');
return !Array.isArray(new Number(-3));
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-5 es5id: 15.4.3.2-1-5
description: Array.isArray applied to string primitive description: Array.isArray applied to string primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray("abc"), false, 'Array.isArray("abc")');
return !Array.isArray("abc");
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-6 es5id: 15.4.3.2-1-6
description: Array.isArray applied to String object description: Array.isArray applied to String object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(new String("hello\nworld\\!")), false, 'Array.isArray(new String("hello\nworld\\!"))');
return !Array.isArray(new String("hello\nworld\\!"));
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-7 es5id: 15.4.3.2-1-7
description: Array.isArray applied to Function object description: Array.isArray applied to Function object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(function () { }), false, 'Array.isArray(function () { })');
return !Array.isArray(function () { });
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-8 es5id: 15.4.3.2-1-8
description: Array.isArray applied to the Math object description: Array.isArray applied to the Math object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(Math), false, 'Array.isArray(Math)');
return !Array.isArray(Math);
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.3.2-1-9 es5id: 15.4.3.2-1-9
description: Array.isArray applied to Date object description: Array.isArray applied to Date object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray(new Date()), false, 'Array.isArray(new Date())');
return !Array.isArray(new Date());
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.3.2-2-3
description: > description: >
Array.isArray applied to an Array-like object with length and some Array.isArray applied to an Array-like object with length and some
indexed properties indexed properties
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.isArray({ 0: 12, 1: 9, length: 2 }), false, 'Array.isArray({ 0: 12, 1: 9, length: 2 })');
return !Array.isArray({ 0: 12, 1: 9, length: 2 });
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.14-1-7 es5id: 15.4.4.14-1-7
description: Array.prototype.indexOf applied to string primitive description: Array.prototype.indexOf applied to string primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.prototype.indexOf.call("abc", "b"), 1, 'Array.prototype.indexOf.call("abc", "b")');
return Array.prototype.indexOf.call("abc", "b") === 1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-5-13
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a number (value Array.prototype.indexOf - value of 'fromIndex' is a number (value
is -Infinity) is -Infinity)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].indexOf(true, -Infinity), 0, '[true].indexOf(true, -Infinity)');
return [true].indexOf(true, -Infinity) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,7 @@ es5id: 15.4.4.14-5-14
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a number (value Array.prototype.indexOf - value of 'fromIndex' is a number (value
is NaN) is NaN)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].indexOf(true, NaN), 0, '[true].indexOf(true, NaN)');
assert.sameValue([true].indexOf(true, -NaN), 0, '[true].indexOf(true, -NaN)');
return [true].indexOf(true, NaN) === 0 && [true].indexOf(true, -NaN) === 0;
}
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 15.4.4.14-5-15
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a string Array.prototype.indexOf - value of 'fromIndex' is a string
containing a negative number containing a negative number
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, true, 2].indexOf(true, "-1"), -1, '[0, true, 2].indexOf(true, "-1")');
assert.sameValue([0, 1, true].indexOf(true, "-1"), 2, '[0, 1, true].indexOf(true, "-1")');
return [0, true, 2].indexOf(true, "-1") === -1 &&
[0, 1, true].indexOf(true, "-1") === 2;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-5-17
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a string Array.prototype.indexOf - value of 'fromIndex' is a string
containing -Infinity containing -Infinity
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].indexOf(true, "-Infinity"), 0, '[true].indexOf(true, "-Infinity")');
return [true].indexOf(true, "-Infinity") === 0;
}
runTestCase(testcase);

View File

@ -6,15 +6,10 @@ es5id: 15.4.4.14-5-33
description: > description: >
Array.prototype.indexOf match on the first element, a middle Array.prototype.indexOf match on the first element, a middle
element and the last element when 'fromIndex' is passed element and the last element when 'fromIndex' is passed
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, 1, 2, 3, 4].indexOf(0, 0), 0, '[0, 1, 2, 3, 4].indexOf(0, 0)');
assert.sameValue([0, 1, 2, 3, 4].indexOf(2, 1), 2, '[0, 1, 2, 3, 4].indexOf(2, 1)');
return [0, 1, 2, 3, 4].indexOf(0, 0) === 0 && assert.sameValue([0, 1, 2, 3, 4].indexOf(2, 2), 2, '[0, 1, 2, 3, 4].indexOf(2, 2)');
[0, 1, 2, 3, 4].indexOf(2, 1) === 2 && assert.sameValue([0, 1, 2, 3, 4].indexOf(4, 2), 4, '[0, 1, 2, 3, 4].indexOf(4, 2)');
[0, 1, 2, 3, 4].indexOf(2, 2) === 2 && assert.sameValue([0, 1, 2, 3, 4].indexOf(4, 4), 4, '[0, 1, 2, 3, 4].indexOf(4, 4)');
[0, 1, 2, 3, 4].indexOf(4, 2) === 4 &&
[0, 1, 2, 3, 4].indexOf(4, 4) === 4;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-5-7
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a number (value Array.prototype.indexOf - value of 'fromIndex' is a number (value
is 0) is 0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].indexOf(true, 0), 0, '[true].indexOf(true, 0)');
return [true].indexOf(true, 0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-5-8
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a number (value Array.prototype.indexOf - value of 'fromIndex' is a number (value
is +0) is +0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].indexOf(true, +0), 0, '[true].indexOf(true, +0)');
return [true].indexOf(true, +0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-5-9
description: > description: >
Array.prototype.indexOf - value of 'fromIndex' is a number (value Array.prototype.indexOf - value of 'fromIndex' is a number (value
is -0) is -0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].indexOf(true, -0), 0, '[true].indexOf(true, -0)');
return [true].indexOf(true, -0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-7-1
description: > description: >
Array.prototype.indexOf returns -1 when 'fromIndex' is length of Array.prototype.indexOf returns -1 when 'fromIndex' is length of
array - 1 array - 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].indexOf(1, 2), -1, '[1, 2, 3].indexOf(1, 2)');
return [1, 2, 3].indexOf(1, 2) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-7-2
description: > description: >
Array.prototype.indexOf returns correct index when 'fromIndex' is Array.prototype.indexOf returns correct index when 'fromIndex' is
length of array - 1 length of array - 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].indexOf(3, 2), 2, '[1, 2, 3].indexOf(3, 2)');
return [1, 2, 3].indexOf(3, 2) === 2;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-7-3
description: > description: >
Array.prototype.indexOf returns -1 when 'fromIndex' and 'length' Array.prototype.indexOf returns -1 when 'fromIndex' and 'length'
are both 0 are both 0
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([].indexOf(1, 0), -1, '[].indexOf(1, 0)');
return [].indexOf(1, 0) === -1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.14-7-4 es5id: 15.4.4.14-7-4
description: Array.prototype.indexOf returns -1 when 'fromIndex' is 1 description: Array.prototype.indexOf returns -1 when 'fromIndex' is 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].indexOf(1, 1), -1, '[1, 2, 3].indexOf(1, 1)');
return [1, 2, 3].indexOf(1, 1) === -1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.14-7-5 es5id: 15.4.4.14-7-5
description: Array.prototype.indexOf returns correct index when 'fromIndex' is 1 description: Array.prototype.indexOf returns correct index when 'fromIndex' is 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].indexOf(2, 1), 1, '[1, 2, 3].indexOf(2, 1)');
return [1, 2, 3].indexOf(2, 1) === 1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-8-2
description: > description: >
Array.prototype.indexOf returns correct index when 'fromIndex' is Array.prototype.indexOf returns correct index when 'fromIndex' is
-1 -1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3, 4].indexOf(4, -1), 3, '[1, 2, 3, 4].indexOf(4, -1)');
return [1, 2, 3, 4].indexOf(4, -1) === 3;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-8-3
description: > description: >
Array.prototype.indexOf returns -1 when abs('fromIndex') is length Array.prototype.indexOf returns -1 when abs('fromIndex') is length
of array - 1 of array - 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3, 4].indexOf(1, -3), -1, '[1, 2, 3, 4].indexOf(1, -3)');
return [1, 2, 3, 4].indexOf(1, -3) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-8-4
description: > description: >
Array.prototype.indexOf returns -1 when abs('fromIndex') is length Array.prototype.indexOf returns -1 when abs('fromIndex') is length
of array of array
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3, 4].indexOf(0, -4), -1, '[1, 2, 3, 4].indexOf(0, -4)');
return [1, 2, 3, 4].indexOf(0, -4) === -1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.14-9-b-1 es5id: 15.4.4.14-9-b-1
description: Array.prototype.indexOf - non-existent property wouldn't be called description: Array.prototype.indexOf - non-existent property wouldn't be called
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, , 2].indexOf(undefined), -1, '[0, , 2].indexOf(undefined)');
return [0, , 2].indexOf(undefined) === -1;
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.4.4.14-9-b-i-2
description: > description: >
Array.prototype.indexOf - element to be retrieved is own data Array.prototype.indexOf - element to be retrieved is own data
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true, true, true].indexOf(true), 0, '[true, true, true].indexOf(true)');
return [true, true, true].indexOf(true) === 0 && assert.sameValue([false, true, true].indexOf(true), 1, '[false, true, true].indexOf(true)');
[false, true, true].indexOf(true) === 1 && assert.sameValue([false, false, true].indexOf(true), 2, '[false, false, true].indexOf(true)');
[false, false, true].indexOf(true) === 2;
}
runTestCase(testcase);

View File

@ -6,16 +6,11 @@ es5id: 15.4.4.14-9-b-ii-1
description: > description: >
Array.prototype.indexOf - type of array element is different from Array.prototype.indexOf - type of array element is different from
type of search element type of search element
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(["true"].indexOf(true), -1, '["true"].indexOf(true)');
assert.sameValue(["0"].indexOf(0), -1, '["0"].indexOf(0)');
return ["true"].indexOf(true) === -1 && assert.sameValue([false].indexOf(0), -1, '[false].indexOf(0)');
["0"].indexOf(0) === -1 && assert.sameValue([undefined].indexOf(0), -1, '[undefined].indexOf(0)');
[false].indexOf(0) === -1 && assert.sameValue([null].indexOf(0), -1, '[null].indexOf(0)');
[undefined].indexOf(0) === -1 && assert.sameValue([[]].indexOf(0), -1, '[[]].indexOf(0)');
[null].indexOf(0) === -1 &&
[[]].indexOf(0) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-ii-10
description: > description: >
Array.prototype.indexOf - both array element and search element Array.prototype.indexOf - both array element and search element
are Boolean type, and they have same value are Boolean type, and they have same value
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([false, true].indexOf(true), 1, '[false, true].indexOf(true)');
return [false, true].indexOf(true) === 1;
}
runTestCase(testcase);

View File

@ -6,14 +6,10 @@ es5id: 15.4.4.14-9-b-ii-11
description: > description: >
Array.prototype.indexOf - both array element and search element Array.prototype.indexOf - both array element and search element
are Object type, and they refer to the same object are Object type, and they refer to the same object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj1 = {}; var obj1 = {};
var obj2 = {}; var obj2 = {};
var obj3 = obj2; var obj3 = obj2;
return [{}, obj1, obj2].indexOf(obj3) === 2;
} assert.sameValue([{}, obj1, obj2].indexOf(obj3), 2, '[{}, obj1, obj2].indexOf(obj3)');
runTestCase(testcase);

View File

@ -6,11 +6,7 @@ es5id: 15.4.4.14-9-b-ii-2
description: > description: >
Array.prototype.indexOf - both type of array element and type of Array.prototype.indexOf - both type of array element and type of
search element are Undefined search element are Undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([undefined].indexOf(), 0, '[undefined].indexOf()');
assert.sameValue([undefined].indexOf(undefined), 0, '[undefined].indexOf(undefined)');
return [undefined].indexOf() === 0 && [undefined].indexOf(undefined) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-ii-3
description: > description: >
Array.prototype.indexOf - both type of array element and type of Array.prototype.indexOf - both type of array element and type of
search element are null search element are null
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([null].indexOf(null), 0, '[null].indexOf(null)');
return [null].indexOf(null) === 0;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.14-9-b-ii-4 es5id: 15.4.4.14-9-b-ii-4
description: Array.prototype.indexOf - search element is NaN description: Array.prototype.indexOf - search element is NaN
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([+NaN, NaN, -NaN].indexOf(NaN), -1, '[+NaN, NaN, -NaN].indexOf(NaN)');
return [+NaN, NaN, -NaN].indexOf(NaN) === -1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.14-9-b-ii-5 es5id: 15.4.4.14-9-b-ii-5
description: Array.prototype.indexOf - search element is -NaN description: Array.prototype.indexOf - search element is -NaN
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([+NaN, NaN, -NaN].indexOf(-NaN), -1, '[+NaN, NaN, -NaN].indexOf(-NaN)');
return [+NaN, NaN, -NaN].indexOf(-NaN) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-ii-6
description: > description: >
Array.prototype.indexOf - array element is +0 and search element Array.prototype.indexOf - array element is +0 and search element
is -0 is -0
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([+0].indexOf(-0), 0, '[+0].indexOf(-0)');
return [+0].indexOf(-0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-ii-7
description: > description: >
Array.prototype.indexOf - array element is -0 and search element Array.prototype.indexOf - array element is -0 and search element
is +0 is +0
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([-0].indexOf(+0), 0, '[-0].indexOf(+0)');
return [-0].indexOf(+0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-ii-8
description: > description: >
Array.prototype.indexOf - both array element and search element Array.prototype.indexOf - both array element and search element
are Number, and they have same value are Number, and they have same value
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([-1, 0, 1].indexOf(1), 2, '[-1, 0, 1].indexOf(1)');
return [-1, 0, 1].indexOf(1) === 2;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-ii-9
description: > description: >
Array.prototype.indexOf - both array element and search element Array.prototype.indexOf - both array element and search element
are String, and they have exactly the same sequence of characters are String, and they have exactly the same sequence of characters
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(["", "ab", "bca", "abc"].indexOf("abc"), 3, '["", "ab", "bca", "abc"].indexOf("abc")');
return ["", "ab", "bca", "abc"].indexOf("abc") === 3;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.14-9-b-iii-1
description: > description: >
Array.prototype.indexOf - returns index of last one when more than Array.prototype.indexOf - returns index of last one when more than
two elements in array are eligible two elements in array are eligible
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 2, 1, 2].indexOf(2), 1, '[1, 2, 2, 1, 2].indexOf(2)');
return [1, 2, 2, 1, 2].indexOf(2) === 1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.15-1-7 es5id: 15.4.4.15-1-7
description: Array.prototype.lastIndexOf applied to string primitive description: Array.prototype.lastIndexOf applied to string primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.prototype.lastIndexOf.call("abc", "c"), 2, 'Array.prototype.lastIndexOf.call("abc", "c")');
return Array.prototype.lastIndexOf.call("abc", "c") === 2;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-5-13
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a number Array.prototype.lastIndexOf - value of 'fromIndex' is a number
(value is -Infinity) (value is -Infinity)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].lastIndexOf(true, -Infinity), -1, '[true].lastIndexOf(true, -Infinity)');
return [true].lastIndexOf(true, -Infinity) === -1;
}
runTestCase(testcase);

View File

@ -6,14 +6,10 @@ es5id: 15.4.4.15-5-14
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a number Array.prototype.lastIndexOf - value of 'fromIndex' is a number
(value is NaN) (value is NaN)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { // from Index will be convert to +0
assert.sameValue([0, true].lastIndexOf(true, NaN), -1, '[0, true].lastIndexOf(true, NaN)');
return [0, true].lastIndexOf(true, NaN) === -1 && // from Index will be convert to +0 assert.sameValue([true, 0].lastIndexOf(true, NaN), 0, '[true, 0].lastIndexOf(true, NaN)');
[true, 0].lastIndexOf(true, NaN) === 0 && assert.sameValue([0, true].lastIndexOf(true, -NaN), -1, '[0, true].lastIndexOf(true, -NaN)');
[0, true].lastIndexOf(true, -NaN) === -1 && assert.sameValue([true, 0].lastIndexOf(true, -NaN), 0, '[true, 0].lastIndexOf(true, -NaN)');
[true, 0].lastIndexOf(true, -NaN) === 0;
}
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 15.4.4.15-5-15
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a string Array.prototype.lastIndexOf - value of 'fromIndex' is a string
containing a negative number containing a negative number
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, "-2", 2].lastIndexOf("-2", "-2"), 1, '[0, "-2", 2].lastIndexOf("-2", "-2")');
assert.sameValue([0, 2, "-2"].lastIndexOf("-2", "-2"), -1, '[0, 2, "-2"].lastIndexOf("-2", "-2")');
return [0, "-2", 2].lastIndexOf("-2", "-2") === 1 &&
[0, 2, "-2"].lastIndexOf("-2", "-2") === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-5-17
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a string Array.prototype.lastIndexOf - value of 'fromIndex' is a string
containing -Infinity containing -Infinity
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true].lastIndexOf(true, "-Infinity"), -1, '[true].lastIndexOf(true, "-Infinity")');
return [true].lastIndexOf(true, "-Infinity") === -1;
}
runTestCase(testcase);

View File

@ -6,15 +6,10 @@ es5id: 15.4.4.15-5-33
description: > description: >
Array.prototype.lastIndexOf - match on the first element, a middle Array.prototype.lastIndexOf - match on the first element, a middle
element and the last element when 'fromIndex' is passed element and the last element when 'fromIndex' is passed
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, 1, 2, 3, 4].lastIndexOf(0, 0), 0, '[0, 1, 2, 3, 4].lastIndexOf(0, 0)');
assert.sameValue([0, 1, 2, 3, 4].lastIndexOf(0, 2), 0, '[0, 1, 2, 3, 4].lastIndexOf(0, 2)');
return [0, 1, 2, 3, 4].lastIndexOf(0, 0) === 0 && assert.sameValue([0, 1, 2, 3, 4].lastIndexOf(2, 2), 2, '[0, 1, 2, 3, 4].lastIndexOf(2, 2)');
[0, 1, 2, 3, 4].lastIndexOf(0, 2) === 0 && assert.sameValue([0, 1, 2, 3, 4].lastIndexOf(2, 4), 2, '[0, 1, 2, 3, 4].lastIndexOf(2, 4)');
[0, 1, 2, 3, 4].lastIndexOf(2, 2) === 2 && assert.sameValue([0, 1, 2, 3, 4].lastIndexOf(4, 4), 4, '[0, 1, 2, 3, 4].lastIndexOf(4, 4)');
[0, 1, 2, 3, 4].lastIndexOf(2, 4) === 2 &&
[0, 1, 2, 3, 4].lastIndexOf(4, 4) === 4;
}
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 15.4.4.15-5-8
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a number Array.prototype.lastIndexOf - value of 'fromIndex' is a number
(value is +0) (value is +0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, true].lastIndexOf(true, +0), -1, '[0, true].lastIndexOf(true, +0)');
assert.sameValue([true, 0].lastIndexOf(true, +0), 0, '[true, 0].lastIndexOf(true, +0)');
return [0, true].lastIndexOf(true, +0) === -1 &&
[true, 0].lastIndexOf(true, +0) === 0;
}
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 15.4.4.15-5-9
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a number Array.prototype.lastIndexOf - value of 'fromIndex' is a number
(value is -0) (value is -0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, true].lastIndexOf(true, -0), -1, '[0, true].lastIndexOf(true, -0)');
assert.sameValue([true, 0].lastIndexOf(true, -0), 0, '[true, 0].lastIndexOf(true, -0)');
return [0, true].lastIndexOf(true, -0) === -1 &&
[true, 0].lastIndexOf(true, -0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-6-2
description: > description: >
Array.prototype.lastIndexOf returns correct index when 'fromIndex' Array.prototype.lastIndexOf returns correct index when 'fromIndex'
is length of array - 1 is length of array - 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].lastIndexOf(3, 2), 2, '[1, 2, 3].lastIndexOf(3, 2)');
return [1, 2, 3].lastIndexOf(3, 2) === 2;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-6-3
description: > description: >
Array.prototype.lastIndexOf returns -1 when 'fromIndex' is length Array.prototype.lastIndexOf returns -1 when 'fromIndex' is length
of array - 1 of array - 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].lastIndexOf(3, 1), -1, '[1, 2, 3].lastIndexOf(3, 1)');
return [1, 2, 3].lastIndexOf(3, 1) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-6-4
description: > description: >
Array.prototype.lastIndexOf returns -1 when 'fromIndex' and Array.prototype.lastIndexOf returns -1 when 'fromIndex' and
'length' are both 0 'length' are both 0
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([].lastIndexOf(1, 0), -1, '[].lastIndexOf(1, 0)');
return [].lastIndexOf(1, 0) === -1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.15-6-5 es5id: 15.4.4.15-6-5
description: Array.prototype.lastIndexOf returns -1 when 'fromIndex' is 1 description: Array.prototype.lastIndexOf returns -1 when 'fromIndex' is 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].lastIndexOf(3, 1), -1, '[1, 2, 3].lastIndexOf(3, 1)');
return [1, 2, 3].lastIndexOf(3, 1) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-6-6
description: > description: >
Array.prototype.lastIndexOf returns correct index when 'fromIndex' Array.prototype.lastIndexOf returns correct index when 'fromIndex'
is 1 is 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3].lastIndexOf(2, 1), 1, '[1, 2, 3].lastIndexOf(2, 1)');
return [1, 2, 3].lastIndexOf(2, 1) === 1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-7-2
description: > description: >
Array.prototype.lastIndexOf returns correct index when 'fromIndex' Array.prototype.lastIndexOf returns correct index when 'fromIndex'
is -1 is -1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3, 4].lastIndexOf(4, -1), 3, '[1, 2, 3, 4].lastIndexOf(4, -1)');
return [1, 2, 3, 4].lastIndexOf(4, -1) === 3;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-7-3
description: > description: >
Array.prototype.lastIndexOf returns -1 when abs('fromIndex') is Array.prototype.lastIndexOf returns -1 when abs('fromIndex') is
length of array - 1 length of array - 1
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3, 4].lastIndexOf(3, -3), -1, '[1, 2, 3, 4].lastIndexOf(3, -3)');
return [1, 2, 3, 4].lastIndexOf(3, -3) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-7-4
description: > description: >
Array.prototype.lastIndexOf returns -1 when abs('fromIndex') is Array.prototype.lastIndexOf returns -1 when abs('fromIndex') is
length of array length of array
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([1, 2, 3, 4].lastIndexOf(2, -4), -1, '[1, 2, 3, 4].lastIndexOf(2, -4)');
return [1, 2, 3, 4].lastIndexOf(2, -4) === -1;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.15-8-b-1 es5id: 15.4.4.15-8-b-1
description: Array.prototype.lastIndexOf - undefined property wouldn't be called description: Array.prototype.lastIndexOf - undefined property wouldn't be called
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([0, , 2].lastIndexOf(undefined), -1, '[0, , 2].lastIndexOf(undefined)');
return [0, , 2].lastIndexOf(undefined) === -1;
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.4.4.15-8-b-i-2
description: > description: >
Array.prototype.lastIndexOf - element to be retrieved is own data Array.prototype.lastIndexOf - element to be retrieved is own data
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([true, true, true].lastIndexOf(true), 2, '[true, true, true].lastIndexOf(true)');
return [true, true, true].lastIndexOf(true) === 2 && assert.sameValue([true, true, false].lastIndexOf(true), 1, '[true, true, false].lastIndexOf(true)');
[true, true, false].lastIndexOf(true) === 1 && assert.sameValue([true, false, false].lastIndexOf(true), 0, '[true, false, false].lastIndexOf(true)');
[true, false, false].lastIndexOf(true) === 0;
}
runTestCase(testcase);

View File

@ -6,16 +6,11 @@ es5id: 15.4.4.15-8-b-ii-1
description: > description: >
Array.prototype.lastIndexOf - type of array element is different Array.prototype.lastIndexOf - type of array element is different
from type of search element from type of search element
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(["true"].lastIndexOf(true), -1, '["true"].lastIndexOf(true)');
assert.sameValue(["0"].lastIndexOf(0), -1, '["0"].lastIndexOf(0)');
return ["true"].lastIndexOf(true) === -1 && assert.sameValue([false].lastIndexOf(0), -1, '[false].lastIndexOf(0)');
["0"].lastIndexOf(0) === -1 && assert.sameValue([undefined].lastIndexOf(0), -1, '[undefined].lastIndexOf(0)');
[false].lastIndexOf(0) === -1 && assert.sameValue([null].lastIndexOf(0), -1, '[null].lastIndexOf(0)');
[undefined].lastIndexOf(0) === -1 && assert.sameValue([[]].lastIndexOf(0), -1, '[[]].lastIndexOf(0)');
[null].lastIndexOf(0) === -1 &&
[[]].lastIndexOf(0) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-8-b-ii-10
description: > description: >
Array.prototype.lastIndexOf - both array element and search Array.prototype.lastIndexOf - both array element and search
element are booleans, and they have same value element are booleans, and they have same value
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([false, true].lastIndexOf(true), 1, '[false, true].lastIndexOf(true)');
return [false, true].lastIndexOf(true) === 1;
}
runTestCase(testcase);

View File

@ -6,11 +6,7 @@ es5id: 15.4.4.15-8-b-ii-2
description: > description: >
Array.prototype.lastIndexOf - both type of array element and type Array.prototype.lastIndexOf - both type of array element and type
of search element are Undefined of search element are Undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([undefined].lastIndexOf(), 0, '[undefined].lastIndexOf()');
assert.sameValue([undefined].lastIndexOf(undefined), 0, '[undefined].lastIndexOf(undefined)');
return [undefined].lastIndexOf() === 0 && [undefined].lastIndexOf(undefined) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-8-b-ii-3
description: > description: >
Array.prototype.lastIndexOf - both type of array element and type Array.prototype.lastIndexOf - both type of array element and type
of search element are Null of search element are Null
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([null].lastIndexOf(null), 0, '[null].lastIndexOf(null)');
return [null].lastIndexOf(null) === 0;
}
runTestCase(testcase);

View File

@ -4,11 +4,6 @@
/*--- /*---
es5id: 15.4.4.15-8-b-ii-4 es5id: 15.4.4.15-8-b-ii-4
description: Array.prototype.lastIndexOf - search element is NaN description: Array.prototype.lastIndexOf - search element is NaN
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([+NaN, NaN, -NaN].lastIndexOf(NaN), -1, '[+NaN, NaN, -NaN].lastIndexOf(NaN)');
return [+NaN, NaN, -NaN].lastIndexOf(NaN) === -1;
}
runTestCase(testcase);

View File

@ -4,10 +4,6 @@
/*--- /*---
es5id: 15.4.4.15-8-b-ii-5 es5id: 15.4.4.15-8-b-ii-5
description: Array.prototype.lastIndexOf - search element is -NaN description: Array.prototype.lastIndexOf - search element is -NaN
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([+NaN, NaN, -NaN].lastIndexOf(-NaN), -1, '[+NaN, NaN, -NaN].lastIndexOf(-NaN)');
return [+NaN, NaN, -NaN].lastIndexOf(-NaN) === -1;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-8-b-ii-6
description: > description: >
Array.prototype.lastIndexOf - array element is +0 and search Array.prototype.lastIndexOf - array element is +0 and search
element is -0 element is -0
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([+0].lastIndexOf(-0), 0, '[+0].lastIndexOf(-0)');
return [+0].lastIndexOf(-0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-8-b-ii-7
description: > description: >
Array.prototype.lastIndexOf - array element is -0 and search Array.prototype.lastIndexOf - array element is -0 and search
element is +0 element is +0
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([-0].lastIndexOf(+0), 0, '[-0].lastIndexOf(+0)');
return [-0].lastIndexOf(+0) === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-8-b-ii-8
description: > description: >
Array.prototype.lastIndexOf - both array element and search Array.prototype.lastIndexOf - both array element and search
element are numbers, and they have same value element are numbers, and they have same value
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([-1, 0, 1].lastIndexOf(-1), 0, '[-1, 0, 1].lastIndexOf(-1)');
return [-1, 0, 1].lastIndexOf(-1) === 0;
}
runTestCase(testcase);

View File

@ -7,11 +7,6 @@ description: >
Array.prototype.lastIndexOf - both array element and search Array.prototype.lastIndexOf - both array element and search
element are strings, and they have exactly the same sequence of element are strings, and they have exactly the same sequence of
characters characters
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(["abc", "ab", "bca", ""].lastIndexOf("abc"), 0, '["abc", "ab", "bca", ""].lastIndexOf("abc")');
return ["abc", "ab", "bca", ""].lastIndexOf("abc") === 0;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.4.4.15-8-b-iii-1
description: > description: >
Array.prototype.lastIndexOf returns index of last one when more Array.prototype.lastIndexOf returns index of last one when more
than two elements in array are eligible than two elements in array are eligible
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue([2, 1, 2, 2, 1].lastIndexOf(2), 3, '[2, 1, 2, 2, 1].lastIndexOf(2)');
return [2, 1, 2, 2, 1].lastIndexOf(2) === 3;
}
runTestCase(testcase);

View File

@ -6,16 +6,7 @@ es5id: 15.4.4.21-7-1
description: > description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (empty array) initialValue is present (empty array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function cb(){} function cb(){}
assert.sameValue([].reduce(cb,1), 1, '[].reduce(cb,1)');
try {
if([].reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -4,12 +4,8 @@
/*--- /*---
es5id: 15.4.4.21-7-10 es5id: 15.4.4.21-7-10
description: Array.prototype.reduce - 'initialValue' is present description: Array.prototype.reduce - 'initialValue' is present
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var str = "initialValue is present"; var str = "initialValue is present";
return str === [].reduce(function () { }, str);
} assert.sameValue([].reduce(function () { }, str), str, '[].reduce(function () { }, str)');
runTestCase(testcase);

View File

@ -4,12 +4,8 @@
/*--- /*---
es5id: 15.4.4.21-7-11 es5id: 15.4.4.21-7-11
description: Array.prototype.reduce - 'initialValue' is not present description: Array.prototype.reduce - 'initialValue' is not present
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var str = "initialValue is not present"; var str = "initialValue is not present";
return str === [str].reduce(function () { });
} assert.sameValue([str].reduce(function () { }), str, '[str].reduce(function () { })');
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to initialValue is present (subclassed Array, length overridden to
null (type conversion)) 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();
f.length = null; f.length = null;
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to initialValue is present (subclassed Array, length overridden to
false (type conversion)) 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();
f.length = false; f.length = false;
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to 0 initialValue is present (subclassed Array, length overridden to 0
(type conversion)) (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();
f.length = 0; f.length = 0;
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to initialValue is present (subclassed Array, length overridden to
'0' (type conversion)) '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();
f.length = '0'; f.length = '0';
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with initialValue is present (subclassed Array, length overridden with
obj with valueOf) 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();
@ -19,10 +17,4 @@ function testcase() {
f.length = o; f.length = o;
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with initialValue is present (subclassed Array, length overridden with
obj w/o valueOf (toString)) obj w/o valueOf (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();
@ -25,10 +23,4 @@ function testcase() {
// resulting string to a number. // resulting string to a number.
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with initialValue is present (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();
@ -32,10 +30,4 @@ function testcase() {
// or if its one element is not a number, the array converts to NaN. // or if its one element is not a number, the array converts to NaN.
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with initialValue is present (subclassed Array, length overridden with
[0]) [0])
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();
@ -32,10 +30,4 @@ function testcase() {
// or if its one element is not a number, the array converts to NaN. // or if its one element is not a number, the array converts to NaN.
function cb(){} function cb(){}
try { assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-ii-1
description: > description: >
Array.prototype.reduce - added properties in step 2 are visible Array.prototype.reduce - added properties in step 2 are visible
here here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { }; var obj = { };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
@ -21,6 +18,4 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.reduce.call(obj, function () { }) === "accumulator"; assert.sameValue(Array.prototype.reduce.call(obj, function () { }), "accumulator", 'Array.prototype.reduce.call(obj, function () { })');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-ii-2
description: > description: >
Array.prototype.reduce - deleted properties in step 2 are visible Array.prototype.reduce - deleted properties in step 2 are visible
here here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 1: "accumulator", 2: "another" }; var obj = { 1: "accumulator", 2: "another" };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
@ -21,6 +18,4 @@ function testcase() {
configurable: true configurable: true
}); });
return "accumulator" !== Array.prototype.reduce.call(obj, function () { }); assert.notSameValue(Array.prototype.reduce.call(obj, function () { }), "accumulator", 'Array.prototype.reduce.call(obj, function () { })');
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.4.4.22-5-9
description: > description: >
Array.prototype.reduceRight - 'initialValue' is returned if 'len' Array.prototype.reduceRight - 'initialValue' is returned if 'len'
is 0 and 'initialValue' is present is 0 and 'initialValue' is present
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var initialValue = 10; var initialValue = 10;
return initialValue === [].reduceRight(function () { }, initialValue);
} assert.sameValue([].reduceRight(function () { }, initialValue), initialValue, '[].reduceRight(function () { }, initialValue)');
runTestCase(testcase);

View File

@ -6,16 +6,7 @@ es5id: 15.4.4.22-7-1
description: > description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (empty array) and initialValue is present (empty array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function cb(){} function cb(){}
assert.sameValue([].reduceRight(cb,1), 1, '[].reduceRight(cb,1)');
try {
if([].reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -4,12 +4,8 @@
/*--- /*---
es5id: 15.4.4.22-7-10 es5id: 15.4.4.22-7-10
description: Array.prototype.reduceRight - 'initialValue' is present description: Array.prototype.reduceRight - 'initialValue' is present
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var str = "initialValue is present"; var str = "initialValue is present";
return str === [].reduceRight(function () { }, str);
} assert.sameValue([].reduceRight(function () { }, str), str, '[].reduceRight(function () { }, str)');
runTestCase(testcase);

View File

@ -4,12 +4,8 @@
/*--- /*---
es5id: 15.4.4.22-7-11 es5id: 15.4.4.22-7-11
description: Array.prototype.reduceRight - 'initialValue' is not present description: Array.prototype.reduceRight - 'initialValue' is not present
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var str = "initialValue is not present"; var str = "initialValue is not present";
return str === [str].reduceRight(function () { });
} assert.sameValue([str].reduceRight(function () { }), str, '[str].reduceRight(function () { })');
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
to null (type conversion)) 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();
f.length = null; f.length = null;
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
to false (type conversion)) 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();
f.length = false; f.length = false;
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
to 0 (type conversion)) 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();
f.length = 0; f.length = 0;
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
to '0' (type conversion)) 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();
f.length = '0'; f.length = '0';
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
with obj with valueOf) 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();
@ -19,10 +17,4 @@ function testcase() {
f.length = o; f.length = o;
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
with obj w/o valueOf (toString)) with obj w/o valueOf (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();
@ -25,10 +23,4 @@ function testcase() {
// resulting string to a number. // resulting string to a number.
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
with []) 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();
@ -32,10 +30,4 @@ function testcase() {
// or if its one element is not a number, the array converts to NaN. // or if its one element is not a number, the array converts to NaN.
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0 Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden and initialValue is present (subclassed Array, length overridden
with [0]) with [0])
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();
@ -32,10 +30,4 @@ function testcase() {
// or if its one element is not a number, the array converts to NaN. // or if its one element is not a number, the array converts to NaN.
function cb(){} function cb(){}
try { assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-ii-2
description: > description: >
Array.prototype.reduceRight - deleted properties in step 2 are Array.prototype.reduceRight - deleted properties in step 2 are
visible here visible here
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 2: "accumulator", 3: "another" }; var obj = { 2: "accumulator", 3: "another" };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
@ -21,6 +18,4 @@ function testcase() {
configurable: true configurable: true
}); });
return "accumulator" !== Array.prototype.reduceRight.call(obj, function () { }); assert.notSameValue(Array.prototype.reduceRight.call(obj, function () { }), "accumulator", 'Array.prototype.reduceRight.call(obj, function () { })');
}
runTestCase(testcase);

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