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
description: Array.isArray applied to boolean primitive
includes: [runTestCase.js]
---*/
function testcase() {
return !Array.isArray(true);
}
runTestCase(testcase);
assert.sameValue(Array.isArray(true), false, 'Array.isArray(true)');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to
null (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = null;
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to
false (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = false;
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to 0
(type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = 0;
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden to
'0' (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = '0';
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with
obj with valueOf)
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
@ -19,10 +17,4 @@ function testcase() {
f.length = o;
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with
obj w/o valueOf (toString))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
@ -25,10 +23,4 @@ function testcase() {
// resulting string to a number.
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with
[])
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function 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.
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduce returns initialValue if 'length' is 0 and
initialValue is present (subclassed Array, length overridden with
[0])
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function 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.
function cb(){}
try {
if(f.reduce(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduce(cb,1), 1, 'f.reduce(cb,1)');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
to null (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = null;
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
to false (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = false;
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
to 0 (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = 0;
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,20 +7,12 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
to '0' (type conversion))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = '0';
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
with obj with valueOf)
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
@ -19,10 +17,4 @@ function testcase() {
f.length = o;
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
with obj w/o valueOf (toString))
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
@ -25,10 +23,4 @@ function testcase() {
// resulting string to a number.
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
with [])
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function 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.
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.reduceRight returns initialValue if 'length' is 0
and initialValue is present (subclassed Array, length overridden
with [0])
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function 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.
function cb(){}
try {
if(f.reduceRight(cb,1) === 1)
return true;
}
catch (e) { }
}
runTestCase(testcase);
assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)');

View File

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

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