Merge branch 'remove-runTestCase-builtins-other' of https://github.com/anba/test262 into anba-remove-runTestCase-builtins-other

# By André Bargull
# Via André Bargull
* 'remove-runTestCase-builtins-other' of https://github.com/anba/test262:
  Replace runTestCase with assert helpers, rest [test/built-ins]
  Replace runTestCase with assert helpers [test/built-ins]

Conflicts:
	test/built-ins/Array/from/S22.1.2.1_T1.js
	test/built-ins/Array/from/S22.1.2.1_T2.js
	test/built-ins/Array/from/S22.1.2.1_T3.js
This commit is contained in:
Rick Waldron 2015-09-04 13:25:41 -04:00
commit a2554d909b
419 changed files with 938 additions and 3271 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

@ -6,25 +6,17 @@ es5id: 15.4.4.16-4-10
description: > description: >
Array.prototype.every - the exception is not thrown if exception Array.prototype.every - the exception is not thrown if exception
was thrown by step 2 was thrown by step 2
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function () { get: function () {
throw new SyntaxError(); throw new Test262Error();
}, },
configurable: true configurable: true
}); });
try { assert.throws(Test262Error, function() {
Array.prototype.every.call(obj, undefined); Array.prototype.every.call(obj, undefined);
return false; });
} catch (ex) {
return !(ex instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,29 +6,21 @@ es5id: 15.4.4.16-4-11
description: > description: >
Array.prototype.every - the exception is not thrown if exception Array.prototype.every - the exception is not thrown if exception
was thrown by step 3 was thrown by step 3
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function () { get: function () {
return { return {
toString: function () { toString: function () {
throw new SyntaxError(); throw new Test262Error();
} }
}; };
}, },
configurable: true configurable: true
}); });
try { assert.throws(Test262Error, function() {
Array.prototype.every.call(obj, undefined); Array.prototype.every.call(obj, undefined);
return false; });
} catch (ex) {
return !(ex instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,28 +6,22 @@ es5id: 15.4.4.16-7-c-ii-7
description: > description: >
Array.prototype.every - unhandled exceptions happened in Array.prototype.every - unhandled exceptions happened in
callbackfn terminate iteration callbackfn terminate iteration
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var called = 0; var called = 0;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
called++; called++;
if (called === 1) { if (called === 1) {
throw new Error("Exception occurred in callbackfn"); throw new Test262Error("Exception occurred in callbackfn");
} }
return true; return true;
} }
var obj = { 0: 11, 4: 10, 10: 8, length: 20 }; var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
try { assert.throws(Test262Error, function() {
Array.prototype.every.call(obj, callbackfn); Array.prototype.every.call(obj, callbackfn);
return false; });
} catch (ex) {
return 1 === called; assert.sameValue(called, 1, 'called');
}
}
runTestCase(testcase);

View File

