mirror of https://github.com/tc39/test262.git
Merge pull request #415 from anba/remove-runTestCase-finally
Replace runTestCase when used with try-finally
This commit is contained in:
commit
9ccc663936
|
@ -6,11 +6,8 @@ es5id: 15.4.4.4-5-b-iii-3-b-1
|
|||
description: >
|
||||
Array.prototype.concat will concat an Array when index property
|
||||
(read-only) exists in Array.prototype (Step 5.b.iii.3.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
value: 100,
|
||||
writable: false,
|
||||
|
@ -39,9 +36,7 @@ function testcase() {
|
|||
delete newArr[0];
|
||||
verifyConfigurable = newArr.hasOwnProperty("0");
|
||||
|
||||
return verifyValue && !verifyConfigurable && verifyEnumerable && verifyWritable;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(verifyValue, 'verifyValue !== true');
|
||||
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
||||
assert(verifyEnumerable, 'verifyEnumerable !== true');
|
||||
assert(verifyWritable, 'verifyWritable !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.4-5-c-i-1
|
|||
description: >
|
||||
Array.prototype.concat will concat an Array when index property
|
||||
(read-only) exists in Array.prototype (Step 5.c.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
value: 100,
|
||||
writable: false,
|
||||
|
@ -41,11 +38,9 @@ function testcase() {
|
|||
delete newArr[0];
|
||||
verifyConfigurable = newArr.hasOwnProperty("0");
|
||||
|
||||
return hasProperty && instanceOfVerify && verifyValue && !verifyConfigurable && verifyEnumerable && verifyWritable;
|
||||
|
||||
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(hasProperty, 'hasProperty !== true');
|
||||
assert(instanceOfVerify, 'instanceOfVerify !== true');
|
||||
assert(verifyValue, 'verifyValue !== true');
|
||||
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
||||
assert(verifyEnumerable, 'verifyEnumerable !== true');
|
||||
assert(verifyWritable, 'verifyWritable !== true');
|
||||
|
|
|
@ -4,21 +4,13 @@
|
|||
/*---
|
||||
es5id: 15.4.4.16-1-10
|
||||
description: Array.prototype.every applied to the Math object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return ('[object Math]' !== Object.prototype.toString.call(obj));
|
||||
}
|
||||
|
||||
try {
|
||||
Math.length = 1;
|
||||
Math[0] = 1;
|
||||
return !Array.prototype.every.call(Math, callbackfn);
|
||||
} finally {
|
||||
delete Math[0];
|
||||
delete Math.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.every.call(Math, callbackfn), false, 'Array.prototype.every.call(Math, callbackfn)');
|
||||
|
|
|
@ -4,21 +4,13 @@
|
|||
/*---
|
||||
es5id: 15.4.4.16-1-13
|
||||
description: Array.prototype.every applied to the JSON object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return ('[object JSON]' !== Object.prototype.toString.call(obj));
|
||||
}
|
||||
|
||||
try {
|
||||
JSON.length = 1;
|
||||
JSON[0] = 1;
|
||||
return !Array.prototype.every.call(JSON, callbackfn);
|
||||
} finally {
|
||||
delete JSON.length;
|
||||
delete JSON[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.every.call(JSON, callbackfn), false, 'Array.prototype.every.call(JSON, callbackfn)');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.4.4.16-1-3
|
||||
description: Array.prototype.every applied to boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -16,13 +13,8 @@ function testcase() {
|
|||
return obj instanceof Boolean;
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean.prototype[0] = 1;
|
||||
Boolean.prototype.length = 1;
|
||||
return Array.prototype.every.call(false, callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Boolean.prototype[0];
|
||||
delete Boolean.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Array.prototype.every.call(false, callbackfn), 'Array.prototype.every.call(false, callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -4,23 +4,16 @@
|
|||
/*---
|
||||
es5id: 15.4.4.16-1-5
|
||||
description: Array.prototype.every applied to number primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var accessed = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
accessed = true;
|
||||
return obj instanceof Number;
|
||||
}
|
||||
|
||||
try {
|
||||
Number.prototype[0] = 1;
|
||||
Number.prototype.length = 1;
|
||||
return Array.prototype.every.call(2.5, callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Number.prototype[0];
|
||||
delete Number.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Array.prototype.every.call(2.5, callbackfn), 'Array.prototype.every.call(2.5, callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-2-12
|
|||
description: >
|
||||
Array.prototype.every - 'length' is own accessor property without
|
||||
a get function that overrides an inherited accessor property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -17,7 +15,6 @@ function testcase() {
|
|||
return val > 10;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "length", {
|
||||
get: function () {
|
||||
return 2;
|
||||
|
@ -31,10 +28,5 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return Array.prototype.every.call(obj, callbackfn) && !accessed;
|
||||
} finally {
|
||||
delete Object.prototype.length;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
/*---
|
||||
es5id: 15.4.4.16-2-15
|
||||
description: Array.prototype.every - 'length' is property of the global object
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn1(val, idx, obj) {
|
||||
return val > 10;
|
||||
}
|
||||
|
@ -18,19 +15,11 @@ function testcase() {
|
|||
return val > 11;
|
||||
}
|
||||
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[0] = 12;
|
||||
fnGlobalObject()[1] = 11;
|
||||
fnGlobalObject()[2] = 9;
|
||||
fnGlobalObject().length = 2;
|
||||
return Array.prototype.every.call(fnGlobalObject(), callbackfn1) &&
|
||||
!Array.prototype.every.call(fnGlobalObject(), callbackfn2);
|
||||
} finally {
|
||||
delete fnGlobalObject()[0];
|
||||
delete fnGlobalObject()[1];
|
||||
delete fnGlobalObject()[2];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Array.prototype.every.call(fnGlobalObject(), callbackfn1), 'Array.prototype.every.call(fnGlobalObject(), callbackfn1) !== true');
|
||||
assert.sameValue(Array.prototype.every.call(fnGlobalObject(), callbackfn2), false, 'Array.prototype.every.call(fnGlobalObject(), callbackfn2)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-2-18
|
|||
description: >
|
||||
Array.prototype.every applied to String object, which implements
|
||||
its own property get method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn1(val, idx, obj) {
|
||||
return parseInt(val, 10) > 1;
|
||||
}
|
||||
|
@ -19,12 +17,8 @@ function testcase() {
|
|||
}
|
||||
|
||||
var str = new String("432");
|
||||
try {
|
||||
|
||||
String.prototype[3] = "1";
|
||||
return Array.prototype.every.call(str, callbackfn1) &&
|
||||
!Array.prototype.every.call(str, callbackfn2);
|
||||
} finally {
|
||||
delete String.prototype[3];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Array.prototype.every.call(str, callbackfn1), 'Array.prototype.every.call(str, callbackfn1) !== true');
|
||||
assert.sameValue(Array.prototype.every.call(str, callbackfn2), false, 'Array.prototype.every.call(str, callbackfn2)');
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
/*---
|
||||
es5id: 15.4.4.16-2-2
|
||||
description: Array.prototype.every - 'length' is own data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn1(val, idx, obj) {
|
||||
return val > 10;
|
||||
}
|
||||
|
@ -16,13 +14,7 @@ function testcase() {
|
|||
return val > 11;
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[2] = 9;
|
||||
|
||||
return [12, 11].every(callbackfn1) &&
|
||||
![12, 11].every(callbackfn2);
|
||||
} finally {
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert([12, 11].every(callbackfn1), '[12, 11].every(callbackfn1) !== true');
|
||||
assert.sameValue([12, 11].every(callbackfn2), false, '[12, 11].every(callbackfn2)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-2-4
|
|||
description: >
|
||||
Array.prototype.every - 'length' is own data property that
|
||||
overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arrProtoLen = 0;
|
||||
function callbackfn1(val, idx, obj) {
|
||||
return val > 10;
|
||||
|
@ -19,17 +17,9 @@ function testcase() {
|
|||
return val > 11;
|
||||
}
|
||||
|
||||
try {
|
||||
arrProtoLen = Array.prototype.length;
|
||||
Array.prototype.length = 0;
|
||||
Array.prototype[2] = 9;
|
||||
|
||||
return [12, 11].every(callbackfn1) &&
|
||||
![12, 11].every(callbackfn2);
|
||||
} finally {
|
||||
Array.prototype.length = arrProtoLen;
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert([12, 11].every(callbackfn1), '[12, 11].every(callbackfn1) !== true');
|
||||
assert.sameValue([12, 11].every(callbackfn2), false, '[12, 11].every(callbackfn2)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-10
|
|||
description: >
|
||||
Array.prototype.every - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array-like Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var accessed = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
accessed = true;
|
||||
|
@ -25,11 +23,7 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
return Array.prototype.every.call(arr, callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Array.prototype.every.call(arr, callbackfn), 'Array.prototype.every.call(arr, callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-11
|
|||
description: >
|
||||
Array.prototype.every - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var accessed = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
accessed = true;
|
||||
|
@ -25,11 +23,7 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
return arr.every(callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Array.prototype.every - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 1 && val === 1) {
|
||||
return false;
|
||||
|
@ -28,11 +26,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
return !Array.prototype.every.call(arr, callbackfn);
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-13
|
|||
description: >
|
||||
Array.prototype.every - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 1 && val === 1) {
|
||||
return false;
|
||||
|
@ -27,11 +25,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
return !arr.every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-15
|
|||
description: >
|
||||
Array.prototype.every - decreasing length of array with prototype
|
||||
property causes prototype index property to be visited
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 2 && val === "prototype") {
|
||||
return false;
|
||||
|
@ -19,7 +17,6 @@ function testcase() {
|
|||
}
|
||||
var arr = [0, 1, 2];
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "2", {
|
||||
get: function () {
|
||||
return "prototype";
|
||||
|
@ -35,9 +32,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return !arr.every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-6
|
|||
description: >
|
||||
Array.prototype.every - properties can be added to prototype after
|
||||
current position are visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 1 && val === 6.99) {
|
||||
return false;
|
||||
|
@ -32,10 +30,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
return !Array.prototype.every.call(arr, callbackfn);
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-7
|
|||
description: >
|
||||
Array.prototype.every - properties can be added to prototype after
|
||||
current position are visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 1 && val === 6.99) {
|
||||
return false;
|
||||
|
@ -32,10 +30,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
return !arr.every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-c-i-12
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is own accessor
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 0) {
|
||||
return val === 10;
|
||||
|
@ -19,7 +17,7 @@ function testcase() {
|
|||
}
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Array.prototype[0] = 10;
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -29,9 +27,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return !arr.every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-14
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is own accessor
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 0) {
|
||||
return val === 5;
|
||||
|
@ -20,7 +17,7 @@ function testcase() {
|
|||
}
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 5;
|
||||
|
@ -35,9 +32,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return !arr.every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-16
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 0) {
|
||||
return val !== 11;
|
||||
|
@ -19,7 +16,6 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 11;
|
||||
|
@ -27,9 +23,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return ![, , , ].every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue([, , , ].every(callbackfn), false, '[, , , ].every(callbackfn)');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.every - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -24,11 +21,8 @@ function testcase() {
|
|||
set: function () { },
|
||||
configurable: true
|
||||
});
|
||||
try {
|
||||
|
||||
Object.prototype[1] = 10;
|
||||
return Array.prototype.every.call(obj, callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.every - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -26,11 +23,7 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[0] = 100;
|
||||
return arr.every(callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-22
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is inherited
|
||||
accessor property without a get function on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -18,16 +15,10 @@ function testcase() {
|
|||
return typeof val === "undefined";
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
set: function () { },
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return [, ].every(callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert([, ].every(callbackfn), '[, ].every(callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -6,13 +6,9 @@ es5id: 15.4.4.16-7-c-i-23
|
|||
description: >
|
||||
Array.prototype.every - This object is an global object which
|
||||
contains index property
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 0) {
|
||||
return val !== 11;
|
||||
|
@ -21,14 +17,8 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[0] = 11;
|
||||
fnGlobalObject().length = 1;
|
||||
return !Array.prototype.every.call(fnGlobalObject(), callbackfn);
|
||||
} finally {
|
||||
delete fnGlobalObject()[0];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.every.call(fnGlobalObject(), callbackfn), false, 'Array.prototype.every.call(fnGlobalObject(), callbackfn)');
|
||||
|
|
|
@ -6,24 +6,16 @@ es5id: 15.4.4.16-7-c-i-4
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is own data
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var called = 0;
|
||||
function callbackfn(val, idx, obj) {
|
||||
called++;
|
||||
return val === 12;
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[0] = 11;
|
||||
Array.prototype[1] = 11;
|
||||
|
||||
return [12, 12].every(callbackfn) && called === 2;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert([12, 12].every(callbackfn), '[12, 12].every(callbackfn) !== true');
|
||||
assert.sameValue(called, 2, 'called');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-6
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is own data
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -18,16 +15,12 @@ function testcase() {
|
|||
return val === 11;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 9;
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
return [11].every(callbackfn) && accessed;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert([11].every(callbackfn), '[11].every(callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-8
|
|||
description: >
|
||||
Array.prototype.every - element to be retrieved is inherited data
|
||||
property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
if (idx === 1) {
|
||||
return val !== 13;
|
||||
|
@ -19,11 +16,6 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 13;
|
||||
return ![, , , ].every(callbackfn);
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue([, , , ].every(callbackfn), false, '[, , , ].every(callbackfn)');
|
||||
|
|
|
@ -4,22 +4,14 @@
|
|||
/*---
|
||||
es5id: 15.4.4.20-1-10
|
||||
description: Array.prototype.filter applied to the Math object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return '[object Math]' === Object.prototype.toString.call(obj);
|
||||
}
|
||||
|
||||
try {
|
||||
Math.length = 1;
|
||||
Math[0] = 1;
|
||||
var newArr = Array.prototype.filter.call(Math, callbackfn);
|
||||
return newArr[0] === 1;
|
||||
} finally {
|
||||
delete Math[0];
|
||||
delete Math.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr[0], 1, 'newArr[0]');
|
||||
|
|
|
@ -4,23 +4,14 @@
|
|||
/*---
|
||||
es5id: 15.4.4.20-1-13
|
||||
description: Array.prototype.filter applied to the JSON object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return '[object JSON]' === Object.prototype.toString.call(JSON);
|
||||
}
|
||||
|
||||
try {
|
||||
JSON.length = 1;
|
||||
JSON[0] = 1;
|
||||
var newArr = Array.prototype.filter.call(JSON, callbackfn);
|
||||
return newArr[0] === 1;
|
||||
} finally {
|
||||
delete JSON.length;
|
||||
delete JSON[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr[0], 1, 'newArr[0]');
|
||||
|
|
|
@ -4,24 +4,15 @@
|
|||
/*---
|
||||
es5id: 15.4.4.20-1-3
|
||||
description: Array.prototype.filter applied to boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return obj instanceof Boolean;
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean.prototype[0] = true;
|
||||
Boolean.prototype.length = 1;
|
||||
|
||||
var newArr = Array.prototype.filter.call(false, callbackfn);
|
||||
return newArr[0] === true;
|
||||
|
||||
} finally {
|
||||
delete Boolean.prototype[0];
|
||||
delete Boolean.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr[0], true, 'newArr[0]');
|
||||
|
|
|
@ -4,23 +4,15 @@
|
|||
/*---
|
||||
es5id: 15.4.4.20-1-5
|
||||
description: Array.prototype.filter applied to number primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return obj instanceof Number;
|
||||
}
|
||||
|
||||
try {
|
||||
Number.prototype[0] = 1;
|
||||
Number.prototype.length = 1;
|
||||
|
||||
var newArr = Array.prototype.filter.call(2.5, callbackfn);
|
||||
return newArr[0] === 1;
|
||||
} finally {
|
||||
delete Number.prototype[0];
|
||||
delete Number.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr[0], 1, 'newArr[0]');
|
||||
|
|
|
@ -6,18 +6,14 @@ es5id: 15.4.4.20-2-12
|
|||
description: >
|
||||
Array.prototype.filter - 'length' is own accessor property without
|
||||
a get function that overrides an inherited accessor property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
accessed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "length", {
|
||||
get: function () {
|
||||
return 2;
|
||||
|
@ -32,9 +28,6 @@ function testcase() {
|
|||
});
|
||||
|
||||
var newArr = Array.prototype.filter.call(obj, callbackfn);
|
||||
return newArr.length === 0 && !accessed;
|
||||
} finally {
|
||||
delete Object.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr.length, 0, 'newArr.length');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
|
|
@ -4,30 +4,18 @@
|
|||
/*---
|
||||
es5id: 15.4.4.20-2-15
|
||||
description: Array.prototype.filter - 'length' is property of the global object
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return obj.length === 2;
|
||||
}
|
||||
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[0] = 12;
|
||||
fnGlobalObject()[1] = 11;
|
||||
fnGlobalObject()[2] = 9;
|
||||
fnGlobalObject().length = 2;
|
||||
var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);
|
||||
return newArr.length === 2;
|
||||
} finally {
|
||||
delete fnGlobalObject()[0];
|
||||
delete fnGlobalObject()[1];
|
||||
delete fnGlobalObject()[2];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr.length, 2, 'newArr.length');
|
||||
|
|
|
@ -6,24 +6,16 @@ es5id: 15.4.4.20-2-4
|
|||
description: >
|
||||
Array.prototype.filter - 'length' is own data property that
|
||||
overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arrProtoLen;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return obj.length === 2;
|
||||
}
|
||||
|
||||
try {
|
||||
arrProtoLen = Array.prototype.length;
|
||||
Array.prototype.length = 0;
|
||||
var newArr = [12, 11].filter(callbackfn);
|
||||
return newArr.length === 2;
|
||||
} finally {
|
||||
Array.prototype.length = arrProtoLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr.length, 2, 'newArr.length');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-10
|
|||
description: >
|
||||
Array.prototype.filter - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array-like Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return true;
|
||||
}
|
||||
|
@ -24,13 +21,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
var newArr = Array.prototype.filter.call(obj, callbackfn);
|
||||
|
||||
return newArr.length === 2 && newArr[1] !== 1;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 2, 'newArr.length');
|
||||
assert.notSameValue(newArr[1], 1, 'newArr[1]');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-11
|
|||
description: >
|
||||
Array.prototype.filter - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return true;
|
||||
}
|
||||
|
@ -24,12 +21,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
var newArr = arr.filter(callbackfn);
|
||||
return newArr.length === 2 && newArr[1] !== 1;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr.length, 2, 'newArr.length');
|
||||
assert.notSameValue(newArr[1], 1, 'newArr[1]');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Array.prototype.filter - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return true;
|
||||
}
|
||||
|
@ -24,13 +22,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
var newArr = Array.prototype.filter.call(obj, callbackfn);
|
||||
|
||||
return newArr.length === 3 && newArr[1] === 1;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 3, 'newArr.length');
|
||||
assert.sameValue(newArr[1], 1, 'newArr[1]');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 15.4.4.20-9-b-13
|
|||
description: >
|
||||
Array.prototype.filter - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return val < 3 ? true : false;
|
||||
}
|
||||
|
@ -23,13 +21,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
var newArr = arr.filter(callbackfn);
|
||||
|
||||
return newArr.length === 3 && newArr[1] === 1;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 3, 'newArr.length');
|
||||
assert.sameValue(newArr[1], 1, 'newArr[1]');
|
||||
|
|
|
@ -6,16 +6,13 @@ es5id: 15.4.4.20-9-b-15
|
|||
description: >
|
||||
Array.prototype.filter - decreasing length of array with prototype
|
||||
property causes prototype index property to be visited
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return true;
|
||||
}
|
||||
var arr = [0, 1, 2];
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "2", {
|
||||
get: function () {
|
||||
return "prototype";
|
||||
|
@ -33,9 +30,5 @@ function testcase() {
|
|||
|
||||
var newArr = arr.filter(callbackfn);
|
||||
|
||||
return newArr.length === 3 && newArr[2] === "prototype";
|
||||
} finally {
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 3, 'newArr.length');
|
||||
assert.sameValue(newArr[2], "prototype", 'newArr[2]');
|
||||
|
|
|
@ -6,16 +6,13 @@ es5id: 15.4.4.20-9-b-6
|
|||
description: >
|
||||
Array.prototype.filter - properties can be added to prototype
|
||||
after current position are visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return true;
|
||||
}
|
||||
var obj = { length: 2 };
|
||||
|
||||
try {
|
||||
Object.defineProperty(obj, "0", {
|
||||
get: function () {
|
||||
Object.defineProperty(Object.prototype, "1", {
|
||||
|
@ -31,9 +28,5 @@ function testcase() {
|
|||
|
||||
var newArr = Array.prototype.filter.call(obj, callbackfn);
|
||||
|
||||
return newArr.length === 2 && Array[1] === 6.99;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 2, 'newArr.length');
|
||||
assert.sameValue(Array[1], 6.99, 'Array[1]');
|
||||
|
|
|
@ -6,16 +6,13 @@ es5id: 15.4.4.20-9-b-7
|
|||
description: >
|
||||
Array.prototype.filter - properties can be added to prototype
|
||||
after current position are visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return true;
|
||||
}
|
||||
var arr = [0, , 2];
|
||||
|
||||
try {
|
||||
Object.defineProperty(arr, "0", {
|
||||
get: function () {
|
||||
Object.defineProperty(Array.prototype, "1", {
|
||||
|
@ -31,9 +28,5 @@ function testcase() {
|
|||
|
||||
var newArr = arr.filter(callbackfn);
|
||||
|
||||
return newArr.length === 3 && newArr[1] === 6.99;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 3, 'newArr.length');
|
||||
assert.sameValue(newArr[1], 6.99, 'newArr[1]');
|
||||
|
|
|
@ -6,16 +6,14 @@ es5id: 15.4.4.20-9-c-i-12
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is own accessor
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(val, idx, obj) {
|
||||
return val === 111 && idx === 0;
|
||||
}
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Array.prototype[0] = 10;
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -26,9 +24,5 @@ function testcase() {
|
|||
});
|
||||
var newArr = arr.filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === 111;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 111, 'newArr[0]');
|
||||
|
|
|
@ -6,17 +6,14 @@ es5id: 15.4.4.20-9-c-i-14
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is own accessor
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return idx === 0 && val === 11;
|
||||
}
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 5;
|
||||
|
@ -32,9 +29,5 @@ function testcase() {
|
|||
});
|
||||
var newArr = arr.filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === 11;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 11, 'newArr[0]');
|
||||
|
|
|
@ -6,16 +6,12 @@ es5id: 15.4.4.20-9-c-i-16
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return idx === 0 && val === 11;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 11;
|
||||
|
@ -24,9 +20,5 @@ function testcase() {
|
|||
});
|
||||
var newArr = [, , , ].filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === 11;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 11, 'newArr[0]');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.filter - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return undefined === val && idx === 1;
|
||||
}
|
||||
|
@ -21,13 +18,9 @@ function testcase() {
|
|||
set: function () { },
|
||||
configurable: true
|
||||
});
|
||||
try {
|
||||
|
||||
Object.prototype[1] = 10;
|
||||
var newArr = Array.prototype.filter.call(obj, callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === undefined;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], undefined, 'newArr[0]');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.filter - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return undefined === val && idx === 0;
|
||||
}
|
||||
|
@ -23,13 +20,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[0] = 100;
|
||||
var newArr = arr.filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === undefined;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], undefined, 'newArr[0]');
|
||||
|
|
|
@ -6,25 +6,17 @@ es5id: 15.4.4.20-9-c-i-22
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is inherited
|
||||
accessor property without a get function on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return undefined === val && idx === 0;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
set: function () { },
|
||||
configurable: true
|
||||
});
|
||||
var newArr = [, ].filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === undefined;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], undefined, 'newArr[0]');
|
||||
|
|
|
@ -6,26 +6,17 @@ es5id: 15.4.4.20-9-c-i-23
|
|||
description: >
|
||||
Array.prototype.filter - This object is the global object which
|
||||
contains index property
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return idx === 0 && val === 11;
|
||||
}
|
||||
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[0] = 11;
|
||||
fnGlobalObject().length = 1;
|
||||
var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);
|
||||
return newArr.length === 1 && newArr[0] === 11;
|
||||
} finally {
|
||||
delete fnGlobalObject()[0];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 11, 'newArr[0]');
|
||||
|
|
|
@ -6,22 +6,14 @@ es5id: 15.4.4.20-9-c-i-4
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is own data
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return (idx === 0) && (val === 12);
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[0] = 11;
|
||||
var newArr = [12].filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === 12;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 12, 'newArr[0]');
|
||||
|
|
|
@ -6,16 +6,12 @@ es5id: 15.4.4.20-9-c-i-6
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is own data
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return val === 11;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 9;
|
||||
|
@ -24,9 +20,5 @@ function testcase() {
|
|||
});
|
||||
var newArr = [11].filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === 11;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 11, 'newArr[0]');
|
||||
|
|
|
@ -6,22 +6,14 @@ es5id: 15.4.4.20-9-c-i-8
|
|||
description: >
|
||||
Array.prototype.filter - element to be retrieved is inherited data
|
||||
property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
return (idx === 1) && (val === 13);
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 13;
|
||||
var newArr = [, , , ].filter(callbackfn);
|
||||
|
||||
return newArr.length === 1 && newArr[0] === 13;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
||||
assert.sameValue(newArr[0], 13, 'newArr[0]');
|
||||
|
|
|
@ -4,24 +4,16 @@
|
|||
/*---
|
||||
es5id: 15.4.4.18-1-10
|
||||
description: Array.prototype.forEach applied to the Math object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var result = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
result = ('[object Math]' === Object.prototype.toString.call(obj));
|
||||
}
|
||||
|
||||
try {
|
||||
Math.length = 1;
|
||||
Math[0] = 1;
|
||||
Array.prototype.forEach.call(Math, callbackfn);
|
||||
return result;
|
||||
} finally {
|
||||
delete Math[0];
|
||||
delete Math.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(result, 'result !== true');
|
||||
|
|
|
@ -4,23 +4,15 @@
|
|||
/*---
|
||||
es5id: 15.4.4.18-1-13
|
||||
description: Array.prototype.forEach applied to the JSON object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var result = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
result = ('[object JSON]' === Object.prototype.toString.call(obj));
|
||||
}
|
||||
|
||||
try {
|
||||
JSON.length = 1;
|
||||
JSON[0] = 1;
|
||||
Array.prototype.forEach.call(JSON, callbackfn);
|
||||
return result;
|
||||
} finally {
|
||||
delete JSON.length;
|
||||
delete JSON[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(result, 'result !== true');
|
||||
|
|
|
@ -4,26 +4,17 @@
|
|||
/*---
|
||||
es5id: 15.4.4.18-1-3
|
||||
description: Array.prototype.forEach applied to boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var result = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
result = obj instanceof Boolean;
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean.prototype[0] = true;
|
||||
Boolean.prototype.length = 1;
|
||||
|
||||
Array.prototype.forEach.call(false, callbackfn);
|
||||
return result;
|
||||
|
||||
} finally {
|
||||
delete Boolean.prototype[0];
|
||||
delete Boolean.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(result, 'result !== true');
|
||||
|
|
|
@ -4,24 +4,16 @@
|
|||
/*---
|
||||
es5id: 15.4.4.18-1-5
|
||||
description: Array.prototype.forEach applied to number primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var result = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
result = obj instanceof Number;
|
||||
}
|
||||
|
||||
try {
|
||||
Number.prototype[0] = 1;
|
||||
Number.prototype.length = 1;
|
||||
|
||||
Array.prototype.forEach.call(2.5, callbackfn);
|
||||
return result;
|
||||
} finally {
|
||||
delete Number.prototype[0];
|
||||
delete Number.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(result, 'result !== true');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Array.prototype.forEach - 'length' is own accessor property
|
||||
without a get function that overrides an inherited accessor
|
||||
property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var accessed = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
accessed = true;
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "length", {
|
||||
get: function () {
|
||||
return 2;
|
||||
|
@ -31,10 +28,5 @@ function testcase() {
|
|||
});
|
||||
|
||||
Array.prototype.forEach.call(obj, callbackfn);
|
||||
return !accessed;
|
||||
} finally {
|
||||
delete Object.prototype.length;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
|
|
@ -4,30 +4,19 @@
|
|||
/*---
|
||||
es5id: 15.4.4.18-2-15
|
||||
description: Array.prototype.forEach - 'length' is property of the global object
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var result = false;
|
||||
function callbackfn(val, idx, obj) {
|
||||
result = (obj.length === 2);
|
||||
}
|
||||
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[0] = 12;
|
||||
fnGlobalObject()[1] = 11;
|
||||
fnGlobalObject()[2] = 9;
|
||||
fnGlobalObject().length = 2;
|
||||
Array.prototype.forEach.call(fnGlobalObject(), callbackfn);
|
||||
return result;
|
||||
} finally {
|
||||
delete fnGlobalObject()[0];
|
||||
delete fnGlobalObject()[1];
|
||||
delete fnGlobalObject()[2];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(result, 'result !== true');
|
||||
|
|
|
@ -6,24 +6,16 @@ es5id: 15.4.4.18-2-4
|
|||
description: >
|
||||
Array.prototype.forEach - 'length' is own data property that
|
||||
overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var result = false;
|
||||
var arrProtoLen;
|
||||
function callbackfn(val, idx, obj) {
|
||||
result = (obj.length === 2);
|
||||
}
|
||||
|
||||
try {
|
||||
arrProtoLen = Array.prototype.length;
|
||||
Array.prototype.length = 0;
|
||||
[12, 11].forEach(callbackfn);
|
||||
return result;
|
||||
} finally {
|
||||
Array.prototype.length = arrProtoLen;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(result, 'result !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-10
|
|||
description: >
|
||||
Array.prototype.forEach - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array-like Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
|
@ -31,12 +28,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
Array.prototype.forEach.call(obj, callbackfn);
|
||||
return testResult && accessed;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-11
|
|||
description: >
|
||||
Array.prototype.forEach - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
|
@ -31,12 +28,8 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
arr.forEach(callbackfn);
|
||||
return testResult && accessed;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.forEach - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -30,12 +27,7 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
Array.prototype.forEach.call(obj, callbackfn);
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-13
|
|||
description: >
|
||||
Array.prototype.forEach - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -28,12 +25,7 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
arr.forEach(callbackfn);
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-15
|
|||
description: >
|
||||
Array.prototype.forEach - decreasing length of array with
|
||||
prototype property causes prototype index property to be visited
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -20,7 +17,6 @@ function testcase() {
|
|||
}
|
||||
var arr = [0, 1, 2];
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "2", {
|
||||
get: function () {
|
||||
return "prototype";
|
||||
|
@ -38,9 +34,4 @@ function testcase() {
|
|||
|
||||
arr.forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-6
|
|||
description: >
|
||||
Array.prototype.forEach - properties can be added to prototype
|
||||
after current position are visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -34,11 +31,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype.forEach.call(obj, callbackfn);
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-7
|
|||
description: >
|
||||
Array.prototype.forEach - properties can be added to prototype
|
||||
after current position are visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -34,11 +31,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
arr.forEach(callbackfn);
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-12
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is own accessor
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -20,7 +17,7 @@ function testcase() {
|
|||
}
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Array.prototype[0] = 10;
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -32,9 +29,4 @@ function testcase() {
|
|||
|
||||
arr.forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-14
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is own accessor
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -20,7 +17,7 @@ function testcase() {
|
|||
}
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 5;
|
||||
|
@ -37,9 +34,4 @@ function testcase() {
|
|||
|
||||
arr.forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-16
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -19,7 +16,6 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 11;
|
||||
|
@ -29,9 +25,4 @@ function testcase() {
|
|||
|
||||
[, , , ].forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.forEach - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -27,7 +24,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "1", {
|
||||
get: function () {
|
||||
return 10;
|
||||
|
@ -37,9 +33,4 @@ function testcase() {
|
|||
|
||||
Array.prototype.forEach.call(obj, callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.forEach - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -27,7 +24,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 100;
|
||||
|
@ -37,9 +33,4 @@ function testcase() {
|
|||
|
||||
arr.forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-22
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is inherited
|
||||
accessor property without a get function on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -19,7 +16,6 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
set: function () { },
|
||||
configurable: true
|
||||
|
@ -27,10 +23,4 @@ function testcase() {
|
|||
|
||||
[, 1].forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,13 +6,9 @@ es5id: 15.4.4.18-7-c-i-23
|
|||
description: >
|
||||
Array.prototype.forEach - This object is an global object which
|
||||
contains index property
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -21,17 +17,10 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[0] = 11;
|
||||
fnGlobalObject().length = 1;
|
||||
|
||||
Array.prototype.forEach.call(fnGlobalObject(), callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete fnGlobalObject()[0];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-4
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is own data
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -19,14 +16,8 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[0] = 11;
|
||||
|
||||
[12].forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-6
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is own data
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -19,7 +16,6 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 9;
|
||||
|
@ -29,9 +25,4 @@ function testcase() {
|
|||
|
||||
[11].forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-8
|
|||
description: >
|
||||
Array.prototype.forEach - element to be retrieved is inherited
|
||||
data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(val, idx, obj) {
|
||||
|
@ -19,14 +16,8 @@ function testcase() {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 13;
|
||||
|
||||
[, , , ].forEach(callbackfn);
|
||||
|
||||
return testResult;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
|
|
@ -4,17 +4,9 @@
|
|||
/*---
|
||||
es5id: 15.4.4.14-1-10
|
||||
description: Array.prototype.indexOf applied to the Math object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
Math[1] = true;
|
||||
Math.length = 2;
|
||||
return Array.prototype.indexOf.call(Math, true) === 1;
|
||||
} finally {
|
||||
delete Math[1];
|
||||
delete Math.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.call(Math, true), 1, 'Array.prototype.indexOf.call(Math, true)');
|
||||
|
|
|
@ -4,18 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.4.4.14-1-13
|
||||
description: Array.prototype.indexOf applied to the JSON object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var targetObj = {};
|
||||
try {
|
||||
|
||||
JSON[3] = targetObj;
|
||||
JSON.length = 5;
|
||||
return Array.prototype.indexOf.call(JSON, targetObj) === 3;
|
||||
} finally {
|
||||
delete JSON[3];
|
||||
delete JSON.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.call(JSON, targetObj), 3, 'Array.prototype.indexOf.call(JSON, targetObj)');
|
||||
|
|
|
@ -4,20 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.4.4.14-1-17
|
||||
description: Array.prototype.indexOf applied to the global object
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
var oldLen = fnGlobalObject().length;
|
||||
fnGlobalObject()[1] = true;
|
||||
fnGlobalObject().length = 2;
|
||||
return Array.prototype.indexOf.call(fnGlobalObject(), true) === 1;
|
||||
} finally {
|
||||
delete fnGlobalObject()[1];
|
||||
fnGlobalObject().length = oldLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), true), 1, 'Array.prototype.indexOf.call(fnGlobalObject(), true)');
|
||||
|
|
|
@ -4,19 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.4.4.14-1-3
|
||||
description: Array.prototype.indexOf applied to boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var targetObj = {};
|
||||
try {
|
||||
|
||||
Boolean.prototype[1] = targetObj;
|
||||
Boolean.prototype.length = 2;
|
||||
|
||||
return Array.prototype.indexOf.call(true, targetObj) === 1;
|
||||
} finally {
|
||||
delete Boolean.prototype[1];
|
||||
delete Boolean.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call(true, targetObj), 1, 'Array.prototype.indexOf.call(true, targetObj)');
|
||||
|
|
|
@ -4,19 +4,11 @@
|
|||
/*---
|
||||
es5id: 15.4.4.14-1-5
|
||||
description: Array.prototype.indexOf applied to number primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var targetObj = {};
|
||||
try {
|
||||
|
||||
Number.prototype[1] = targetObj;
|
||||
Number.prototype.length = 2;
|
||||
|
||||
return Array.prototype.indexOf.call(5, targetObj) === 1;
|
||||
} finally {
|
||||
delete Number.prototype[1];
|
||||
delete Number.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call(5, targetObj), 1, 'Array.prototype.indexOf.call(5, targetObj)');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.indexOf - 'length' is own accessor property
|
||||
without a get function that overrides an inherited accessor
|
||||
property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "length", {
|
||||
get: function () {
|
||||
return 20;
|
||||
|
@ -25,9 +22,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return Array.prototype.indexOf.call(obj, 1) === -1;
|
||||
} finally {
|
||||
delete Object.prototype.length;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call(obj, 1), -1, 'Array.prototype.indexOf.call(obj, 1)');
|
||||
|
|
|
@ -6,17 +6,11 @@ es5id: 15.4.4.14-2-18
|
|||
description: >
|
||||
Array.prototype.indexOf applied to String object, which implements
|
||||
its own property get method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var str = new String("012");
|
||||
try {
|
||||
|
||||
String.prototype[3] = "3";
|
||||
return Array.prototype.indexOf.call(str, "2") === 2 &&
|
||||
Array.prototype.indexOf.call(str, "3") === -1;
|
||||
} finally {
|
||||
delete String.prototype[3];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.call(str, "2"), 2, 'Array.prototype.indexOf.call(str, "2")');
|
||||
assert.sameValue(Array.prototype.indexOf.call(str, "3"), -1, 'Array.prototype.indexOf.call(str, "3")');
|
||||
|
|
|
@ -4,19 +4,12 @@
|
|||
/*---
|
||||
es5id: 15.4.4.14-2-2
|
||||
description: Array.prototype.indexOf - 'length' is own data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var targetObj = {};
|
||||
try {
|
||||
|
||||
Array.prototype[2] = targetObj;
|
||||
|
||||
return [0, targetObj].indexOf(targetObj) === 1 &&
|
||||
[0, 1].indexOf(targetObj) === -1;
|
||||
|
||||
} finally {
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue([0, targetObj].indexOf(targetObj), 1, '[0, targetObj].indexOf(targetObj)');
|
||||
assert.sameValue([0, 1].indexOf(targetObj), -1, '[0, 1].indexOf(targetObj)');
|
||||
|
|
|
@ -6,23 +6,12 @@ es5id: 15.4.4.14-2-4
|
|||
description: >
|
||||
Array.prototype.indexOf - 'length' is own data property that
|
||||
overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var targetObj = {};
|
||||
var arrProtoLen;
|
||||
|
||||
try {
|
||||
arrProtoLen = Array.prototype.length;
|
||||
Array.prototype.length = 0;
|
||||
|
||||
return [0, targetObj].indexOf(targetObj) === 1;
|
||||
|
||||
} finally {
|
||||
|
||||
Array.prototype.length = arrProtoLen;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue([0, targetObj].indexOf(targetObj), 1, '[0, targetObj].indexOf(targetObj)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-10
|
|||
description: >
|
||||
Array.prototype.indexOf - properties can be added to prototype
|
||||
after current position are visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, , 2];
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -26,10 +23,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
return arr.indexOf(6.99) === 1;
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.indexOf(6.99), 1, 'arr.indexOf(6.99)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-13
|
|||
description: >
|
||||
Array.prototype.indexOf - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array-like Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = { 2: 2, length: 20 };
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -21,11 +18,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
return -1 === Array.prototype.indexOf.call(arr, 1);
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.call(arr, 1), -1, 'Array.prototype.indexOf.call(arr, 1)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-14
|
|||
description: >
|
||||
Array.prototype.indexOf - deleting property of prototype causes
|
||||
prototype index property not to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, , 2];
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -21,11 +18,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
return -1 === arr.indexOf(1);
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(arr.indexOf(1), -1, 'arr.indexOf(1)');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.indexOf - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = { 0: 0, 1: 111, 2: 2, length: 10 };
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -22,11 +19,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.prototype[1] = 1;
|
||||
return 1 === Array.prototype.indexOf.call(arr, 1);
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.call(arr, 1), 1, 'Array.prototype.indexOf.call(arr, 1)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-16
|
|||
description: >
|
||||
Array.prototype.indexOf - deleting own property with prototype
|
||||
property causes prototype index property to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 111, 2];
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -21,11 +18,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Array.prototype[1] = 1;
|
||||
return 1 === arr.indexOf(1);
|
||||
} finally {
|
||||
delete Array.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(arr.indexOf(1), 1, 'arr.indexOf(1)');
|
||||
|
|
|
@ -6,14 +6,10 @@ es5id: 15.4.4.14-9-a-18
|
|||
description: >
|
||||
Array.prototype.indexOf - decreasing length of array with
|
||||
prototype property causes prototype index property to be visited
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1, 2];
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "2", {
|
||||
get: function () {
|
||||
return "prototype";
|
||||
|
@ -29,9 +25,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 2 === arr.indexOf("prototype");
|
||||
} finally {
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.indexOf("prototype"), 2, 'arr.indexOf("prototype")');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-9
|
|||
description: >
|
||||
Array.prototype.indexOf - properties can be added to prototype
|
||||
after current position are visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = { length: 2 };
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -26,10 +23,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
return Array.prototype.indexOf.call(arr, 6.99) === 1;
|
||||
} finally {
|
||||
delete Object.prototype[1];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call(arr, 6.99), 1, 'Array.prototype.indexOf.call(arr, 6.99)');
|
||||
|
|
|
@ -6,13 +6,10 @@ es5id: 15.4.4.14-9-b-i-11
|
|||
description: >
|
||||
Array.prototype.indexOf - element to be retrieved is own accessor
|
||||
property that overrides an inherited data property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Array.prototype[0] = false;
|
||||
Object.defineProperty(arr, "0", {
|
||||
get: function () {
|
||||
|
@ -21,9 +18,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 0 === arr.indexOf(true);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.indexOf(true), 0, 'arr.indexOf(true)');
|
||||
|
|
|
@ -7,13 +7,10 @@ description: >
|
|||
Array.prototype.indexOf - element to be retrieved is own accessor
|
||||
property that overrides an inherited data property on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = { length: 1 };
|
||||
|
||||
try {
|
||||
Object.prototype[0] = false;
|
||||
Object.defineProperty(obj, "0", {
|
||||
get: function () {
|
||||
|
@ -22,9 +19,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 0 === Array.prototype.indexOf.call(obj, true);
|
||||
} finally {
|
||||
delete Object.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call(obj, true), 0, 'Array.prototype.indexOf.call(obj, true)');
|
||||
|
|
|
@ -6,13 +6,10 @@ es5id: 15.4.4.14-9-b-i-13
|
|||
description: >
|
||||
Array.prototype.indexOf - element to be retrieved is own accessor
|
||||
property that overrides an inherited accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return false;
|
||||
|
@ -27,9 +24,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 0 === arr.indexOf(true);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.indexOf(true), 0, 'arr.indexOf(true)');
|
||||
|
|
|
@ -7,14 +7,10 @@ description: >
|
|||
Array.prototype.indexOf - element to be retrieved is own accessor
|
||||
property that overrides an inherited accessor property on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = { length: 1 };
|
||||
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "0", {
|
||||
get: function () {
|
||||
return false;
|
||||
|
@ -29,9 +25,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 0 === Array.prototype.indexOf.call(obj, true);
|
||||
} finally {
|
||||
delete Object.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call(obj, true), 0, 'Array.prototype.indexOf.call(obj, true)');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-b-i-15
|
|||
description: >
|
||||
Array.prototype.indexOf - element to be retrieved is inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 10;
|
||||
|
@ -32,13 +29,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 0 === [, , , ].indexOf(10) &&
|
||||
1 === [, , , ].indexOf(20) &&
|
||||
2 === [, , , ].indexOf(30);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
delete Array.prototype[1];
|
||||
delete Array.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue([, , , ].indexOf(10), 0, '[, , , ].indexOf(10)');
|
||||
assert.sameValue([, , , ].indexOf(20), 1, '[, , , ].indexOf(20)');
|
||||
assert.sameValue([, , , ].indexOf(30), 2, '[, , , ].indexOf(30)');
|
||||
|
|
|
@ -6,12 +6,8 @@ es5id: 15.4.4.14-9-b-i-16
|
|||
description: >
|
||||
Array.prototype.indexOf - element to be retrieved is inherited
|
||||
accessor property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
Object.defineProperty(Object.prototype, "0", {
|
||||
get: function () {
|
||||
return 10;
|
||||
|
@ -33,13 +29,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return 0 === Array.prototype.indexOf.call({ length: 3 }, 10) &&
|
||||
1 === Array.prototype.indexOf.call({ length: 3 }, 20) &&
|
||||
2 === Array.prototype.indexOf.call({ length: 3 }, 30);
|
||||
} finally {
|
||||
delete Object.prototype[0];
|
||||
delete Object.prototype[1];
|
||||
delete Object.prototype[2];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.indexOf.call({ length: 3 }, 10), 0, 'Array.prototype.indexOf.call({ length: 3 }, 10)');
|
||||
assert.sameValue(Array.prototype.indexOf.call({ length: 3 }, 20), 1, 'Array.prototype.indexOf.call({ length: 3 }, 20)');
|
||||
assert.sameValue(Array.prototype.indexOf.call({ length: 3 }, 30), 2, 'Array.prototype.indexOf.call({ length: 3 }, 30)');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Array.prototype.indexOf - element to be retrieved is own accessor
|
||||
property without a get function that overrides an inherited
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
|
@ -19,7 +16,6 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
get: function () {
|
||||
return 2;
|
||||
|
@ -27,9 +23,4 @@ function testcase() {
|
|||
configurable: true
|
||||
});
|
||||
|
||||
return arr.indexOf(undefined) === 0;
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.indexOf(undefined), 0, 'arr.indexOf(undefined)');
|
||||
|
|
|
@ -6,18 +6,11 @@ es5id: 15.4.4.14-9-b-i-21
|
|||
description: >
|
||||
Array.prototype.indexOf - element to be retrieved is inherited
|
||||
accessor property without a get function on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
set: function () { },
|
||||
configurable: true
|
||||
});
|
||||
return 0 === [, ].indexOf(undefined);
|
||||
} finally {
|
||||
delete Array.prototype[0];
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue([, ].indexOf(undefined), 0, '[, ].indexOf(undefined)');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue