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

This commit is contained in:
André Bargull 2015-08-06 18:17:18 +02:00
parent 7510a91a7e
commit 354b7cc11b
105 changed files with 194 additions and 684 deletions

View File

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

View File

@ -4,12 +4,6 @@
/*--- /*---
es5id: 15.4.4.15-0-2 es5id: 15.4.4.15-0-2
description: Array.prototype.lastIndexOf has a length property whose value is 1. description: Array.prototype.lastIndexOf has a length property whose value is 1.
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(Array.prototype.lastIndexOf.length, 1, 'Array.prototype.lastIndexOf.length');
if (Array.prototype.lastIndexOf.length === 1) {
return true;
}
}
runTestCase(testcase);

View File

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-1-11 es5id: 15.4.4.15-1-11
description: Array.prototype.lastIndexOf applied to Date object description: Array.prototype.lastIndexOf applied to Date object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = new Date(); var obj = new Date();
obj.length = 2; obj.length = 2;
obj[1] = true; obj[1] = true;
return Array.prototype.lastIndexOf.call(obj, true) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
}
runTestCase(testcase);

View File

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-1-12 es5id: 15.4.4.15-1-12
description: Array.prototype.lastIndexOf applied to RegExp object description: Array.prototype.lastIndexOf applied to RegExp object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = new RegExp("afdasf"); var obj = new RegExp("afdasf");
obj.length = 100; obj.length = 100;
obj[1] = "afdasf"; obj[1] = "afdasf";
return Array.prototype.lastIndexOf.call(obj, "afdasf") === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, "afdasf"), 1, 'Array.prototype.lastIndexOf.call(obj, "afdasf")');
}
runTestCase(testcase);

View File

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-1-14 es5id: 15.4.4.15-1-14
description: Array.prototype.lastIndexOf applied to Error object description: Array.prototype.lastIndexOf applied to Error object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = new SyntaxError(); var obj = new SyntaxError();
obj.length = 2; obj.length = 2;
obj[1] = Infinity; obj[1] = Infinity;
return Array.prototype.lastIndexOf.call(obj, Infinity) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, Infinity), 1, 'Array.prototype.lastIndexOf.call(obj, Infinity)');
}
runTestCase(testcase);

View File

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-1-15 es5id: 15.4.4.15-1-15
description: Array.prototype.lastIndexOf applied to the Arguments object description: Array.prototype.lastIndexOf applied to the Arguments object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = (function fun() { var obj = (function fun() {
return arguments; return arguments;
}(1, 2, 3)); }(1, 2, 3));
return Array.prototype.lastIndexOf.call(obj, 2) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2), 1, 'Array.prototype.lastIndexOf.call(obj, 2)');
}
runTestCase(testcase);

View File

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-1-4 es5id: 15.4.4.15-1-4
description: Array.prototype.lastIndexOf applied to Boolean object description: Array.prototype.lastIndexOf applied to Boolean object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = new Boolean(false); var obj = new Boolean(false);
obj.length = 2; obj.length = 2;
obj[1] = true; obj[1] = true;
return Array.prototype.lastIndexOf.call(obj, true) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
}
runTestCase(testcase);

View File

@ -4,15 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-1-6 es5id: 15.4.4.15-1-6
description: Array.prototype.lastIndexOf applied to Number object description: Array.prototype.lastIndexOf applied to Number object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = new Number(-3); var obj = new Number(-3);
obj.length = 2; obj.length = 2;
obj[1] = true; obj[1] = true;
return Array.prototype.lastIndexOf.call(obj, true) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
}
runTestCase(testcase);

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 15.4.4.15-1-8 es5id: 15.4.4.15-1-8
description: Array.prototype.lastIndexOf applied to String object description: Array.prototype.lastIndexOf applied to String object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = new String("undefined"); var obj = new String("undefined");
return Array.prototype.lastIndexOf.call(obj, "f") === 4; assert.sameValue(Array.prototype.lastIndexOf.call(obj, "f"), 4, 'Array.prototype.lastIndexOf.call(obj, "f")');
}
runTestCase(testcase);

View File

@ -4,16 +4,11 @@
/*--- /*---
es5id: 15.4.4.15-1-9 es5id: 15.4.4.15-1-9
description: Array.prototype.lastIndexOf applied to Function object description: Array.prototype.lastIndexOf applied to Function object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = function (a, b) { var obj = function (a, b) {
return a + b; return a + b;
}; };
obj[1] = true; obj[1] = true;
return Array.prototype.lastIndexOf.call(obj, true) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
}
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.4.4.15-2-1
description: > description: >
Array.prototype.lastIndexOf - 'length' is own data property on an Array.prototype.lastIndexOf - 'length' is own data property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 1: null, 2: undefined, length: 2 }; var obj = { 1: null, 2: undefined, length: 2 };
return Array.prototype.lastIndexOf.call(obj, null) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, null), 1, 'Array.prototype.lastIndexOf.call(obj, null)');
Array.prototype.lastIndexOf.call(obj, undefined) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, undefined), -1, 'Array.prototype.lastIndexOf.call(obj, undefined)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-10
description: > description: >
Array.prototype.lastIndexOf - 'length' is inherited accessor Array.prototype.lastIndexOf - 'length' is inherited accessor
property on an Array-like object property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "length", { Object.defineProperty(proto, "length", {
get: function () { get: function () {
@ -26,7 +23,5 @@ function testcase() {
child[1] = 1; child[1] = 1;
child[2] = 2; child[2] = 2;
return Array.prototype.lastIndexOf.call(child, 1) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(child, 1), 1, 'Array.prototype.lastIndexOf.call(child, 1)');
Array.prototype.lastIndexOf.call(child, 2) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(child, 2), -1, 'Array.prototype.lastIndexOf.call(child, 2)');
}
runTestCase(testcase);

View File

@ -6,17 +6,12 @@ es5id: 15.4.4.15-2-11
description: > description: >
Array.prototype.lastIndexOf - 'length' is own accessor property Array.prototype.lastIndexOf - 'length' is own accessor property
without a get function on an Array-like object without a get function on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 1 }; var obj = { 0: 1 };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
return Array.prototype.lastIndexOf.call(obj, 1) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 1), -1, 'Array.prototype.lastIndexOf.call(obj, 1)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-13
description: > description: >
Array.prototype.lastIndexOf - 'length' is inherited accessor Array.prototype.lastIndexOf - 'length' is inherited accessor
property without a get function on an Array-like object property without a get function on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "length", { Object.defineProperty(proto, "length", {
set: function () { }, set: function () { },
@ -23,6 +20,4 @@ function testcase() {
var child = new Con(); var child = new Con();
child[0] = true; child[0] = true;
return Array.prototype.lastIndexOf.call(child, true) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(child, true), -1, 'Array.prototype.lastIndexOf.call(child, true)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-2-14
description: > description: >
Array.prototype.lastIndexOf - 'length' is undefined property on an Array.prototype.lastIndexOf - 'length' is undefined property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: null, 1: undefined }; var obj = { 0: null, 1: undefined };
return Array.prototype.lastIndexOf.call(obj, null) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, null), -1, 'Array.prototype.lastIndexOf.call(obj, null)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-17
description: > description: >
Array.prototype.lastIndexOf applied to Arguments object which Array.prototype.lastIndexOf applied to Arguments object which
implements its own property get method implements its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = function () { }; var targetObj = function () { };
var func = function (a, b) { var func = function (a, b) {
arguments[2] = function () { }; arguments[2] = function () { };
@ -18,6 +15,4 @@ function testcase() {
Array.prototype.lastIndexOf.call(arguments, arguments[2]) === -1; Array.prototype.lastIndexOf.call(arguments, arguments[2]) === -1;
}; };
return func(0, targetObj); assert(func(0, targetObj), 'func(0, targetObj) !== true');
}
runTestCase(testcase);

View File

@ -6,18 +6,13 @@ es5id: 15.4.4.15-2-19
description: > description: >
Array.prototype.lastIndexOf applied to String object which Array.prototype.lastIndexOf applied to String object which
implements its own property get method implements its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = function (a, b) { var obj = function (a, b) {
return a + b; return a + b;
}; };
obj[1] = "b"; obj[1] = "b";
obj[2] = "c"; obj[2] = "c";
return Array.prototype.lastIndexOf.call(obj, obj[1]) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, obj[1]), 1, 'Array.prototype.lastIndexOf.call(obj, obj[1])');
Array.prototype.lastIndexOf.call(obj, obj[2]) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, obj[2]), -1, 'Array.prototype.lastIndexOf.call(obj, obj[2])');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-3
description: > description: >
Array.prototype.lastIndexOf - 'length' is own data property that Array.prototype.lastIndexOf - 'length' is own data property that
overrides an inherited data property on an Array-like object overrides an inherited data property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {length: 0}; var proto = {length: 0};
var Con = function () {}; var Con = function () {};
@ -20,6 +17,4 @@ function testcase() {
child.length = 2; child.length = 2;
child[1] = child; child[1] = child;
return Array.prototype.lastIndexOf.call(child, child) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(child, child), 1, 'Array.prototype.lastIndexOf.call(child, child)');
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.15-2-5
description: > description: >
Array.prototype.lastIndexOf - 'length' is own data property that Array.prototype.lastIndexOf - 'length' is own data property that
overrides an inherited accessor property on an Array-like object overrides an inherited accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "length", { Object.defineProperty(proto, "length", {
get: function () { get: function () {
@ -29,6 +27,4 @@ function testcase() {
}); });
child[1] = null; child[1] = null;
return Array.prototype.lastIndexOf.call(child, null) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(child, null), 1, 'Array.prototype.lastIndexOf.call(child, null)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-6
description: > description: >
Array.prototype.lastIndexOf - 'length' is an inherited data Array.prototype.lastIndexOf - 'length' is an inherited data
property on an Array-like object property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = { length: 2 }; var proto = { length: 2 };
var Con = function () {}; var Con = function () {};
@ -20,7 +17,5 @@ function testcase() {
child[1] = "x"; child[1] = "x";
child[2] = "y"; child[2] = "y";
return Array.prototype.lastIndexOf.call(child, "x") === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(child, "x"), 1, 'Array.prototype.lastIndexOf.call(child, "x")');
Array.prototype.lastIndexOf.call(child, "y") === -1; assert.sameValue(Array.prototype.lastIndexOf.call(child, "y"), -1, 'Array.prototype.lastIndexOf.call(child, "y")');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-7
description: > description: >
Array.prototype.lastIndexOf - 'length' is own accessor property on Array.prototype.lastIndexOf - 'length' is own accessor property on
an Array-like object an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 1: true, 2: false }; var obj = { 1: true, 2: false };
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
@ -20,7 +17,5 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.lastIndexOf.call(obj, true) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
Array.prototype.lastIndexOf.call(obj, false) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, false), -1, 'Array.prototype.lastIndexOf.call(obj, false)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-2-8
description: > description: >
Array.prototype.lastIndexOf - 'length' is own accessor property Array.prototype.lastIndexOf - 'length' is own accessor property
that overrides an inherited data property on an Array-like object that overrides an inherited data property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = { length: 0 }; var proto = { length: 0 };
var Con = function () {}; var Con = function () {};
@ -26,6 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.lastIndexOf.call(child, eval) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(child, eval), 1, 'Array.prototype.lastIndexOf.call(child, eval)');
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.lastIndexOf - 'length' is own accessor property Array.prototype.lastIndexOf - 'length' is own accessor property
that overrides an inherited accessor property on an Array-like that overrides an inherited accessor property on an Array-like
object object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "length", { Object.defineProperty(proto, "length", {
get: function () { get: function () {
@ -32,6 +30,4 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.lastIndexOf.call(child, true) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(child, true), 1, 'Array.prototype.lastIndexOf.call(child, true)');
}
runTestCase(testcase);

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 15.4.4.15-3-1 es5id: 15.4.4.15-3-1
description: Array.prototype.lastIndexOf - value of 'length' is undefined description: Array.prototype.lastIndexOf - value of 'length' is undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 1, 1: 1, length: undefined }; var obj = { 0: 1, 1: 1, length: undefined };
return Array.prototype.lastIndexOf.call(obj, 1) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 1), -1, 'Array.prototype.lastIndexOf.call(obj, 1)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-3-10
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is NaN) is NaN)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 0, length: NaN }; var obj = { 0: 0, length: NaN };
return Array.prototype.lastIndexOf.call(obj, 0) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 0), -1, 'Array.prototype.lastIndexOf.call(obj, 0)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-11
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string Array.prototype.lastIndexOf - value of 'length' is a string
containing positive number containing positive number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {1: true, 2: false, length: "2"}; var obj = {1: true, 2: false, length: "2"};
return Array.prototype.lastIndexOf.call(obj, true) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
Array.prototype.lastIndexOf.call(obj, false) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, false), -1, 'Array.prototype.lastIndexOf.call(obj, false)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-12
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string Array.prototype.lastIndexOf - value of 'length' is a string
containing negative number containing negative number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {1: null, 2: undefined, length: "-4294967294"}; var obj = {1: null, 2: undefined, length: "-4294967294"};
return Array.prototype.lastIndexOf.call(obj, null) === -1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, null), -1, 'Array.prototype.lastIndexOf.call(obj, null)');
Array.prototype.lastIndexOf.call(obj, undefined) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, undefined), -1, 'Array.prototype.lastIndexOf.call(obj, undefined)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-13
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string Array.prototype.lastIndexOf - value of 'length' is a string
containing a decimal number containing a decimal number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 4: 4, 5: 5, length: "5.512345" }; var obj = { 4: 4, 5: 5, length: "5.512345" };
return Array.prototype.lastIndexOf.call(obj, 4) === 4 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, 4), 4, 'Array.prototype.lastIndexOf.call(obj, 4)');
Array.prototype.lastIndexOf.call(obj, 5) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 5), -1, 'Array.prototype.lastIndexOf.call(obj, 5)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-3-14
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string Array.prototype.lastIndexOf - value of 'length' is a string
containing -Infinity containing -Infinity
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var objThree = { 0: true, 1: true, length: "-Infinity" }; var objThree = { 0: true, 1: true, length: "-Infinity" };
return Array.prototype.lastIndexOf.call(objThree, true) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(objThree, true), -1, 'Array.prototype.lastIndexOf.call(objThree, true)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-15
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string Array.prototype.lastIndexOf - value of 'length' is a string
containing an exponential number containing an exponential number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {229: 229, 230: 2.3E2, length: "2.3E2"}; var obj = {229: 229, 230: 2.3E2, length: "2.3E2"};
return Array.prototype.lastIndexOf.call(obj, 229) === 229 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, 229), 229, 'Array.prototype.lastIndexOf.call(obj, 229)');
Array.prototype.lastIndexOf.call(obj, 2.3E2) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2.3E2), -1, 'Array.prototype.lastIndexOf.call(obj, 2.3E2)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-16
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string which Array.prototype.lastIndexOf - value of 'length' is a string which
is able to be converted into hex number is able to be converted into hex number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 2573: 2573, 2574: 0x000A0E, length: "0x000A0E" }; var obj = { 2573: 2573, 2574: 0x000A0E, length: "0x000A0E" };
return Array.prototype.lastIndexOf.call(obj, 2573) === 2573 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2573), 2573, 'Array.prototype.lastIndexOf.call(obj, 2573)');
Array.prototype.lastIndexOf.call(obj, 0x000A0E) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 0x000A0E), -1, 'Array.prototype.lastIndexOf.call(obj, 0x000A0E)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-17
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string Array.prototype.lastIndexOf - value of 'length' is a string
containing a number with leading zeros containing a number with leading zeros
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 1: 1, 2: 2, length: "0002.0" }; var obj = { 1: 1, 2: 2, length: "0002.0" };
return Array.prototype.lastIndexOf.call(obj, 1) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, 1), 1, 'Array.prototype.lastIndexOf.call(obj, 1)');
Array.prototype.lastIndexOf.call(obj, 2) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2), -1, 'Array.prototype.lastIndexOf.call(obj, 2)');
}
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.4.4.15-3-18
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a string that Array.prototype.lastIndexOf - value of 'length' is a string that
can't convert to a number can't convert to a number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = new String("123abc123"); var targetObj = new String("123abc123");
var obj = { 0: targetObj, length: "123abc123" }; var obj = { 0: targetObj, length: "123abc123" };
return Array.prototype.lastIndexOf.call(obj, targetObj) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), -1, 'Array.prototype.lastIndexOf.call(obj, targetObj)');
}
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.4.4.15-3-19
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is an Object which Array.prototype.lastIndexOf - value of 'length' is an Object which
has an own toString method has an own toString method
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
// objects inherit the default valueOf() method from Object // objects inherit the default valueOf() method from Object
// that simply returns itself. Since the default valueOf() method // that simply returns itself. Since the default valueOf() method
// does not return a primitive value, ES next tries to convert the object // does not return a primitive value, ES next tries to convert the object
@ -31,7 +27,5 @@ function testcase() {
} }
}; };
return Array.prototype.lastIndexOf.call(obj, targetObj) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), 1, 'Array.prototype.lastIndexOf.call(obj, targetObj)');
Array.prototype.lastIndexOf.call(obj, 2) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2), -1, 'Array.prototype.lastIndexOf.call(obj, 2)');
}
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 15.4.4.15-3-2
description: > description: >
Array.prototype.lastIndexOf return -1 when value of 'length' is a Array.prototype.lastIndexOf return -1 when value of 'length' is a
boolean (value is true) boolean (value is true)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 0, 1: 1, length: true }; var obj = { 0: 0, 1: 1, length: true };
return Array.prototype.lastIndexOf.call(obj, 0) === 0 &&
Array.prototype.lastIndexOf.call(obj, 1) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 0), 0, 'Array.prototype.lastIndexOf.call(obj, 0)');
} assert.sameValue(Array.prototype.lastIndexOf.call(obj, 1), -1, 'Array.prototype.lastIndexOf.call(obj, 1)');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-3-20
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is an Object which Array.prototype.lastIndexOf - value of 'length' is an Object which
has an own valueOf method has an own valueOf method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
//valueOf method will be invoked first, since hint is Number //valueOf method will be invoked first, since hint is Number
var obj = { var obj = {
1: true, 1: true,
@ -23,7 +20,5 @@ function testcase() {
} }
}; };
return Array.prototype.lastIndexOf.call(obj, true) === 1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 1, 'Array.prototype.lastIndexOf.call(obj, true)');
Array.prototype.lastIndexOf.call(obj, 2) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2), -1, 'Array.prototype.lastIndexOf.call(obj, 2)');
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.lastIndexOf - 'length' is an object that has an Array.prototype.lastIndexOf - 'length' is an object that has an
own valueOf method that returns an object and toString method that own valueOf method that returns an object and toString method that
returns a string returns a string
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
@ -31,6 +28,6 @@ function testcase() {
} }
}; };
return Array.prototype.lastIndexOf.call(obj, targetObj) === 1 && toStringAccessed && valueOfAccessed; assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), 1, 'Array.prototype.lastIndexOf.call(obj, targetObj)');
} assert(toStringAccessed, 'toStringAccessed !== true');
runTestCase(testcase); assert(valueOfAccessed, 'valueOfAccessed !== true');

View File

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

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-24
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a positive Array.prototype.lastIndexOf - value of 'length' is a positive
non-integer, ensure truncation occurs in the proper direction non-integer, ensure truncation occurs in the proper direction
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 122: true, 123: false, length: 123.5 }; var obj = { 122: true, 123: false, length: 123.5 };
return Array.prototype.lastIndexOf.call(obj, true) === 122 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 122, 'Array.prototype.lastIndexOf.call(obj, true)');
Array.prototype.lastIndexOf.call(obj, false) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, false), -1, 'Array.prototype.lastIndexOf.call(obj, false)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-25
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a negative Array.prototype.lastIndexOf - value of 'length' is a negative
non-integer non-integer
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 1: true, 2: false, length: -4294967294.5 }; var obj = { 1: true, 2: false, length: -4294967294.5 };
return Array.prototype.lastIndexOf.call(obj, true) === -1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), -1, 'Array.prototype.lastIndexOf.call(obj, true)');
Array.prototype.lastIndexOf.call(obj, false) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, false), -1, 'Array.prototype.lastIndexOf.call(obj, false)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-3-3
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is 0) is 0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: "undefined", length: 0 }; var obj = { 0: "undefined", length: 0 };
return Array.prototype.lastIndexOf.call(obj, "undefined") === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, "undefined"), -1, 'Array.prototype.lastIndexOf.call(obj, "undefined")');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-3-4
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is -0) is -0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: true, length: -0 }; var obj = { 0: true, length: -0 };
return Array.prototype.lastIndexOf.call(obj, true) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), -1, 'Array.prototype.lastIndexOf.call(obj, true)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-3-5
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is +0) is +0)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: +0, length: +0 }; var obj = { 0: +0, length: +0 };
return Array.prototype.lastIndexOf.call(obj, +0) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, +0), -1, 'Array.prototype.lastIndexOf.call(obj, +0)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-6
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is a positive number) is a positive number)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 99: true, 100: 100, length: 100 }; var obj = { 99: true, 100: 100, length: 100 };
return Array.prototype.lastIndexOf.call(obj, true) === 99 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, true), 99, 'Array.prototype.lastIndexOf.call(obj, true)');
Array.prototype.lastIndexOf.call(obj, 100) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 100), -1, 'Array.prototype.lastIndexOf.call(obj, 100)');
}
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-3-7
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is a negative number) is a negative number)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 4: -Infinity, 5: Infinity, length: 5 - Math.pow(2, 32) }; var obj = { 4: -Infinity, 5: Infinity, length: 5 - Math.pow(2, 32) };
return Array.prototype.lastIndexOf.call(obj, -Infinity) === -1 && assert.sameValue(Array.prototype.lastIndexOf.call(obj, -Infinity), -1, 'Array.prototype.lastIndexOf.call(obj, -Infinity)');
Array.prototype.lastIndexOf.call(obj, Infinity) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, Infinity), -1, 'Array.prototype.lastIndexOf.call(obj, Infinity)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-3-9
description: > description: >
Array.prototype.lastIndexOf - value of 'length' is a number (value Array.prototype.lastIndexOf - value of 'length' is a number (value
is -Infinity) is -Infinity)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { 0: 0, length: -Infinity }; var obj = { 0: 0, length: -Infinity };
return Array.prototype.lastIndexOf.call(obj, 0) === -1; assert.sameValue(Array.prototype.lastIndexOf.call(obj, 0), -1, 'Array.prototype.lastIndexOf.call(obj, 0)');
}
runTestCase(testcase);

View File

@ -6,13 +6,8 @@ es5id: 15.4.4.15-4-1
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 (empty Array.prototype.lastIndexOf returns -1 if 'length' is 0 (empty
array) array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var i = [].lastIndexOf(42); var i = [].lastIndexOf(42);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -4,12 +4,9 @@
/*--- /*---
es5id: 15.4.4.15-4-10 es5id: 15.4.4.15-4-10
description: Array.prototype.lastIndexOf - 'length' is a number of value -6e-1 description: Array.prototype.lastIndexOf - 'length' is a number of value -6e-1
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = []; var targetObj = [];
var obj = { 0: targetObj, 100: targetObj, length: -6e-1 }; var obj = { 0: targetObj, 100: targetObj, length: -6e-1 };
return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;
} assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), -1, 'Array.prototype.lastIndexOf.call(obj, targetObj)');
runTestCase(testcase);

View File

@ -4,12 +4,9 @@
/*--- /*---
es5id: 15.4.4.15-4-11 es5id: 15.4.4.15-4-11
description: Array.prototype.lastIndexOf - 'length' is an empty string description: Array.prototype.lastIndexOf - 'length' is an empty string
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = []; var targetObj = [];
var obj = { 0: targetObj, 100: targetObj, length: "" }; var obj = { 0: targetObj, 100: targetObj, length: "" };
return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;
} assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), -1, 'Array.prototype.lastIndexOf.call(obj, targetObj)');
runTestCase(testcase);

View File

@ -6,15 +6,9 @@ es5id: 15.4.4.15-4-2
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length
overridden to null (type conversion)) overridden to null (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var i = Array.prototype.lastIndexOf.call({length: null}, 1); var i = Array.prototype.lastIndexOf.call({length: null}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -6,15 +6,9 @@ es5id: 15.4.4.15-4-3
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 (length Array.prototype.lastIndexOf returns -1 if 'length' is 0 (length
overridden to false (type conversion)) overridden to false (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var i = Array.prototype.lastIndexOf.call({length: false}, 1); var i = Array.prototype.lastIndexOf.call({length: false}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.15-4-4
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 (generic Array.prototype.lastIndexOf returns -1 if 'length' is 0 (generic
'array' with length 0 ) 'array' with length 0 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -17,8 +15,5 @@ function testcase() {
var i = Array.prototype.lastIndexOf.call({length: 0}, 1); var i = Array.prototype.lastIndexOf.call({length: 0}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -6,15 +6,9 @@ es5id: 15.4.4.15-4-5
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length
overridden to '0' (type conversion)) overridden to '0' (type conversion))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var i = Array.prototype.lastIndexOf.call({length: '0'}, 1); var i = Array.prototype.lastIndexOf.call({length: '0'}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -6,15 +6,9 @@ es5id: 15.4.4.15-4-6
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 Array.prototype.lastIndexOf returns -1 if 'length' is 0
(subclassed Array, length overridden with obj with valueOf) (subclassed Array, length overridden with obj with valueOf)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var i = Array.prototype.lastIndexOf.call({length: { valueOf: function () { return 0;}}}, 1); var i = Array.prototype.lastIndexOf.call({length: { valueOf: function () { return 0;}}}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.15-4-7
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length
is object overridden with obj w/o valueOf (toString)) is object overridden with obj w/o valueOf (toString))
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo.prototype = new Array(1, 2, 3); foo.prototype = new Array(1, 2, 3);
function foo() {} function foo() {}
var f = new foo(); var f = new foo();
@ -24,8 +22,5 @@ function testcase() {
// resulting string to a number. // resulting string to a number.
var i = Array.prototype.lastIndexOf.call({length: { toString: function () { return '0';}}}, 1); var i = Array.prototype.lastIndexOf.call({length: { toString: function () { return '0';}}}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.4.4.15-4-8
description: > description: >
Array.prototype.lastIndexOf returns -1 if 'length' is 0 (length is Array.prototype.lastIndexOf returns -1 if 'length' is 0 (length is
an empty array) an empty array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
// objects inherit the default valueOf method of the Object object; // objects inherit the default valueOf method of the Object object;
// that simply returns the itself. Since the default valueOf() method // that simply returns the itself. Since the default valueOf() method
// does not return a primitive value, ES next tries to convert the object // does not return a primitive value, ES next tries to convert the object
@ -27,8 +23,5 @@ function testcase() {
// or if its one element is not a number, the array converts to NaN. // or if its one element is not a number, the array converts to NaN.
var i = Array.prototype.lastIndexOf.call({length: [ ]}, 1); var i = Array.prototype.lastIndexOf.call({length: [ ]}, 1);
if (i === -1) {
return true; assert.sameValue(i, -1, 'i');
}
}
runTestCase(testcase);

View File

@ -4,12 +4,9 @@
/*--- /*---
es5id: 15.4.4.15-4-9 es5id: 15.4.4.15-4-9
description: Array.prototype.lastIndexOf - 'length' is a number of value 0.1 description: Array.prototype.lastIndexOf - 'length' is a number of value 0.1
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = []; var targetObj = [];
var obj = { 0: targetObj, 100: targetObj, length: 0.1 }; var obj = { 0: targetObj, 100: targetObj, length: 0.1 };
return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;
} assert.sameValue(Array.prototype.lastIndexOf.call(obj, targetObj), -1, 'Array.prototype.lastIndexOf.call(obj, targetObj)');
runTestCase(testcase);

View File

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

View File

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

View File

@ -6,12 +6,9 @@ es5id: 15.4.4.15-5-12
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() {
var arr = []; var arr = [];
arr[Math.pow(2, 32) - 2] = null; // length is the max value of Uint type arr[Math.pow(2, 32) - 2] = null; // length is the max value of Uint type
return arr.lastIndexOf(null, Infinity) === (Math.pow(2, 32) - 2);
} assert.sameValue(arr.lastIndexOf(null, Infinity), Math.pow(2, 32) - 2, 'arr.lastIndexOf(null, Infinity)');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 15.4.4.15-5-16
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() {
var arr = []; var arr = [];
arr[Math.pow(2, 32) - 2] = true; // length is the max value of Uint type arr[Math.pow(2, 32) - 2] = true; // length is the max value of Uint type
return arr.lastIndexOf(true, "Infinity") === (Math.pow(2, 32) - 2);
} assert.sameValue(arr.lastIndexOf(true, "Infinity"), Math.pow(2, 32) - 2, 'arr.lastIndexOf(true, "Infinity")');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 15.4.4.15-5-18
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is a string Array.prototype.lastIndexOf - value of 'fromIndex' is a string
containing an exponential number containing an exponential number
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
return [0, NaN, targetObj, 3, false].lastIndexOf(targetObj, "2E0") === 2 &&
[0, NaN, 3, targetObj, false].lastIndexOf(targetObj, "2E0") === -1; assert.sameValue([0, NaN, targetObj, 3, false].lastIndexOf(targetObj, "2E0"), 2, '[0, NaN, targetObj, 3, false].lastIndexOf(targetObj, "2E0")');
} assert.sameValue([0, NaN, 3, targetObj, false].lastIndexOf(targetObj, "2E0"), -1, '[0, NaN, 3, targetObj, false].lastIndexOf(targetObj, "2E0")');
runTestCase(testcase);

View File

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

View File

@ -6,12 +6,9 @@ es5id: 15.4.4.15-5-20
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' which is a Array.prototype.lastIndexOf - value of 'fromIndex' which is a
string containing a number with leading zeros string containing a number with leading zeros
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
return [0, true, targetObj, 3, false].lastIndexOf(targetObj, "0002.10") === 2 &&
[0, true, 3, targetObj, false].lastIndexOf(targetObj, "0002.10") === -1; assert.sameValue([0, true, targetObj, 3, false].lastIndexOf(targetObj, "0002.10"), 2, '[0, true, targetObj, 3, false].lastIndexOf(targetObj, "0002.10")');
} assert.sameValue([0, true, 3, targetObj, false].lastIndexOf(targetObj, "0002.10"), -1, '[0, true, 3, targetObj, false].lastIndexOf(targetObj, "0002.10")');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-21
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' which is an Array.prototype.lastIndexOf - value of 'fromIndex' which is an
Object, and has an own toString method Object, and has an own toString method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
// objects inherit the default valueOf() method from Object // objects inherit the default valueOf() method from Object
// that simply returns itself. Since the default valueOf() method // that simply returns itself. Since the default valueOf() method
// does not return a primitive value, ES next tries to convert the object // does not return a primitive value, ES next tries to convert the object
@ -23,7 +20,5 @@ function testcase() {
}; };
var targetObj = new RegExp(); var targetObj = new RegExp();
return [0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex) === 2 && assert.sameValue([0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex), 2, '[0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex)');
[0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex) === -1; assert.sameValue([0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex), -1, '[0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-22
description: > description: >
Array.prototype.lastIndexOf - value of 'fromIndex' which is an Array.prototype.lastIndexOf - value of 'fromIndex' which is an
object, and has an own valueOf method object, and has an own valueOf method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var fromIndex = { var fromIndex = {
valueOf: function () { valueOf: function () {
return 2; return 2;
@ -18,7 +15,6 @@ function testcase() {
}; };
var targetObj = function () {}; var targetObj = function () {};
return [0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex) === 2 &&
[0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex) === -1; assert.sameValue([0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex), 2, '[0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex)');
} assert.sameValue([0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex), -1, '[0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex)');
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.lastIndexOf - value of 'fromIndex' is an object Array.prototype.lastIndexOf - value of 'fromIndex' is an object
that has an own valueOf method that returns an object and toString that has an own valueOf method that returns an object and toString
method that returns a string method that returns a string
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
@ -27,6 +24,6 @@ function testcase() {
} }
}; };
return [0, true].lastIndexOf(true, fromIndex) === 1 && toStringAccessed && valueOfAccessed; assert.sameValue([0, true].lastIndexOf(true, fromIndex), 1, '[0, true].lastIndexOf(true, fromIndex)');
} assert(toStringAccessed, 'toStringAccessed !== true');
runTestCase(testcase); assert(valueOfAccessed, 'valueOfAccessed !== true');

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.lastIndexOf use inherited valueOf method when Array.prototype.lastIndexOf use inherited valueOf method when
value of 'fromIndex' is an object with an own toString and value of 'fromIndex' is an object with an own toString and
inherited valueOf methods inherited valueOf methods
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
@ -31,6 +28,6 @@ function testcase() {
return 1; return 1;
}; };
return [0, true].lastIndexOf(true, child) === 1 && valueOfAccessed && !toStringAccessed; assert.sameValue([0, true].lastIndexOf(true, child), 1, '[0, true].lastIndexOf(true, child)');
} assert(valueOfAccessed, 'valueOfAccessed !== true');
runTestCase(testcase); assert.sameValue(toStringAccessed, false, 'toStringAccessed');

View File

@ -6,12 +6,9 @@ es5id: 15.4.4.15-5-31
description: > description: >
Array.prototype.lastIndexOf - 'fromIndex' is a positive Array.prototype.lastIndexOf - 'fromIndex' is a positive
non-integer, verify truncation occurs in the proper direction non-integer, verify truncation occurs in the proper direction
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
return [0, targetObj, true].lastIndexOf(targetObj, 1.5) === 1 &&
[0, true, targetObj].lastIndexOf(targetObj, 1.5) === -1; assert.sameValue([0, targetObj, true].lastIndexOf(targetObj, 1.5), 1, '[0, targetObj, true].lastIndexOf(targetObj, 1.5)');
} assert.sameValue([0, true, targetObj].lastIndexOf(targetObj, 1.5), -1, '[0, true, targetObj].lastIndexOf(targetObj, 1.5)');
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.4.4.15-5-32
description: > description: >
Array.prototype.lastIndexOf - 'fromIndex' is a negative Array.prototype.lastIndexOf - 'fromIndex' is a negative
non-integer, verify truncation occurs in the proper direction non-integer, verify truncation occurs in the proper direction
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
return [0, targetObj, true].lastIndexOf(targetObj, -2.5) === 1 &&
[0, true, targetObj].lastIndexOf(targetObj, -2.5) === -1;
} assert.sameValue([0, targetObj, true].lastIndexOf(targetObj, -2.5), 1, '[0, targetObj, true].lastIndexOf(targetObj, -2.5)');
runTestCase(testcase); assert.sameValue([0, true, targetObj].lastIndexOf(targetObj, -2.5), -1, '[0, true, targetObj].lastIndexOf(targetObj, -2.5)');

View File

@ -4,14 +4,11 @@
/*--- /*---
es5id: 15.4.4.15-5-6 es5id: 15.4.4.15-5-6
description: Array.prototype.lastIndexOf when 'fromIndex' isn't passed description: Array.prototype.lastIndexOf when 'fromIndex' isn't passed
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1, 2, 3, 4]; var arr = [0, 1, 2, 3, 4];
//'fromIndex' will be set as 4 if not passed by default //'fromIndex' will be set as 4 if not passed by default
return arr.lastIndexOf(0) === arr.lastIndexOf(0, 4) &&
arr.lastIndexOf(2) === arr.lastIndexOf(2, 4) && assert.sameValue(arr.lastIndexOf(0), arr.lastIndexOf(0, 4), 'arr.lastIndexOf(0)');
arr.lastIndexOf(4) === arr.lastIndexOf(4, 4); assert.sameValue(arr.lastIndexOf(2), arr.lastIndexOf(2, 4), 'arr.lastIndexOf(2)');
} assert.sameValue(arr.lastIndexOf(4), arr.lastIndexOf(4, 4), 'arr.lastIndexOf(4)');
runTestCase(testcase);

View File

@ -6,14 +6,9 @@ es5id: 15.4.4.15-6-1
description: > description: >
Array.prototype.lastIndexOf when fromIndex greater than Array.prototype.lastIndexOf when fromIndex greater than
Array.length Array.length
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,3); var a = new Array(1,2,3);
if (a.lastIndexOf(3,5.4) === 2 &&
a.lastIndexOf(3,3.1) === 2 ) { assert.sameValue(a.lastIndexOf(3,5.4), 2, 'a.lastIndexOf(3,5.4)');
return true; assert.sameValue(a.lastIndexOf(3,3.1), 2, 'a.lastIndexOf(3,3.1)');
}
}
runTestCase(testcase);

View File

@ -4,16 +4,11 @@
/*--- /*---
es5id: 15.4.4.15-7-1 es5id: 15.4.4.15-7-1
description: Array.prototype.lastIndexOf with negative fromIndex description: Array.prototype.lastIndexOf with negative fromIndex
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(1,2,3); var a = new Array(1,2,3);
if (a.lastIndexOf(2,-2) === 1 &&
a.lastIndexOf(2,-3) === -1 && assert.sameValue(a.lastIndexOf(2,-2), 1, 'a.lastIndexOf(2,-2)');
a.lastIndexOf(1,-5.3) === -1 ) { assert.sameValue(a.lastIndexOf(2,-3), -1, 'a.lastIndexOf(2,-3)');
return true; assert.sameValue(a.lastIndexOf(1,-5.3), -1, 'a.lastIndexOf(1,-5.3)');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-11
description: > description: >
Array.prototype.lastIndexOf - the length of iteration isn't Array.prototype.lastIndexOf - the length of iteration isn't
changed by adding elements to the array during iteration changed by adding elements to the array during iteration
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [20]; var arr = [20];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -21,6 +18,4 @@ function testcase() {
configurable: true configurable: true
}); });
return arr.lastIndexOf(1) === -1; assert.sameValue(arr.lastIndexOf(1), -1, 'arr.lastIndexOf(1)');
}
runTestCase(testcase);

View File

@ -4,16 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-8-3 es5id: 15.4.4.15-8-3
description: Array.prototype.lastIndexOf must return correct index(string) description: Array.prototype.lastIndexOf 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(szFalse, "false","false1",undefined,0,false,null,1,obj,0); var a = new Array(szFalse, "false","false1",undefined,0,false,null,1,obj,0);
if (a.lastIndexOf("false") === 1)
{ assert.sameValue(a.lastIndexOf("false"), 1, 'a.lastIndexOf("false")');
return true;
}
}
runTestCase(testcase);

View File

@ -4,17 +4,11 @@
/*--- /*---
es5id: 15.4.4.15-8-4 es5id: 15.4.4.15-8-4
description: Array.prototype.lastIndexOf must return correct index(undefined) description: Array.prototype.lastIndexOf 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(_undefined1,_undefined2,undefined,true,0,false,null,1,"undefined",obj,1); var a = new Array(_undefined1,_undefined2,undefined,true,0,false,null,1,"undefined",obj,1);
if (a.lastIndexOf(undefined) === 2)
{ assert.sameValue(a.lastIndexOf(undefined), 2, 'a.lastIndexOf(undefined)');
return true;
}
}
runTestCase(testcase);

View File

@ -4,17 +4,11 @@
/*--- /*---
es5id: 15.4.4.15-8-5 es5id: 15.4.4.15-8-5
description: Array.prototype.lastIndexOf must return correct index(Object) description: Array.prototype.lastIndexOf 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(obj2,obj1,obj3,false,undefined,0,false,null,{toString:function (){return "false"}},"false"); var a = new Array(obj2,obj1,obj3,false,undefined,0,false,null,{toString:function (){return "false"}},"false");
if (a.lastIndexOf(obj3) === 2)
{ assert.sameValue(a.lastIndexOf(obj3), 2, 'a.lastIndexOf(obj3)');
return true;
}
}
runTestCase(testcase);

View File

@ -4,16 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-8-6 es5id: 15.4.4.15-8-6
description: Array.prototype.lastIndexOf must return correct index(null) description: Array.prototype.lastIndexOf 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,null,true,false,undefined,_null,"null",undefined,"str",obj); var a = new Array(true,undefined,0,false,null,1,"str",0,1,null,true,false,undefined,_null,"null",undefined,"str",obj);
if (a.lastIndexOf(null) === 13 )
{ assert.sameValue(a.lastIndexOf(null), 13, 'a.lastIndexOf(null)');
return true;
}
}
runTestCase(testcase);

View File

@ -6,16 +6,10 @@ es5id: 15.4.4.15-8-7
description: > description: >
Array.prototype.lastIndexOf must return correct index (self Array.prototype.lastIndexOf must return correct index (self
reference) reference)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(0,1,2,3); var a = new Array(0,1,2,3);
a[2] = a; a[2] = a;
if (a.lastIndexOf(a) === 2 &&
a.lastIndexOf(3) === 3 ) assert.sameValue(a.lastIndexOf(a), 2, 'a.lastIndexOf(a)');
{ assert.sameValue(a.lastIndexOf(3), 3, 'a.lastIndexOf(3)');
return true;
}
}
runTestCase(testcase);

View File

@ -4,16 +4,10 @@
/*--- /*---
es5id: 15.4.4.15-8-8 es5id: 15.4.4.15-8-8
description: Array.prototype.lastIndexOf must return correct index (Array) description: Array.prototype.lastIndexOf must return correct index (Array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var b = new Array("0,1"); var b = new Array("0,1");
var a = new Array(0,b,"0,1",3); var a = new Array(0,b,"0,1",3);
if (a.lastIndexOf(b.toString()) === 2 &&
a.lastIndexOf("0,1") === 2 ) assert.sameValue(a.lastIndexOf(b.toString()), 2, 'a.lastIndexOf(b.toString())');
{ assert.sameValue(a.lastIndexOf("0,1"), 2, 'a.lastIndexOf("0,1")');
return true;
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.15-8-9
description: > description: >
Array.prototype.lastIndexOf must return correct index (Sparse Array.prototype.lastIndexOf must return correct index (Sparse
Array) Array)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = new Array(0,1); var a = new Array(0,1);
a[4294967294] = 2; // 2^32-2 - is max array element index a[4294967294] = 2; // 2^32-2 - is max array element index
a[4294967295] = 3; // 2^32-1 added as non-array element property a[4294967295] = 3; // 2^32-1 added as non-array element property
@ -21,9 +19,7 @@ function testcase() {
a[4294967202] = 5; a[4294967202] = 5;
return (a.lastIndexOf(2) === 4294967294 && assert.sameValue(a.lastIndexOf(2), 4294967294, 'a.lastIndexOf(2)');
a.lastIndexOf(3) === 4294967200 && assert.sameValue(a.lastIndexOf(3), 4294967200, 'a.lastIndexOf(3)');
a.lastIndexOf(4) === 4294967201 && assert.sameValue(a.lastIndexOf(4), 4294967201, 'a.lastIndexOf(4)');
a.lastIndexOf(5) === 4294967202) ; assert.sameValue(a.lastIndexOf(5), 4294967202, 'a.lastIndexOf(5)');
}
runTestCase(testcase);

View File

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

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-11
description: > description: >
Array.prototype.lastIndexOf - deleting own property causes index Array.prototype.lastIndexOf - deleting own property causes index
property not to be visited on an Array-like object property not to be visited on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = { length: 200 }; var arr = { length: 200 };
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
@ -28,6 +25,4 @@ function testcase() {
configurable: true configurable: true
}); });
return -1 === Array.prototype.lastIndexOf.call(arr, 6.99); assert.sameValue(Array.prototype.lastIndexOf.call(arr, 6.99), -1, 'Array.prototype.lastIndexOf.call(arr, 6.99)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-12
description: > description: >
Array.prototype.lastIndexOf - deleting own property causes index Array.prototype.lastIndexOf - deleting own property causes index
property not to be visited on an Array property not to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [1, 2, 3, 4]; var arr = [1, 2, 3, 4];
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
@ -28,6 +25,4 @@ function testcase() {
configurable: true configurable: true
}); });
return -1 === arr.lastIndexOf("6.99"); assert.sameValue(arr.lastIndexOf("6.99"), -1, 'arr.lastIndexOf("6.99")');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-17
description: > description: >
Array.prototype.lastIndexOf - decreasing length of array causes Array.prototype.lastIndexOf - decreasing length of array causes
index property not to be visited index property not to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1, 2, "last", 4]; var arr = [0, 1, 2, "last", 4];
Object.defineProperty(arr, "4", { Object.defineProperty(arr, "4", {
@ -21,6 +18,4 @@ function testcase() {
configurable: true configurable: true
}); });
return -1 === arr.lastIndexOf("last"); assert.sameValue(arr.lastIndexOf("last"), -1, 'arr.lastIndexOf("last")');
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.lastIndexOf - decreasing length of array does not Array.prototype.lastIndexOf - decreasing length of array does not
delete non-configurable properties delete non-configurable properties
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1, 2, 3]; var arr = [0, 1, 2, 3];
Object.defineProperty(arr, "2", { Object.defineProperty(arr, "2", {
@ -29,6 +26,4 @@ function testcase() {
configurable: true configurable: true
}); });
return 2 === arr.lastIndexOf("unconfigurable"); assert.sameValue(arr.lastIndexOf("unconfigurable"), 2, 'arr.lastIndexOf("unconfigurable")');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-2
description: > description: >
Array.prototype.lastIndexOf - added properties in step 5 are Array.prototype.lastIndexOf - added properties in step 5 are
visible here on an Array-like object visible here on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = { length: 30 }; var arr = { length: 30 };
var targetObj = function () { }; var targetObj = function () { };
@ -21,6 +18,5 @@ function testcase() {
} }
}; };
return 4 === Array.prototype.lastIndexOf.call(arr, targetObj, fromIndex);
} assert.sameValue(Array.prototype.lastIndexOf.call(arr, targetObj, fromIndex), 4, 'Array.prototype.lastIndexOf.call(arr, targetObj, fromIndex)');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-3
description: > description: >
Array.prototype.lastIndexOf - added properties in step 5 are Array.prototype.lastIndexOf - added properties in step 5 are
visible here on an Array visible here on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
arr.length = 30; arr.length = 30;
var targetObj = function () { }; var targetObj = function () { };
@ -22,6 +19,4 @@ function testcase() {
} }
}; };
return 4 === arr.lastIndexOf(targetObj, fromIndex); assert.sameValue(arr.lastIndexOf(targetObj, fromIndex), 4, 'arr.lastIndexOf(targetObj, fromIndex)');
}
runTestCase(testcase);

View File

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

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-5
description: > description: >
Array.prototype.lastIndexOf - deleted properties of step 5 are Array.prototype.lastIndexOf - deleted properties of step 5 are
visible here on an Array-like object visible here on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = { 10: false, length: 30 }; var arr = { 10: false, length: 30 };
var fromIndex = { var fromIndex = {
@ -20,6 +17,4 @@ function testcase() {
} }
}; };
return -1 === Array.prototype.lastIndexOf.call(arr, false, fromIndex); assert.sameValue(Array.prototype.lastIndexOf.call(arr, false, fromIndex), -1, 'Array.prototype.lastIndexOf.call(arr, false, fromIndex)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-6
description: > description: >
Array.prototype.lastIndexOf - deleted properties of step 5 are Array.prototype.lastIndexOf - deleted properties of step 5 are
visible here on an Array visible here on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
arr[10] = "10"; arr[10] = "10";
arr.length = 20; arr.length = 20;
@ -22,6 +19,4 @@ function testcase() {
} }
}; };
return -1 === arr.lastIndexOf("10", fromIndex); assert.sameValue(arr.lastIndexOf("10", fromIndex), -1, 'arr.lastIndexOf("10", fromIndex)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-7
description: > description: >
Array.prototype.lastIndexOf - properties added into own object Array.prototype.lastIndexOf - properties added into own object
after current position are visited on an Array-like object after current position are visited on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = { length: 8 }; var arr = { length: 8 };
Object.defineProperty(arr, "4", { Object.defineProperty(arr, "4", {
@ -26,6 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.lastIndexOf.call(arr, 1) === 1; assert.sameValue(Array.prototype.lastIndexOf.call(arr, 1), 1, 'Array.prototype.lastIndexOf.call(arr, 1)');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-a-8
description: > description: >
Array.prototype.lastIndexOf - properties added into own object Array.prototype.lastIndexOf - properties added into own object
after current position are visited on an Array after current position are visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, , 2]; var arr = [0, , 2];
Object.defineProperty(arr, "2", { Object.defineProperty(arr, "2", {
@ -26,6 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
return arr.lastIndexOf(1) === 1; assert.sameValue(arr.lastIndexOf(1), 1, 'arr.lastIndexOf(1)');
}
runTestCase(testcase);

View File

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

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-b-i-10
description: > description: >
Array.prototype.lastIndexOf - element to be retrieved is own Array.prototype.lastIndexOf - element to be retrieved is own
accessor property on an Array-like object accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { length: 3 }; var obj = { length: 3 };
Object.defineProperty(obj, "0", { Object.defineProperty(obj, "0", {
get: function () { get: function () {
@ -33,8 +30,6 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === Array.prototype.lastIndexOf.call(obj, 0) && assert.sameValue(Array.prototype.lastIndexOf.call(obj, 0), 0, 'Array.prototype.lastIndexOf.call(obj, 0)');
1 === Array.prototype.lastIndexOf.call(obj, 1) && assert.sameValue(Array.prototype.lastIndexOf.call(obj, 1), 1, 'Array.prototype.lastIndexOf.call(obj, 1)');
2 === Array.prototype.lastIndexOf.call(obj, 2); assert.sameValue(Array.prototype.lastIndexOf.call(obj, 2), 2, 'Array.prototype.lastIndexOf.call(obj, 2)');
}
runTestCase(testcase);

View File

@ -6,17 +6,12 @@ es5id: 15.4.4.15-8-b-i-17
description: > description: >
Array.prototype.lastIndexOf - element to be retrieved is own Array.prototype.lastIndexOf - element to be retrieved is own
accessor property without a get function on an Array accessor property without a get function on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
return arr.lastIndexOf(undefined) === 0; assert.sameValue(arr.lastIndexOf(undefined), 0, 'arr.lastIndexOf(undefined)');
}
runTestCase(testcase);

View File

@ -6,17 +6,12 @@ es5id: 15.4.4.15-8-b-i-18
description: > description: >
Array.prototype.lastIndexOf - element to be retrieved is own Array.prototype.lastIndexOf - element to be retrieved is own
accessor property without a get function on an Array-like object accessor property without a get function on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { length: 1 }; var obj = { length: 1 };
Object.defineProperty(obj, "0", { Object.defineProperty(obj, "0", {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
return 0 === Array.prototype.lastIndexOf.call(obj, undefined); assert.sameValue(Array.prototype.lastIndexOf.call(obj, undefined), 0, 'Array.prototype.lastIndexOf.call(obj, undefined)');
}
runTestCase(testcase);

View File

@ -7,16 +7,11 @@ description: >
Array.prototype.lastIndexOf applied to Arguments object which Array.prototype.lastIndexOf applied to Arguments object which
implements its own property get method (number of arguments is implements its own property get method (number of arguments is
less than number of parameters) less than number of parameters)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var func = function (a, b) { var func = function (a, b) {
return 0 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) && return 0 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) &&
-1 === Array.prototype.lastIndexOf.call(arguments, arguments[1]); -1 === Array.prototype.lastIndexOf.call(arguments, arguments[1]);
}; };
return func(true); assert(func(true), 'func(true) !== true');
}
runTestCase(testcase);

View File

@ -7,17 +7,12 @@ description: >
Array.prototype.lastIndexOf applied to Arguments object which Array.prototype.lastIndexOf applied to Arguments object which
implements its own property get method (number of arguments equals implements its own property get method (number of arguments equals
to number of parameters) to number of parameters)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var func = function (a, b) { var func = function (a, b) {
return 0 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) && return 0 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) &&
1 === Array.prototype.lastIndexOf.call(arguments, arguments[1]) && 1 === Array.prototype.lastIndexOf.call(arguments, arguments[1]) &&
-1 === Array.prototype.lastIndexOf.call(arguments, arguments[2]); -1 === Array.prototype.lastIndexOf.call(arguments, arguments[2]);
}; };
return func(0, true); assert(func(0, true), 'func(0, true) !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-b-i-28
description: > description: >
Array.prototype.lastIndexOf - side-effects are visible in Array.prototype.lastIndexOf - side-effects are visible in
subsequent iterations on an Array subsequent iterations on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var preIterVisible = false; var preIterVisible = false;
var arr = []; var arr = [];
@ -33,6 +30,4 @@ function testcase() {
configurable: true configurable: true
}); });
return arr.lastIndexOf(true) === 1; assert.sameValue(arr.lastIndexOf(true), 1, 'arr.lastIndexOf(true)');
}
runTestCase(testcase);

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