@ -6,25 +6,17 @@ es5id: 15.4.4.20-4-10
description: > description: >
Array.prototype.filter - the exception is not thrown if exception Array.prototype.filter - the exception is not thrown if exception
was thrown by step 2 was thrown by step 2
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function () { get: function () {
throw new SyntaxError(); throw new Test262Error();
}, },
configurable: true configurable: true
}); });
try { assert.throws(Test262Error, function() {
Array.prototype.filter.call(obj, undefined); Array.prototype.filter.call(obj, undefined);
return false; });
} catch (ex) {
return !(ex instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,29 +6,21 @@ es5id: 15.4.4.20-4-11
description: > description: >
Array.prototype.filter - the exception is not thrown if exception Array.prototype.filter - the exception is not thrown if exception
was thrown by step 3 was thrown by step 3
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function () { get: function () {
return { return {
toString: function () { toString: function () {
throw new SyntaxError(); throw new Test262Error();
} }
}; };
}, },
configurable: true configurable: true
}); });
try { assert.throws(Test262Error, function() {
Array.prototype.filter.call(obj, undefined); Array.prototype.filter.call(obj, undefined);
return false; });
} catch (ex) {
return !(ex instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -5,10 +5,9 @@
es5id: 15.4.4.20-5-1 es5id: 15.4.4.20-5-1
description: Array.prototype.filter - thisArg is passed description: Array.prototype.filter - thisArg is passed
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function() {
this._15_4_4_20_5_1 = false; this._15_4_4_20_5_1 = false;
var _15_4_4_20_5_1 = true; var _15_4_4_20_5_1 = true;
@ -17,6 +16,6 @@ function testcase() {
} }
var srcArr = [1]; var srcArr = [1];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
return resArr.length === 0;
} assert.sameValue(resArr.length, 0, 'resArr.length');
runTestCase(testcase); })();

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-3
description: > description: >
Array.prototype.filter doesn't visit deleted elements in array Array.prototype.filter doesn't visit deleted elements in array
after the call after the call
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
delete srcArr[2]; delete srcArr[2];
@ -23,8 +20,8 @@ function testcase() {
var srcArr = [1,2,3,4,5]; var srcArr = [1,2,3,4,5];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if(resArr.length === 3 && resArr[0] === 1 && resArr[2] === 4 ) // two elements deleted
return true;
} // two elements deleted
runTestCase(testcase); assert.sameValue(resArr.length, 3, 'resArr.length');
assert.sameValue(resArr[0], 1, 'resArr[0]');
assert.sameValue(resArr[2], 4, 'resArr[2]');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-6
description: > description: >
Array.prototype.filter visits deleted element in array after the Array.prototype.filter visits deleted element in array after the
call when same index is also present in prototype call when same index is also present in prototype
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) function callbackfn(val, idx, obj)
{ {
delete srcArr[2]; delete srcArr[2];
@ -25,8 +22,8 @@ function testcase() {
var srcArr = [1,2,3,4,5]; var srcArr = [1,2,3,4,5];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
delete Array.prototype[4]; delete Array.prototype[4];
if(resArr.length === 4 && resArr[0] === 1 && resArr[3] == 5) // only one element deleted
return true;
} // only one element deleted
runTestCase(testcase); assert.sameValue(resArr.length, 4, 'resArr.length');
assert.sameValue(resArr[0], 1, 'resArr[0]');
assert.sameValue(resArr[3], 5, 'resArr[3]');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-iii-1-2
description: > description: >
Array.prototype.filter - value of returned array element can be Array.prototype.filter - value of returned array element can be
overwritten overwritten
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -18,12 +15,7 @@ function testcase() {
var obj = { 0: 11, 1: 9, length: 2 }; var obj = { 0: 11, 1: 9, length: 2 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
try {
var tempVal = newArr[1]; var tempVal = newArr[1];
newArr[1] += 1; newArr[1] += 1;
return newArr[1] !== tempVal;
} catch (ex) { assert.notSameValue(newArr[1], tempVal, 'newArr[1]');
return false;
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-iii-1-4
description: > description: >
Array.prototype.filter - value of returned array element can be Array.prototype.filter - value of returned array element can be
changed or deleted changed or deleted
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -18,12 +15,8 @@ function testcase() {
var obj = { 0: 11, 1: 9, length: 2 }; var obj = { 0: 11, 1: 9, length: 2 };
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
try {
var tempVal = newArr[1]; var tempVal = newArr[1];
delete newArr[1]; delete newArr[1];
return tempVal !== undefined && newArr[1] === undefined;
} catch (ex) { assert.notSameValue(tempVal, undefined, 'tempVal');
return false; assert.sameValue(newArr[1], undefined, 'newArr[1]');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-iii-1
description: > description: >
Array.prototype.filter - getOwnPropertyDescriptor(all true) of Array.prototype.filter - getOwnPropertyDescriptor(all true) of
returned array element returned array element
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj){ function callbackfn(val, idx, obj){
if(val % 2) if(val % 2)
return true; return true;
@ -19,14 +16,12 @@ function testcase() {
} }
var srcArr = [0,1,2,3,4]; var srcArr = [0,1,2,3,4];
var resArr = srcArr.filter(callbackfn); var resArr = srcArr.filter(callbackfn);
if (resArr.length > 0){
var desc = Object.getOwnPropertyDescriptor(resArr, 1) assert(resArr.length > 0, 'resArr.length > 0');
if(desc.value === 3 && //srcArr[1] = true
desc.writable === true && var desc = Object.getOwnPropertyDescriptor(resArr, 1);
desc.enumerable === true &&
desc.configurable === true){ assert.sameValue(desc.value, 3, 'desc.value'); //srcArr[1] = true
return true; assert.sameValue(desc.writable, true, 'desc.writable');
} assert.sameValue(desc.enumerable, true, 'desc.enumerable');
} assert.sameValue(desc.configurable, true, 'desc.configurable');
}
runTestCase(testcase);

View File

@ -6,25 +6,17 @@ es5id: 15.4.4.18-4-10
description: > description: >
Array.prototype.forEach - the exception is not thrown if exception Array.prototype.forEach - the exception is not thrown if exception
was thrown by step 2 was thrown by step 2
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function () { get: function () {
throw new SyntaxError(); throw new Test262Error();
}, },
configurable: true configurable: true
}); });
try { assert.throws(Test262Error, function() {
Array.prototype.forEach.call(obj, undefined); Array.prototype.forEach.call(obj, undefined);
return false; });
} catch (ex) {
return !(ex instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,29 +6,21 @@ es5id: 15.4.4.18-4-11
description: > description: >
Array.prototype.forEach - the exception is not thrown if exception Array.prototype.forEach - the exception is not thrown if exception
was thrown by step 3 was thrown by step 3
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 11, 1: 12 }; var obj = { 0: 11, 1: 12 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function () { get: function () {
return { return {
toString: function () { toString: function () {
throw new SyntaxError(); throw new Test262Error();
} }
}; };
}, },
configurable: true configurable: true
}); });
try { assert.throws(Test262Error, function() {
Array.prototype.forEach.call(obj, undefined); Array.prototype.forEach.call(obj, undefined);
return false; });
} catch (ex) {
return !(ex instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -5,10 +5,9 @@
es5id: 15.4.4.18-5-1 es5id: 15.4.4.18-5-1
description: Array.prototype.forEach - thisArg is passed description: Array.prototype.forEach - thisArg is passed
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function() {
this._15_4_4_18_5_1 = false; this._15_4_4_18_5_1 = false;
var _15_4_4_18_5_1 = true; var _15_4_4_18_5_1 = true;
var result; var result;
@ -17,6 +16,6 @@ function testcase() {
} }
var arr = [1]; var arr = [1];
arr.forEach(callbackfn) arr.forEach(callbackfn)
return !result;
} assert.sameValue(result, false, 'result');
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,10 +6,8 @@ es5id: 15.4.4.14-10-1
description: > description: >
Array.prototype.indexOf returns -1 for elements not present in Array.prototype.indexOf returns -1 for elements not present in
array array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(); var a = new Array();
a[100] = 1; a[100] = 1;
a[99999] = ""; a[99999] = "";
@ -17,21 +15,15 @@ function testcase() {
a[5555] = 5.5; a[5555] = 5.5;
a[123456] = "str"; a[123456] = "str";
a[5] = 1E+309; a[5] = 1E+309;
if (a.indexOf(1) !== 100 ||
a.indexOf("") !== 99999 || assert.sameValue(a.indexOf(1), 100, 'a.indexOf(1)');
a.indexOf("str") !== 123456 || assert.sameValue(a.indexOf(""), 99999, 'a.indexOf("")');
a.indexOf(1E+309) !== 5 || //Infinity assert.sameValue(a.indexOf("str"), 123456, 'a.indexOf("str")');
a.indexOf(5.5) !== 5555 ) assert.sameValue(a.indexOf(1E+309), 5, 'a.indexOf(1E+309)'); //Infinity
{ assert.sameValue(a.indexOf(5.5), 5555, 'a.indexOf(5.5)');
return false;
} assert.sameValue(a.indexOf(true), -1, 'a.indexOf(true)');
if (a.indexOf(true) === -1 && assert.sameValue(a.indexOf(5), -1, 'a.indexOf(5)');
a.indexOf(5) === -1 && assert.sameValue(a.indexOf("str1"), -1, 'a.indexOf("str1")');
a.indexOf("str1") === -1 && assert.sameValue(a.indexOf(null), -1, 'a.indexOf(null)');
a.indexOf(null) === -1 && assert.sameValue(a.indexOf(new Object()), -1, 'a.indexOf(new Object())');
a.indexOf(new Object()) === -1)
{
return true;
}
}
runTestCase(testcase);

View File

@ -4,30 +4,19 @@
/*--- /*---
es5id: 15.4.4.14-2-15 es5id: 15.4.4.14-2-15
description: Array.prototype.indexOf - 'length' is property of the global object description: Array.prototype.indexOf - 'length' is property of the global object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject().length = 2; fnGlobalObject().length = 2;
fnGlobalObject()[1] = targetObj; fnGlobalObject()[1] = targetObj;
if (Array.prototype.indexOf.call(fnGlobalObject(), targetObj) !== 1) {
return false; assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), 1, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)');
}
fnGlobalObject()[1] = {}; fnGlobalObject()[1] = {};
fnGlobalObject()[2] = targetObj; fnGlobalObject()[2] = targetObj;
return Array.prototype.indexOf.call(fnGlobalObject(), targetObj) === -1; assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), -1, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)');
} finally {
delete fnGlobalObject()[1];
delete fnGlobalObject()[2];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.indexOf throws TypeError exception when 'length' Array.prototype.indexOf throws TypeError exception when 'length'
is an object with toString and valueOf methods that don<EFBFBD>t return is an object with toString and valueOf methods that don<EFBFBD>t return
primitive values primitive values
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
@ -29,11 +26,9 @@ function testcase() {
} }
}; };
try { assert.throws(TypeError, function() {
Array.prototype.indexOf.call(obj); Array.prototype.indexOf.call(obj);
return false; });
} catch (e) {
return toStringAccessed && valueOfAccessed; assert(toStringAccessed, 'toStringAccessed');
} assert(valueOfAccessed, 'valueOfAccessed');
}
runTestCase(testcase);

View File

@ -4,14 +4,9 @@
/*--- /*---
es5id: 15.4.4.14-5-1 es5id: 15.4.4.14-5-1
description: Array.prototype.indexOf when fromIndex is string description: Array.prototype.indexOf when fromIndex is string
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = [1,2,1,2,1,2]; var a = [1,2,1,2,1,2];
if (a.indexOf(2,"2") === 3 && // "2" resolves to 2
a.indexOf(2,"one") === 1) { // "one" resolves to 0 assert.sameValue(a.indexOf(2,"2"), 3, '"2" resolves to 2');
return true; assert.sameValue(a.indexOf(2,"one"), 1, '"one" resolves to 0');
}
}
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

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.14-5-2 es5id: 15.4.4.14-5-2
description: Array.prototype.indexOf when fromIndex is floating point number description: Array.prototype.indexOf when fromIndex is floating point number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,3); var a = new Array(1,2,3);
if (a.indexOf(3,0.49) === 2 && // 0.49 resolves to 0
a.indexOf(1,0.51) === 0 && // 0.51 resolves to 0 assert.sameValue(a.indexOf(3,0.49), 2, '0.49 resolves to 0');
a.indexOf(1,1.51) === -1) { // 1.01 resolves to 1 assert.sameValue(a.indexOf(1,0.51), 0, '0.51 resolves to 0');
return true; assert.sameValue(a.indexOf(1,1.51), -1, '1.51 resolves to 1');
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.indexOf throws TypeError exception when value of Array.prototype.indexOf throws TypeError exception when value of
'fromIndex' is an object with toString and valueOf methods that 'fromIndex' is an object with toString and valueOf methods that
don<EFBFBD>t return primitive values don<EFBFBD>t return primitive values
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
var fromIndex = { var fromIndex = {
@ -26,11 +23,9 @@ function testcase() {
} }
}; };
try { assert.throws(TypeError, function() {
[0, true].indexOf(true, fromIndex); [0, true].indexOf(true, fromIndex);
return false; });
} catch (e) {
return toStringAccessed && valueOfAccessed; assert(toStringAccessed, 'toStringAccessed');
} assert(valueOfAccessed, 'valueOfAccessed');
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.14-5-26
description: > description: >
Array.prototype.indexOf - side effects produced by step 2 are Array.prototype.indexOf - side effects produced by step 2 are
visible when an exception occurs visible when an exception occurs
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var stepTwoOccurs = false; var stepTwoOccurs = false;
var stepFiveOccurs = false; var stepFiveOccurs = false;
@ -33,11 +31,7 @@ function testcase() {
} }
}; };
try {
Array.prototype.indexOf.call(obj, undefined, fromIndex); Array.prototype.indexOf.call(obj, undefined, fromIndex);
return stepTwoOccurs && stepFiveOccurs;
} catch (ex) { assert(stepTwoOccurs, 'stepTwoOccurs !== true');
return false; assert(stepFiveOccurs, 'stepFiveOccurs !== true');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.14-5-27
description: > description: >
Array.prototype.indexOf - side effects produced by step 3 are Array.prototype.indexOf - side effects produced by step 3 are
visible when an exception occurs visible when an exception occurs
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var stepThreeOccurs = false; var stepThreeOccurs = false;
var stepFiveOccurs = false; var stepFiveOccurs = false;
@ -37,11 +35,7 @@ function testcase() {
} }
}; };
try {
Array.prototype.indexOf.call(obj, undefined, fromIndex); Array.prototype.indexOf.call(obj, undefined, fromIndex);
return stepThreeOccurs && stepFiveOccurs;
} catch (ex) { assert(stepThreeOccurs, 'stepThreeOccurs !== true');
return false; assert(stepFiveOccurs, 'stepFiveOccurs !== true');
}
}
runTestCase(testcase);

View File

@ -4,14 +4,9 @@
/*--- /*---
es5id: 15.4.4.14-5-3 es5id: 15.4.4.14-5-3
description: Array.prototype.indexOf when fromIndex is boolean description: Array.prototype.indexOf when fromIndex is boolean
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = [1,2,3]; var a = [1,2,3];
if (a.indexOf(1,true) === -1 && // true resolves to 1
a.indexOf(1,false) === 0 ) { // false resolves to 0 assert.sameValue(a.indexOf(1,true), -1, 'true resolves to 1');
return true; assert.sameValue(a.indexOf(1,false), 0, 'false resolves to 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

@ -4,13 +4,9 @@
/*--- /*---
es5id: 15.4.4.14-5-4 es5id: 15.4.4.14-5-4
description: Array.prototype.indexOf returns 0 if fromIndex is 'undefined' description: Array.prototype.indexOf returns 0 if fromIndex is 'undefined'
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = [1,2,3]; var a = [1,2,3];
if (a.indexOf(1,undefined) === 0) { // undefined resolves to 0
return true; // undefined resolves to 0
} assert.sameValue(a.indexOf(1,undefined), 0, 'a.indexOf(1,undefined)');
}
runTestCase(testcase);

View File

@ -4,13 +4,9 @@
/*--- /*---
es5id: 15.4.4.14-5-5 es5id: 15.4.4.14-5-5
description: Array.prototype.indexOf returns 0 if fromIndex is null description: Array.prototype.indexOf returns 0 if fromIndex is null
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = [1,2,3]; var a = [1,2,3];
if (a.indexOf(1,null) === 0 ) { // null resolves to 0
return true; // null resolves to 0
} assert.sameValue(a.indexOf(1,null), 0, 'a.indexOf(1,null)');
}
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,17 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-9-1 es5id: 15.4.4.14-9-1
description: Array.prototype.indexOf must return correct index (boolean) description: Array.prototype.indexOf must return correct index (boolean)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {toString:function (){return true}}; var obj = {toString:function (){return true}};
var _false = false; var _false = false;
var a = [obj,"true", undefined,0,_false,null,1,"str",0,1,true,false,true,false]; var a = [obj,"true", undefined,0,_false,null,1,"str",0,1,true,false,true,false];
if (a.indexOf(true) === 10 && //a[10]=true
a.indexOf(false) === 4) //a[4] =_false assert.sameValue(a.indexOf(true), 10, 'a[10]=true');
{ assert.sameValue(a.indexOf(false), 4, 'a[4] =_false');
return true;
}
}
runTestCase(testcase);

View File

@ -7,15 +7,9 @@ info: >
and hence NaNs could be found using indexOf * and hence NaNs could be found using indexOf *
es5id: 15.4.4.14-9-10 es5id: 15.4.4.14-9-10
description: Array.prototype.indexOf must return correct index (NaN) description: Array.prototype.indexOf must return correct index (NaN)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _NaN = NaN; var _NaN = NaN;
var a = new Array("NaN",undefined,0,false,null,{toString:function (){return NaN}},"false",_NaN,NaN); var a = new Array("NaN",undefined,0,false,null,{toString:function (){return NaN}},"false",_NaN,NaN);
if (a.indexOf(NaN) === -1) // NaN is equal to nothing, including itself.
{ assert.sameValue(a.indexOf(NaN), -1, 'NaN is equal to nothing, including itself.');
return true;
}
}
runTestCase(testcase);

View File

@ -4,20 +4,14 @@
/*--- /*---
es5id: 15.4.4.14-9-2 es5id: 15.4.4.14-9-2
description: Array.prototype.indexOf must return correct index (Number) description: Array.prototype.indexOf must return correct index (Number)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {toString:function (){return 0}}; var obj = {toString:function (){return 0}};
var one = 1; var one = 1;
var _float = -(4/3); var _float = -(4/3);
var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3)); var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3));
if (a.indexOf(-(4/3)) === 14 && // a[14]=_float===-(4/3)
a.indexOf(0) === 7 && // a[7] = +0, 0===+0 assert.sameValue(a.indexOf(-(4/3)), 14, 'a[14]=_float===-(4/3)');
a.indexOf(-0) === 7 && // a[7] = +0, -0===+0 assert.sameValue(a.indexOf(0), 7, 'a[7] = +0, 0===+0');
a.indexOf(1) === 10 ) // a[10] =one=== 1 assert.sameValue(a.indexOf(-0), 7, 'a[7] = +0, -0===+0');
{ assert.sameValue(a.indexOf(1), 10, 'a[10] =one=== 1');
return true;
}
}
runTestCase(testcase);

View File

@ -4,16 +4,10 @@
/*--- /*---
es5id: 15.4.4.14-9-3 es5id: 15.4.4.14-9-3
description: Array.prototype.indexOf must return correct index(string) description: Array.prototype.indexOf must return correct index(string)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {toString:function (){return "false"}}; var obj = {toString:function (){return "false"}};
var szFalse = "false"; var szFalse = "false";
var a = new Array("false1",undefined,0,false,null,1,obj,0,szFalse, "false"); var a = new Array("false1",undefined,0,false,null,1,obj,0,szFalse, "false");
if (a.indexOf("false") === 8) //a[8]=szFalse
{ assert.sameValue(a.indexOf("false"), 8, 'a[8]=szFalse');
return true;
}
}
runTestCase(testcase);

View File

@ -4,17 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-9-4 es5id: 15.4.4.14-9-4
description: Array.prototype.indexOf must return correct index(undefined) description: Array.prototype.indexOf must return correct index(undefined)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {toString:function (){return undefined;}}; var obj = {toString:function (){return undefined;}};
var _undefined1 = undefined; var _undefined1 = undefined;
var _undefined2; var _undefined2;
var a = new Array(true,0,false,null,1,"undefined",obj,1,_undefined2,_undefined1,undefined); var a = new Array(true,0,false,null,1,"undefined",obj,1,_undefined2,_undefined1,undefined);
if (a.indexOf(undefined) === 8) //a[8]=_undefined2
{ assert.sameValue(a.indexOf(undefined), 8, 'a[8]=_undefined2');
return true;
}
}
runTestCase(testcase);

View File

@ -4,17 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-9-5 es5id: 15.4.4.14-9-5
description: Array.prototype.indexOf must return correct index (Object) description: Array.prototype.indexOf must return correct index (Object)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj1 = {toString:function (){return "false"}}; var obj1 = {toString:function (){return "false"}};
var obj2 = {toString:function (){return "false"}}; var obj2 = {toString:function (){return "false"}};
var obj3 = obj1; var obj3 = obj1;
var a = new Array(false,undefined,0,false,null,{toString:function (){return "false"}},"false",obj2,obj1,obj3); var a = new Array(false,undefined,0,false,null,{toString:function (){return "false"}},"false",obj2,obj1,obj3);
if (a.indexOf(obj3) === 8) //a[8] = obj1;
{ assert.sameValue(a.indexOf(obj3), 8, 'a[8] = obj1');
return true;
}
}
runTestCase(testcase);

View File

@ -4,16 +4,10 @@
/*--- /*---
es5id: 15.4.4.14-9-6 es5id: 15.4.4.14-9-6
description: Array.prototype.indexOf must return correct index(null) description: Array.prototype.indexOf must return correct index(null)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {toString:function (){return null}}; var obj = {toString:function (){return null}};
var _null = null; var _null = null;
var a = new Array(true,undefined,0,false,_null,1,"str",0,1,obj,true,false,null); var a = new Array(true,undefined,0,false,_null,1,"str",0,1,obj,true,false,null);
if (a.indexOf(null) === 4 ) //a[4]=_null
{ assert.sameValue(a.indexOf(null), 4, 'a[4]=_null');
return true;
}
}
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,30 +6,19 @@ es5id: 15.4.4.15-2-15
description: > description: >
Array.prototype.lastIndexOf - 'length' is property of the global Array.prototype.lastIndexOf - 'length' is property of the global
object object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject().length = 2; fnGlobalObject().length = 2;
fnGlobalObject()[1] = targetObj; fnGlobalObject()[1] = targetObj;
if (Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) !== 1) {
return false; assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), 1);
}
fnGlobalObject()[1] = {}; fnGlobalObject()[1] = {};
fnGlobalObject()[2] = targetObj; fnGlobalObject()[2] = targetObj;
return Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), -1);
} finally {
delete fnGlobalObject()[1];
delete fnGlobalObject()[2];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.lastIndexOf throws TypeError exception when Array.prototype.lastIndexOf throws TypeError exception when
'length' is an object with toString and valueOf methods that don<EFBFBD>t 'length' is an object with toString and valueOf methods that don<EFBFBD>t
return primitive values return primitive values
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
@ -30,11 +27,9 @@ function testcase() {
} }
}; };
try { assert.throws(TypeError, function() {
Array.prototype.lastIndexOf.call(obj, true); Array.prototype.lastIndexOf.call(obj, true);
return false; });
} catch (e) {
return toStringAccessed && valueOfAccessed; assert(toStringAccessed, 'toStringAccessed');
} assert(valueOfAccessed, 'valueOfAccessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-3-28
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is boundary value Array.prototype.lastIndexOf - value of 'length' is boundary value
(2^32) (2^32)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
var obj = { var obj = {
0: targetObj, 0: targetObj,
@ -19,6 +16,4 @@ function testcase() {
length: 4294967296 length: 4294967296
}; };
return Array.prototype.lastIndexOf.call(obj, targetObj) === 4294967295; //verify length is 4294967296 finally assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), 4294967295, 'verify length is 4294967296 finally');
}
runTestCase(testcase);

View File

@ -4,14 +4,9 @@
/*--- /*---
es5id: 15.4.4.15-5-1 es5id: 15.4.4.15-5-1
description: Array.prototype.lastIndexOf when fromIndex is string description: Array.prototype.lastIndexOf when fromIndex is string
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(0,1,1); var a = new Array(0,1,1);
if (a.lastIndexOf(1,"1") === 1 && // "1" resolves to 1
a.lastIndexOf(1,"one") === -1) { // NaN string resolves to 0 assert.sameValue(a.lastIndexOf(1,"1"), 1, '"1" resolves to 1');
return true; assert.sameValue(a.lastIndexOf(1,"one"), -1, 'NaN string resolves to 01');
}
}
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

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-5-2 es5id: 15.4.4.15-5-2
description: Array.prototype.lastIndexOf when fromIndex is floating point number description: Array.prototype.lastIndexOf when fromIndex is floating point number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,1); var a = new Array(1,2,1);
if (a.lastIndexOf(2,1.49) === 1 && // 1.49 resolves to 1
a.lastIndexOf(2,0.51) === -1 && // 0.51 resolves to 0 assert.sameValue(a.lastIndexOf(2,1.49), 1, '1.49 resolves to 1');
a.lastIndexOf(1,0.51) === 0){ // 0.51 resolves to 0 assert.sameValue(a.lastIndexOf(2,0.51), -1, '0.51 resolves to 0');
return true; assert.sameValue(a.lastIndexOf(1,0.51), 0, '0.51 resolves to 0');
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.lastIndexOf throws TypeError exception when value Array.prototype.lastIndexOf throws TypeError exception when value
of 'fromIndex' is an object that both toString and valueOf methods of 'fromIndex' is an object that both toString and valueOf methods
than don't return primitive value than don't return primitive value
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
@ -27,11 +24,9 @@ function testcase() {
} }
}; };
try { assert.throws(TypeError, function() {
[0, null].lastIndexOf(null, fromIndex); [0, null].lastIndexOf(null, fromIndex);
return false; });
} catch (e) {
return toStringAccessed && valueOfAccessed; assert(toStringAccessed, 'toStringAccessed');
} assert(valueOfAccessed, 'valueOfAccessed');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-26
description: > description: >
Array.prototype.lastIndexOf - side effects produced by step 2 are Array.prototype.lastIndexOf - side effects produced by step 2 are
visible when an exception occurs visible when an exception occurs
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var stepTwoOccurs = false; var stepTwoOccurs = false;
var stepFiveOccurs = false; var stepFiveOccurs = false;
var obj = {}; var obj = {};
@ -33,11 +30,7 @@ function testcase() {
} }
}; };
try {
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex); Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
return stepTwoOccurs && stepFiveOccurs;
} catch (ex) { assert(stepTwoOccurs, 'stepTwoOccurs !== true');
return false; assert(stepFiveOccurs, 'stepFiveOccurs !== true');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-27
description: > description: >
Array.prototype.lastIndexOf - side effects produced by step 3 are Array.prototype.lastIndexOf - side effects produced by step 3 are
visible when an exception occurs visible when an exception occurs
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var stepThreeOccurs = false; var stepThreeOccurs = false;
var stepFiveOccurs = false; var stepFiveOccurs = false;
@ -38,11 +35,7 @@ function testcase() {
} }
}; };
try {
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex); Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
return stepThreeOccurs && stepFiveOccurs;
} catch (ex) { assert(stepThreeOccurs, 'stepThreeOccurs !== true');
return false; assert(stepFiveOccurs, 'stepFiveOccurs !== true');
}
}
runTestCase(testcase);

View File

@ -4,14 +4,9 @@
/*--- /*---
es5id: 15.4.4.15-5-3 es5id: 15.4.4.15-5-3
description: Array.prototype.lastIndexOf when fromIndex is boolean description: Array.prototype.lastIndexOf when fromIndex is boolean
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,1); var a = new Array(1,2,1);
if (a.lastIndexOf(2,true) === 1 && // true resolves to 1
a.lastIndexOf(2,false) === -1 ) { // false resolves to 0 assert.sameValue(a.lastIndexOf(2,true), 1, 'true resolves to 1');
return true; assert.sameValue(a.lastIndexOf(2,false), -1, 'false resolves to 0');
}
}
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

@ -4,15 +4,11 @@
/*--- /*---
es5id: 15.4.4.15-5-4 es5id: 15.4.4.15-5-4
description: Array.prototype.lastIndexOf when fromIndex is undefined description: Array.prototype.lastIndexOf when fromIndex is undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,1); var a = new Array(1,2,1);
if (a.lastIndexOf(2,undefined) === -1 &&
a.lastIndexOf(1,undefined) === 0 && // undefined resolves to 0, no second argument resolves to len
a.lastIndexOf(1) === 2) { // undefined resolves to 0, no second argument resolves to len assert.sameValue(a.lastIndexOf(2,undefined), -1, 'a.lastIndexOf(2,undefined)');
return true; assert.sameValue(a.lastIndexOf(1,undefined), 0, 'a.lastIndexOf(1,undefined)');
} assert.sameValue(a.lastIndexOf(1), 2, 'a.lastIndexOf(1)');
}
runTestCase(testcase);

View File

@ -4,13 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-5-5 es5id: 15.4.4.15-5-5
description: Array.prototype.lastIndexOf when fromIndex is null description: Array.prototype.lastIndexOf when fromIndex is null
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,1); var a = new Array(1,2,1);
if (a.lastIndexOf(2,null) === -1 && a.lastIndexOf(1,null) === 0) { // null resolves to 0
return true; // null resolves to 0
} assert.sameValue(a.lastIndexOf(2,null), -1, 'a.lastIndexOf(2,null)');
} assert.sameValue(a.lastIndexOf(1,null), 0, 'a.lastIndexOf(1,null)');
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 15.4.4.15-5-7
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, 100].lastIndexOf(100, 0), -1, 'verify fromIndex is not more than 0');
assert.sameValue([200, 0].lastIndexOf(200, 0), 0, 'verify fromIndex is not less than 0');
return [0, 100].lastIndexOf(100, 0) === -1 && // verify fromIndex is not more than 0
[200, 0].lastIndexOf(200, 0) === 0; // verify fromIndex is not less than 0
}
runTestCase(testcase);

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);

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