Merge pull request #415 from anba/remove-runTestCase-finally

Replace runTestCase when used with try-finally
This commit is contained in:
Rick Waldron 2015-09-04 15:20:26 -04:00
commit 9ccc663936
521 changed files with 1267 additions and 5328 deletions

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.4-5-b-iii-3-b-1
description: > description: >
Array.prototype.concat will concat an Array when index property Array.prototype.concat will concat an Array when index property
(read-only) exists in Array.prototype (Step 5.b.iii.3.b) (read-only) exists in Array.prototype (Step 5.b.iii.3.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 100, value: 100,
writable: false, writable: false,
@ -39,9 +36,7 @@ function testcase() {
delete newArr[0]; delete newArr[0];
verifyConfigurable = newArr.hasOwnProperty("0"); verifyConfigurable = newArr.hasOwnProperty("0");
return verifyValue && !verifyConfigurable && verifyEnumerable && verifyWritable; assert(verifyValue, 'verifyValue !== true');
} finally { assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
delete Array.prototype[0]; assert(verifyEnumerable, 'verifyEnumerable !== true');
} assert(verifyWritable, 'verifyWritable !== true');
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.4-5-c-i-1
description: > description: >
Array.prototype.concat will concat an Array when index property Array.prototype.concat will concat an Array when index property
(read-only) exists in Array.prototype (Step 5.c.i) (read-only) exists in Array.prototype (Step 5.c.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 100, value: 100,
writable: false, writable: false,
@ -41,11 +38,9 @@ function testcase() {
delete newArr[0]; delete newArr[0];
verifyConfigurable = newArr.hasOwnProperty("0"); verifyConfigurable = newArr.hasOwnProperty("0");
return hasProperty && instanceOfVerify && verifyValue && !verifyConfigurable && verifyEnumerable && verifyWritable; assert(hasProperty, 'hasProperty !== true');
assert(instanceOfVerify, 'instanceOfVerify !== true');
assert(verifyValue, 'verifyValue !== true');
} finally { assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
delete Array.prototype[0]; assert(verifyEnumerable, 'verifyEnumerable !== true');
} assert(verifyWritable, 'verifyWritable !== true');
}
runTestCase(testcase);

View File

@ -4,21 +4,13 @@
/*--- /*---
es5id: 15.4.4.16-1-10 es5id: 15.4.4.16-1-10
description: Array.prototype.every applied to the Math object description: Array.prototype.every applied to the Math object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return ('[object Math]' !== Object.prototype.toString.call(obj)); return ('[object Math]' !== Object.prototype.toString.call(obj));
} }
try {
Math.length = 1; Math.length = 1;
Math[0] = 1; Math[0] = 1;
return !Array.prototype.every.call(Math, callbackfn);
} finally { assert.sameValue(Array.prototype.every.call(Math, callbackfn), false, 'Array.prototype.every.call(Math, callbackfn)');
delete Math[0];
delete Math.length;
}
}
runTestCase(testcase);

View File

@ -4,21 +4,13 @@
/*--- /*---
es5id: 15.4.4.16-1-13 es5id: 15.4.4.16-1-13
description: Array.prototype.every applied to the JSON object description: Array.prototype.every applied to the JSON object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return ('[object JSON]' !== Object.prototype.toString.call(obj)); return ('[object JSON]' !== Object.prototype.toString.call(obj));
} }
try {
JSON.length = 1; JSON.length = 1;
JSON[0] = 1; JSON[0] = 1;
return !Array.prototype.every.call(JSON, callbackfn);
} finally { assert.sameValue(Array.prototype.every.call(JSON, callbackfn), false, 'Array.prototype.every.call(JSON, callbackfn)');
delete JSON.length;
delete JSON[0];
}
}
runTestCase(testcase);

View File

@ -4,11 +4,8 @@
/*--- /*---
es5id: 15.4.4.16-1-3 es5id: 15.4.4.16-1-3
description: Array.prototype.every applied to boolean primitive description: Array.prototype.every applied to boolean primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -16,13 +13,8 @@ function testcase() {
return obj instanceof Boolean; return obj instanceof Boolean;
} }
try {
Boolean.prototype[0] = 1; Boolean.prototype[0] = 1;
Boolean.prototype.length = 1; Boolean.prototype.length = 1;
return Array.prototype.every.call(false, callbackfn) && accessed;
} finally { assert(Array.prototype.every.call(false, callbackfn), 'Array.prototype.every.call(false, callbackfn) !== true');
delete Boolean.prototype[0]; assert(accessed, 'accessed !== true');
delete Boolean.prototype.length;
}
}
runTestCase(testcase);

View File

@ -4,23 +4,16 @@
/*--- /*---
es5id: 15.4.4.16-1-5 es5id: 15.4.4.16-1-5
description: Array.prototype.every applied to number primitive description: Array.prototype.every applied to number primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
return obj instanceof Number; return obj instanceof Number;
} }
try {
Number.prototype[0] = 1; Number.prototype[0] = 1;
Number.prototype.length = 1; Number.prototype.length = 1;
return Array.prototype.every.call(2.5, callbackfn) && accessed;
} finally { assert(Array.prototype.every.call(2.5, callbackfn), 'Array.prototype.every.call(2.5, callbackfn) !== true');
delete Number.prototype[0]; assert(accessed, 'accessed !== true');
delete Number.prototype.length;
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-2-12
description: > description: >
Array.prototype.every - 'length' is own accessor property without Array.prototype.every - 'length' is own accessor property without
a get function that overrides an inherited accessor property a get function that overrides an inherited accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -17,7 +15,6 @@ function testcase() {
return val > 10; return val > 10;
} }
try {
Object.defineProperty(Object.prototype, "length", { Object.defineProperty(Object.prototype, "length", {
get: function () { get: function () {
return 2; return 2;
@ -31,10 +28,5 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.every.call(obj, callbackfn) && !accessed; assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
} finally { assert.sameValue(accessed, false, 'accessed');
delete Object.prototype.length;
}
}
runTestCase(testcase);

View File

@ -4,12 +4,9 @@
/*--- /*---
es5id: 15.4.4.16-2-15 es5id: 15.4.4.16-2-15
description: Array.prototype.every - 'length' is property of the global object description: Array.prototype.every - 'length' is property of the global object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
function callbackfn1(val, idx, obj) { function callbackfn1(val, idx, obj) {
return val > 10; return val > 10;
} }
@ -18,19 +15,11 @@ function testcase() {
return val > 11; return val > 11;
} }
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12; fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11; fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9; fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2; fnGlobalObject().length = 2;
return Array.prototype.every.call(fnGlobalObject(), callbackfn1) &&
!Array.prototype.every.call(fnGlobalObject(), callbackfn2); assert(Array.prototype.every.call(fnGlobalObject(), callbackfn1), 'Array.prototype.every.call(fnGlobalObject(), callbackfn1) !== true');
} finally { assert.sameValue(Array.prototype.every.call(fnGlobalObject(), callbackfn2), false, 'Array.prototype.every.call(fnGlobalObject(), callbackfn2)');
delete fnGlobalObject()[0];
delete fnGlobalObject()[1];
delete fnGlobalObject()[2];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-2-18
description: > description: >
Array.prototype.every applied to String object, which implements Array.prototype.every applied to String object, which implements
its own property get method its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn1(val, idx, obj) { function callbackfn1(val, idx, obj) {
return parseInt(val, 10) > 1; return parseInt(val, 10) > 1;
} }
@ -19,12 +17,8 @@ function testcase() {
} }
var str = new String("432"); var str = new String("432");
try {
String.prototype[3] = "1"; String.prototype[3] = "1";
return Array.prototype.every.call(str, callbackfn1) &&
!Array.prototype.every.call(str, callbackfn2); assert(Array.prototype.every.call(str, callbackfn1), 'Array.prototype.every.call(str, callbackfn1) !== true');
} finally { assert.sameValue(Array.prototype.every.call(str, callbackfn2), false, 'Array.prototype.every.call(str, callbackfn2)');
delete String.prototype[3];
}
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 15.4.4.16-2-2 es5id: 15.4.4.16-2-2
description: Array.prototype.every - 'length' is own data property on an Array description: Array.prototype.every - 'length' is own data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn1(val, idx, obj) { function callbackfn1(val, idx, obj) {
return val > 10; return val > 10;
} }
@ -16,13 +14,7 @@ function testcase() {
return val > 11; return val > 11;
} }
try {
Array.prototype[2] = 9; Array.prototype[2] = 9;
return [12, 11].every(callbackfn1) && assert([12, 11].every(callbackfn1), '[12, 11].every(callbackfn1) !== true');
![12, 11].every(callbackfn2); assert.sameValue([12, 11].every(callbackfn2), false, '[12, 11].every(callbackfn2)');
} finally {
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-2-4
description: > description: >
Array.prototype.every - 'length' is own data property that Array.prototype.every - 'length' is own data property that
overrides an inherited data property on an Array overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arrProtoLen = 0; var arrProtoLen = 0;
function callbackfn1(val, idx, obj) { function callbackfn1(val, idx, obj) {
return val > 10; return val > 10;
@ -19,17 +17,9 @@ function testcase() {
return val > 11; return val > 11;
} }
try {
arrProtoLen = Array.prototype.length; arrProtoLen = Array.prototype.length;
Array.prototype.length = 0; Array.prototype.length = 0;
Array.prototype[2] = 9; Array.prototype[2] = 9;
return [12, 11].every(callbackfn1) && assert([12, 11].every(callbackfn1), '[12, 11].every(callbackfn1) !== true');
![12, 11].every(callbackfn2); assert.sameValue([12, 11].every(callbackfn2), false, '[12, 11].every(callbackfn2)');
} finally {
Array.prototype.length = arrProtoLen;
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-10
description: > description: >
Array.prototype.every - deleting property of prototype causes Array.prototype.every - deleting property of prototype causes
prototype index property not to be visited on an Array-like Object prototype index property not to be visited on an Array-like Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
@ -25,11 +23,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
return Array.prototype.every.call(arr, callbackfn) && accessed;
} finally { assert(Array.prototype.every.call(arr, callbackfn), 'Array.prototype.every.call(arr, callbackfn) !== true');
delete Object.prototype[1]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-11
description: > description: >
Array.prototype.every - deleting property of prototype causes Array.prototype.every - deleting property of prototype causes
prototype index property not to be visited on an Array prototype index property not to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
@ -25,11 +23,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
return arr.every(callbackfn) && accessed;
} finally { assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true');
delete Array.prototype[1]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.every - deleting own property with prototype Array.prototype.every - deleting own property with prototype
property causes prototype index property to be visited on an property causes prototype index property to be visited on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 1 && val === 1) { if (idx === 1 && val === 1) {
return false; return false;
@ -28,11 +26,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
return !Array.prototype.every.call(arr, callbackfn);
} finally { assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-13
description: > description: >
Array.prototype.every - deleting own property with prototype Array.prototype.every - deleting own property with prototype
property causes prototype index property to be visited on an Array property causes prototype index property to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 1 && val === 1) { if (idx === 1 && val === 1) {
return false; return false;
@ -27,11 +25,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
return !arr.every(callbackfn);
} finally { assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-15
description: > description: >
Array.prototype.every - decreasing length of array with prototype Array.prototype.every - decreasing length of array with prototype
property causes prototype index property to be visited property causes prototype index property to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 2 && val === "prototype") { if (idx === 2 && val === "prototype") {
return false; return false;
@ -19,7 +17,6 @@ function testcase() {
} }
var arr = [0, 1, 2]; var arr = [0, 1, 2];
try {
Object.defineProperty(Array.prototype, "2", { Object.defineProperty(Array.prototype, "2", {
get: function () { get: function () {
return "prototype"; return "prototype";
@ -35,9 +32,4 @@ function testcase() {
configurable: true configurable: true
}); });
return !arr.every(callbackfn); assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
} finally {
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-6
description: > description: >
Array.prototype.every - properties can be added to prototype after Array.prototype.every - properties can be added to prototype after
current position are visited on an Array-like object current position are visited on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 1 && val === 6.99) { if (idx === 1 && val === 6.99) {
return false; return false;
@ -32,10 +30,4 @@ function testcase() {
configurable: true configurable: true
}); });
try { assert.sameValue(Array.prototype.every.call(arr, callbackfn), false, 'Array.prototype.every.call(arr, callbackfn)');
return !Array.prototype.every.call(arr, callbackfn);
} finally {
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-b-7
description: > description: >
Array.prototype.every - properties can be added to prototype after Array.prototype.every - properties can be added to prototype after
current position are visited on an Array current position are visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 1 && val === 6.99) { if (idx === 1 && val === 6.99) {
return false; return false;
@ -32,10 +30,4 @@ function testcase() {
configurable: true configurable: true
}); });
try { assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
return !arr.every(callbackfn);
} finally {
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-7-c-i-12
description: > description: >
Array.prototype.every - element to be retrieved is own accessor Array.prototype.every - element to be retrieved is own accessor
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 0) { if (idx === 0) {
return val === 10; return val === 10;
@ -19,7 +17,7 @@ function testcase() {
} }
var arr = []; var arr = [];
try {
Array.prototype[0] = 10; Array.prototype[0] = 10;
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -29,9 +27,4 @@ function testcase() {
configurable: true configurable: true
}); });
return !arr.every(callbackfn); assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-14
description: > description: >
Array.prototype.every - element to be retrieved is own accessor Array.prototype.every - element to be retrieved is own accessor
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 0) { if (idx === 0) {
return val === 5; return val === 5;
@ -20,7 +17,7 @@ function testcase() {
} }
var arr = []; var arr = [];
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 5; return 5;
@ -35,9 +32,4 @@ function testcase() {
configurable: true configurable: true
}); });
return !arr.every(callbackfn); assert.sameValue(arr.every(callbackfn), false, 'arr.every(callbackfn)');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-16
description: > description: >
Array.prototype.every - element to be retrieved is inherited Array.prototype.every - element to be retrieved is inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 0) { if (idx === 0) {
return val !== 11; return val !== 11;
@ -19,7 +16,6 @@ function testcase() {
} }
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 11; return 11;
@ -27,9 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
return ![, , , ].every(callbackfn); assert.sameValue([, , , ].every(callbackfn), false, '[, , , ].every(callbackfn)');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.every - element to be retrieved is own accessor Array.prototype.every - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array-like object accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -24,11 +21,8 @@ function testcase() {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 10; Object.prototype[1] = 10;
return Array.prototype.every.call(obj, callbackfn) && accessed;
} finally { assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
delete Object.prototype[1]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.every - element to be retrieved is own accessor Array.prototype.every - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -26,11 +23,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[0] = 100; Array.prototype[0] = 100;
return arr.every(callbackfn) && accessed;
} finally { assert(arr.every(callbackfn), 'arr.every(callbackfn) !== true');
delete Array.prototype[0]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-22
description: > description: >
Array.prototype.every - element to be retrieved is inherited Array.prototype.every - element to be retrieved is inherited
accessor property without a get function on an Array accessor property without a get function on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,16 +15,10 @@ function testcase() {
return typeof val === "undefined"; return typeof val === "undefined";
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
return [, ].every(callbackfn) && accessed; assert([, ].every(callbackfn), '[, ].every(callbackfn) !== true');
} finally { assert(accessed, 'accessed !== true');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.4.4.16-7-c-i-23
description: > description: >
Array.prototype.every - This object is an global object which Array.prototype.every - This object is an global object which
contains index property contains index property
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 0) { if (idx === 0) {
return val !== 11; return val !== 11;
@ -21,14 +17,8 @@ function testcase() {
} }
} }
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11; fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1; fnGlobalObject().length = 1;
return !Array.prototype.every.call(fnGlobalObject(), callbackfn);
} finally { assert.sameValue(Array.prototype.every.call(fnGlobalObject(), callbackfn), false, 'Array.prototype.every.call(fnGlobalObject(), callbackfn)');
delete fnGlobalObject()[0];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -6,24 +6,16 @@ es5id: 15.4.4.16-7-c-i-4
description: > description: >
Array.prototype.every - element to be retrieved is own data Array.prototype.every - element to be retrieved is own data
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var called = 0; var called = 0;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
called++; called++;
return val === 12; return val === 12;
} }
try {
Array.prototype[0] = 11; Array.prototype[0] = 11;
Array.prototype[1] = 11; Array.prototype[1] = 11;
return [12, 12].every(callbackfn) && called === 2; assert([12, 12].every(callbackfn), '[12, 12].every(callbackfn) !== true');
} finally { assert.sameValue(called, 2, 'called');
delete Array.prototype[0];
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-6
description: > description: >
Array.prototype.every - element to be retrieved is own data Array.prototype.every - element to be retrieved is own data
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -18,16 +15,12 @@ function testcase() {
return val === 11; return val === 11;
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 9; return 9;
}, },
configurable: true configurable: true
}); });
return [11].every(callbackfn) && accessed;
} finally { assert([11].every(callbackfn), '[11].every(callbackfn) !== true');
delete Array.prototype[0]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-8
description: > description: >
Array.prototype.every - element to be retrieved is inherited data Array.prototype.every - element to be retrieved is inherited data
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
if (idx === 1) { if (idx === 1) {
return val !== 13; return val !== 13;
@ -19,11 +16,6 @@ function testcase() {
} }
} }
try {
Array.prototype[1] = 13; Array.prototype[1] = 13;
return ![, , , ].every(callbackfn);
} finally { assert.sameValue([, , , ].every(callbackfn), false, '[, , , ].every(callbackfn)');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -4,22 +4,14 @@
/*--- /*---
es5id: 15.4.4.20-1-10 es5id: 15.4.4.20-1-10
description: Array.prototype.filter applied to the Math object description: Array.prototype.filter applied to the Math object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return '[object Math]' === Object.prototype.toString.call(obj); return '[object Math]' === Object.prototype.toString.call(obj);
} }
try {
Math.length = 1; Math.length = 1;
Math[0] = 1; Math[0] = 1;
var newArr = Array.prototype.filter.call(Math, callbackfn); var newArr = Array.prototype.filter.call(Math, callbackfn);
return newArr[0] === 1;
} finally { assert.sameValue(newArr[0], 1, 'newArr[0]');
delete Math[0];
delete Math.length;
}
}
runTestCase(testcase);

View File

@ -4,23 +4,14 @@
/*--- /*---
es5id: 15.4.4.20-1-13 es5id: 15.4.4.20-1-13
description: Array.prototype.filter applied to the JSON object description: Array.prototype.filter applied to the JSON object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return '[object JSON]' === Object.prototype.toString.call(JSON); return '[object JSON]' === Object.prototype.toString.call(JSON);
} }
try {
JSON.length = 1; JSON.length = 1;
JSON[0] = 1; JSON[0] = 1;
var newArr = Array.prototype.filter.call(JSON, callbackfn); var newArr = Array.prototype.filter.call(JSON, callbackfn);
return newArr[0] === 1;
} finally { assert.sameValue(newArr[0], 1, 'newArr[0]');
delete JSON.length;
delete JSON[0];
}
}
runTestCase(testcase);

View File

@ -4,24 +4,15 @@
/*--- /*---
es5id: 15.4.4.20-1-3 es5id: 15.4.4.20-1-3
description: Array.prototype.filter applied to boolean primitive description: Array.prototype.filter applied to boolean primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Boolean; return obj instanceof Boolean;
} }
try {
Boolean.prototype[0] = true; Boolean.prototype[0] = true;
Boolean.prototype.length = 1; Boolean.prototype.length = 1;
var newArr = Array.prototype.filter.call(false, callbackfn); var newArr = Array.prototype.filter.call(false, callbackfn);
return newArr[0] === true;
} finally { assert.sameValue(newArr[0], true, 'newArr[0]');
delete Boolean.prototype[0];
delete Boolean.prototype.length;
}
}
runTestCase(testcase);

View File

@ -4,23 +4,15 @@
/*--- /*---
es5id: 15.4.4.20-1-5 es5id: 15.4.4.20-1-5
description: Array.prototype.filter applied to number primitive description: Array.prototype.filter applied to number primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj instanceof Number; return obj instanceof Number;
} }
try {
Number.prototype[0] = 1; Number.prototype[0] = 1;
Number.prototype.length = 1; Number.prototype.length = 1;
var newArr = Array.prototype.filter.call(2.5, callbackfn); var newArr = Array.prototype.filter.call(2.5, callbackfn);
return newArr[0] === 1;
} finally { assert.sameValue(newArr[0], 1, 'newArr[0]');
delete Number.prototype[0];
delete Number.prototype.length;
}
}
runTestCase(testcase);

View File

@ -6,18 +6,14 @@ es5id: 15.4.4.20-2-12
description: > description: >
Array.prototype.filter - 'length' is own accessor property without Array.prototype.filter - 'length' is own accessor property without
a get function that overrides an inherited accessor property a get function that overrides an inherited accessor property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
return true; return true;
} }
try {
Object.defineProperty(Object.prototype, "length", { Object.defineProperty(Object.prototype, "length", {
get: function () { get: function () {
return 2; return 2;
@ -32,9 +28,6 @@ function testcase() {
}); });
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 0 && !accessed;
} finally { assert.sameValue(newArr.length, 0, 'newArr.length');
delete Object.prototype.length; assert.sameValue(accessed, false, 'accessed');
}
}
runTestCase(testcase);

View File

@ -4,30 +4,18 @@
/*--- /*---
es5id: 15.4.4.20-2-15 es5id: 15.4.4.20-2-15
description: Array.prototype.filter - 'length' is property of the global object description: Array.prototype.filter - 'length' is property of the global object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12; fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11; fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9; fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2; fnGlobalObject().length = 2;
var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn); var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);
return newArr.length === 2;
} finally { assert.sameValue(newArr.length, 2, 'newArr.length');
delete fnGlobalObject()[0];
delete fnGlobalObject()[1];
delete fnGlobalObject()[2];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -6,24 +6,16 @@ es5id: 15.4.4.20-2-4
description: > description: >
Array.prototype.filter - 'length' is own data property that Array.prototype.filter - 'length' is own data property that
overrides an inherited data property on an Array overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arrProtoLen; var arrProtoLen;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return obj.length === 2; return obj.length === 2;
} }
try {
arrProtoLen = Array.prototype.length; arrProtoLen = Array.prototype.length;
Array.prototype.length = 0; Array.prototype.length = 0;
var newArr = [12, 11].filter(callbackfn); var newArr = [12, 11].filter(callbackfn);
return newArr.length === 2;
} finally { assert.sameValue(newArr.length, 2, 'newArr.length');
Array.prototype.length = arrProtoLen;
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-10
description: > description: >
Array.prototype.filter - deleting property of prototype causes Array.prototype.filter - deleting property of prototype causes
prototype index property not to be visited on an Array-like Object prototype index property not to be visited on an Array-like Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -24,13 +21,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 2 && newArr[1] !== 1; assert.sameValue(newArr.length, 2, 'newArr.length');
} finally { assert.notSameValue(newArr[1], 1, 'newArr[1]');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-b-11
description: > description: >
Array.prototype.filter - deleting property of prototype causes Array.prototype.filter - deleting property of prototype causes
prototype index property not to be visited on an Array prototype index property not to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -24,12 +21,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 2 && newArr[1] !== 1;
} finally { assert.sameValue(newArr.length, 2, 'newArr.length');
delete Array.prototype[1]; assert.notSameValue(newArr[1], 1, 'newArr[1]');
}
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Array.prototype.filter - deleting own property with prototype Array.prototype.filter - deleting own property with prototype
property causes prototype index property to be visited on an property causes prototype index property to be visited on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
@ -24,13 +22,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 3 && newArr[1] === 1; assert.sameValue(newArr.length, 3, 'newArr.length');
} finally { assert.sameValue(newArr[1], 1, 'newArr[1]');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-9-b-13
description: > description: >
Array.prototype.filter - deleting own property with prototype Array.prototype.filter - deleting own property with prototype
property causes prototype index property to be visited on an Array property causes prototype index property to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return val < 3 ? true : false; return val < 3 ? true : false;
} }
@ -23,13 +21,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 3 && newArr[1] === 1; assert.sameValue(newArr.length, 3, 'newArr.length');
} finally { assert.sameValue(newArr[1], 1, 'newArr[1]');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,16 +6,13 @@ es5id: 15.4.4.20-9-b-15
description: > description: >
Array.prototype.filter - decreasing length of array with prototype Array.prototype.filter - decreasing length of array with prototype
property causes prototype index property to be visited property causes prototype index property to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
var arr = [0, 1, 2]; var arr = [0, 1, 2];
try {
Object.defineProperty(Array.prototype, "2", { Object.defineProperty(Array.prototype, "2", {
get: function () { get: function () {
return "prototype"; return "prototype";
@ -33,9 +30,5 @@ function testcase() {
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 3 && newArr[2] === "prototype"; assert.sameValue(newArr.length, 3, 'newArr.length');
} finally { assert.sameValue(newArr[2], "prototype", 'newArr[2]');
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,16 +6,13 @@ es5id: 15.4.4.20-9-b-6
description: > description: >
Array.prototype.filter - properties can be added to prototype Array.prototype.filter - properties can be added to prototype
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() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
var obj = { length: 2 }; var obj = { length: 2 };
try {
Object.defineProperty(obj, "0", { Object.defineProperty(obj, "0", {
get: function () { get: function () {
Object.defineProperty(Object.prototype, "1", { Object.defineProperty(Object.prototype, "1", {
@ -31,9 +28,5 @@ function testcase() {
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 2 && Array[1] === 6.99; assert.sameValue(newArr.length, 2, 'newArr.length');
} finally { assert.sameValue(Array[1], 6.99, 'Array[1]');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,16 +6,13 @@ es5id: 15.4.4.20-9-b-7
description: > description: >
Array.prototype.filter - properties can be added to prototype Array.prototype.filter - properties can be added to prototype
after current position are visited on an Array after current position are visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return true; return true;
} }
var arr = [0, , 2]; var arr = [0, , 2];
try {
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
get: function () { get: function () {
Object.defineProperty(Array.prototype, "1", { Object.defineProperty(Array.prototype, "1", {
@ -31,9 +28,5 @@ function testcase() {
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 3 && newArr[1] === 6.99; assert.sameValue(newArr.length, 3, 'newArr.length');
} finally { assert.sameValue(newArr[1], 6.99, 'newArr[1]');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,16 +6,14 @@ es5id: 15.4.4.20-9-c-i-12
description: > description: >
Array.prototype.filter - element to be retrieved is own accessor Array.prototype.filter - element to be retrieved is own accessor
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return val === 111 && idx === 0; return val === 111 && idx === 0;
} }
var arr = []; var arr = [];
try {
Array.prototype[0] = 10; Array.prototype[0] = 10;
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -26,9 +24,5 @@ function testcase() {
}); });
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 1 && newArr[0] === 111; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], 111, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,17 +6,14 @@ es5id: 15.4.4.20-9-c-i-14
description: > description: >
Array.prototype.filter - element to be retrieved is own accessor Array.prototype.filter - element to be retrieved is own accessor
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return idx === 0 && val === 11; return idx === 0 && val === 11;
} }
var arr = []; var arr = [];
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 5; return 5;
@ -32,9 +29,5 @@ function testcase() {
}); });
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], 11, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,16 +6,12 @@ es5id: 15.4.4.20-9-c-i-16
description: > description: >
Array.prototype.filter - element to be retrieved is inherited Array.prototype.filter - element to be retrieved is inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return idx === 0 && val === 11; return idx === 0 && val === 11;
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 11; return 11;
@ -24,9 +20,5 @@ function testcase() {
}); });
var newArr = [, , , ].filter(callbackfn); var newArr = [, , , ].filter(callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], 11, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.filter - element to be retrieved is own accessor Array.prototype.filter - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array-like object accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return undefined === val && idx === 1; return undefined === val && idx === 1;
} }
@ -21,13 +18,9 @@ function testcase() {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 10; Object.prototype[1] = 10;
var newArr = Array.prototype.filter.call(obj, callbackfn); var newArr = Array.prototype.filter.call(obj, callbackfn);
return newArr.length === 1 && newArr[0] === undefined; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], undefined, 'newArr[0]');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.filter - element to be retrieved is own accessor Array.prototype.filter - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return undefined === val && idx === 0; return undefined === val && idx === 0;
} }
@ -23,13 +20,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[0] = 100; Array.prototype[0] = 100;
var newArr = arr.filter(callbackfn); var newArr = arr.filter(callbackfn);
return newArr.length === 1 && newArr[0] === undefined; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], undefined, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,25 +6,17 @@ es5id: 15.4.4.20-9-c-i-22
description: > description: >
Array.prototype.filter - element to be retrieved is inherited Array.prototype.filter - element to be retrieved is inherited
accessor property without a get function on an Array accessor property without a get function on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return undefined === val && idx === 0; return undefined === val && idx === 0;
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
var newArr = [, ].filter(callbackfn); var newArr = [, ].filter(callbackfn);
return newArr.length === 1 && newArr[0] === undefined; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], undefined, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,26 +6,17 @@ es5id: 15.4.4.20-9-c-i-23
description: > description: >
Array.prototype.filter - This object is the global object which Array.prototype.filter - This object is the global object which
contains index property contains index property
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return idx === 0 && val === 11; return idx === 0 && val === 11;
} }
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11; fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1; fnGlobalObject().length = 1;
var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn); var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);
return newArr.length === 1 && newArr[0] === 11;
} finally { assert.sameValue(newArr.length, 1, 'newArr.length');
delete fnGlobalObject()[0]; assert.sameValue(newArr[0], 11, 'newArr[0]');
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -6,22 +6,14 @@ es5id: 15.4.4.20-9-c-i-4
description: > description: >
Array.prototype.filter - element to be retrieved is own data Array.prototype.filter - element to be retrieved is own data
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return (idx === 0) && (val === 12); return (idx === 0) && (val === 12);
} }
try {
Array.prototype[0] = 11; Array.prototype[0] = 11;
var newArr = [12].filter(callbackfn); var newArr = [12].filter(callbackfn);
return newArr.length === 1 && newArr[0] === 12; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], 12, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,16 +6,12 @@ es5id: 15.4.4.20-9-c-i-6
description: > description: >
Array.prototype.filter - element to be retrieved is own data Array.prototype.filter - element to be retrieved is own data
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return val === 11; return val === 11;
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 9; return 9;
@ -24,9 +20,5 @@ function testcase() {
}); });
var newArr = [11].filter(callbackfn); var newArr = [11].filter(callbackfn);
return newArr.length === 1 && newArr[0] === 11; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], 11, 'newArr[0]');
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,22 +6,14 @@ es5id: 15.4.4.20-9-c-i-8
description: > description: >
Array.prototype.filter - element to be retrieved is inherited data Array.prototype.filter - element to be retrieved is inherited data
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
return (idx === 1) && (val === 13); return (idx === 1) && (val === 13);
} }
try {
Array.prototype[1] = 13; Array.prototype[1] = 13;
var newArr = [, , , ].filter(callbackfn); var newArr = [, , , ].filter(callbackfn);
return newArr.length === 1 && newArr[0] === 13; assert.sameValue(newArr.length, 1, 'newArr.length');
} finally { assert.sameValue(newArr[0], 13, 'newArr[0]');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -4,24 +4,16 @@
/*--- /*---
es5id: 15.4.4.18-1-10 es5id: 15.4.4.18-1-10
description: Array.prototype.forEach applied to the Math object description: Array.prototype.forEach applied to the Math object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = ('[object Math]' === Object.prototype.toString.call(obj)); result = ('[object Math]' === Object.prototype.toString.call(obj));
} }
try {
Math.length = 1; Math.length = 1;
Math[0] = 1; Math[0] = 1;
Array.prototype.forEach.call(Math, callbackfn); Array.prototype.forEach.call(Math, callbackfn);
return result;
} finally { assert(result, 'result !== true');
delete Math[0];
delete Math.length;
}
}
runTestCase(testcase);

View File

@ -4,23 +4,15 @@
/*--- /*---
es5id: 15.4.4.18-1-13 es5id: 15.4.4.18-1-13
description: Array.prototype.forEach applied to the JSON object description: Array.prototype.forEach applied to the JSON object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = ('[object JSON]' === Object.prototype.toString.call(obj)); result = ('[object JSON]' === Object.prototype.toString.call(obj));
} }
try {
JSON.length = 1; JSON.length = 1;
JSON[0] = 1; JSON[0] = 1;
Array.prototype.forEach.call(JSON, callbackfn); Array.prototype.forEach.call(JSON, callbackfn);
return result;
} finally { assert(result, 'result !== true');
delete JSON.length;
delete JSON[0];
}
}
runTestCase(testcase);

View File

@ -4,26 +4,17 @@
/*--- /*---
es5id: 15.4.4.18-1-3 es5id: 15.4.4.18-1-3
description: Array.prototype.forEach applied to boolean primitive description: Array.prototype.forEach applied to boolean primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Boolean; result = obj instanceof Boolean;
} }
try {
Boolean.prototype[0] = true; Boolean.prototype[0] = true;
Boolean.prototype.length = 1; Boolean.prototype.length = 1;
Array.prototype.forEach.call(false, callbackfn); Array.prototype.forEach.call(false, callbackfn);
return result;
} finally { assert(result, 'result !== true');
delete Boolean.prototype[0];
delete Boolean.prototype.length;
}
}
runTestCase(testcase);

View File

@ -4,24 +4,16 @@
/*--- /*---
es5id: 15.4.4.18-1-5 es5id: 15.4.4.18-1-5
description: Array.prototype.forEach applied to number primitive description: Array.prototype.forEach applied to number primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = obj instanceof Number; result = obj instanceof Number;
} }
try {
Number.prototype[0] = 1; Number.prototype[0] = 1;
Number.prototype.length = 1; Number.prototype.length = 1;
Array.prototype.forEach.call(2.5, callbackfn); Array.prototype.forEach.call(2.5, callbackfn);
return result;
} finally { assert(result, 'result !== true');
delete Number.prototype[0];
delete Number.prototype.length;
}
}
runTestCase(testcase);

View File

@ -7,16 +7,13 @@ description: >
Array.prototype.forEach - 'length' is own accessor property Array.prototype.forEach - 'length' is own accessor property
without a get function that overrides an inherited accessor without a get function that overrides an inherited accessor
property on an Array property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
accessed = true; accessed = true;
} }
try {
Object.defineProperty(Object.prototype, "length", { Object.defineProperty(Object.prototype, "length", {
get: function () { get: function () {
return 2; return 2;
@ -31,10 +28,5 @@ function testcase() {
}); });
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return !accessed;
} finally {
delete Object.prototype.length;
}
} assert.sameValue(accessed, false, 'accessed');
runTestCase(testcase);

View File

@ -4,30 +4,19 @@
/*--- /*---
es5id: 15.4.4.18-2-15 es5id: 15.4.4.18-2-15
description: Array.prototype.forEach - 'length' is property of the global object description: Array.prototype.forEach - 'length' is property of the global object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var result = false; var result = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
} }
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12; fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11; fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9; fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2; fnGlobalObject().length = 2;
Array.prototype.forEach.call(fnGlobalObject(), callbackfn); Array.prototype.forEach.call(fnGlobalObject(), callbackfn);
return result;
} finally { assert(result, 'result !== true');
delete fnGlobalObject()[0];
delete fnGlobalObject()[1];
delete fnGlobalObject()[2];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -6,24 +6,16 @@ es5id: 15.4.4.18-2-4
description: > description: >
Array.prototype.forEach - 'length' is own data property that Array.prototype.forEach - 'length' is own data property that
overrides an inherited data property on an Array overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
var arrProtoLen; var arrProtoLen;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
result = (obj.length === 2); result = (obj.length === 2);
} }
try {
arrProtoLen = Array.prototype.length; arrProtoLen = Array.prototype.length;
Array.prototype.length = 0; Array.prototype.length = 0;
[12, 11].forEach(callbackfn); [12, 11].forEach(callbackfn);
return result;
} finally {
Array.prototype.length = arrProtoLen;
}
} assert(result, 'result !== true');
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-10
description: > description: >
Array.prototype.forEach - deleting property of prototype causes Array.prototype.forEach - deleting property of prototype causes
prototype index property not to be visited on an Array-like Object prototype index property not to be visited on an Array-like Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var testResult = true; var testResult = true;
@ -31,12 +28,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult && accessed;
} finally { assert(testResult, 'testResult !== true');
delete Object.prototype[1]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-11
description: > description: >
Array.prototype.forEach - deleting property of prototype causes Array.prototype.forEach - deleting property of prototype causes
prototype index property not to be visited on an Array prototype index property not to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var testResult = true; var testResult = true;
@ -31,12 +28,8 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult && accessed;
} finally { assert(testResult, 'testResult !== true');
delete Array.prototype[1]; assert(accessed, 'accessed !== true');
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - deleting own property with prototype Array.prototype.forEach - deleting own property with prototype
property causes prototype index property to be visited on an property causes prototype index property to be visited on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -30,12 +27,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult;
} finally { assert(testResult, 'testResult !== true');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-13
description: > description: >
Array.prototype.forEach - deleting own property with prototype Array.prototype.forEach - deleting own property with prototype
property causes prototype index property to be visited on an Array property causes prototype index property to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -28,12 +25,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult;
} finally { assert(testResult, 'testResult !== true');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-15
description: > description: >
Array.prototype.forEach - decreasing length of array with Array.prototype.forEach - decreasing length of array with
prototype property causes prototype index property to be visited prototype property causes prototype index property to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,7 +17,6 @@ function testcase() {
} }
var arr = [0, 1, 2]; var arr = [0, 1, 2];
try {
Object.defineProperty(Array.prototype, "2", { Object.defineProperty(Array.prototype, "2", {
get: function () { get: function () {
return "prototype"; return "prototype";
@ -38,9 +34,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-6
description: > description: >
Array.prototype.forEach - properties can be added to prototype Array.prototype.forEach - properties can be added to prototype
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 testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -34,11 +31,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult;
} finally { assert(testResult, 'testResult !== true');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-b-7
description: > description: >
Array.prototype.forEach - properties can be added to prototype Array.prototype.forEach - properties can be added to prototype
after current position are visited on an Array after current position are visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -34,11 +31,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult;
} finally { assert(testResult, 'testResult !== true');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-12
description: > description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,7 +17,7 @@ function testcase() {
} }
var arr = []; var arr = [];
try {
Array.prototype[0] = 10; Array.prototype[0] = 10;
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -32,9 +29,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-14
description: > description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -20,7 +17,7 @@ function testcase() {
} }
var arr = []; var arr = [];
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 5; return 5;
@ -37,9 +34,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-16
description: > description: >
Array.prototype.forEach - element to be retrieved is inherited Array.prototype.forEach - element to be retrieved is inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -19,7 +16,6 @@ function testcase() {
} }
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 11; return 11;
@ -29,9 +25,4 @@ function testcase() {
[, , , ].forEach(callbackfn); [, , , ].forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array-like object accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -27,7 +24,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.defineProperty(Object.prototype, "1", { Object.defineProperty(Object.prototype, "1", {
get: function () { get: function () {
return 10; return 10;
@ -37,9 +33,4 @@ function testcase() {
Array.prototype.forEach.call(obj, callbackfn); Array.prototype.forEach.call(obj, callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach - element to be retrieved is own accessor Array.prototype.forEach - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -27,7 +24,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 100; return 100;
@ -37,9 +33,4 @@ function testcase() {
arr.forEach(callbackfn); arr.forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-22
description: > description: >
Array.prototype.forEach - element to be retrieved is inherited Array.prototype.forEach - element to be retrieved is inherited
accessor property without a get function on an Array accessor property without a get function on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -19,7 +16,6 @@ function testcase() {
} }
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
set: function () { }, set: function () { },
configurable: true configurable: true
@ -27,10 +23,4 @@ function testcase() {
[, 1].forEach(callbackfn); [, 1].forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.4.4.18-7-c-i-23
description: > description: >
Array.prototype.forEach - This object is an global object which Array.prototype.forEach - This object is an global object which
contains index property contains index property
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -21,17 +17,10 @@ function testcase() {
} }
} }
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11; fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1; fnGlobalObject().length = 1;
Array.prototype.forEach.call(fnGlobalObject(), callbackfn); Array.prototype.forEach.call(fnGlobalObject(), callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete fnGlobalObject()[0];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-4
description: > description: >
Array.prototype.forEach - element to be retrieved is own data Array.prototype.forEach - element to be retrieved is own data
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -19,14 +16,8 @@ function testcase() {
} }
} }
try {
Array.prototype[0] = 11; Array.prototype[0] = 11;
[12].forEach(callbackfn); [12].forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-6
description: > description: >
Array.prototype.forEach - element to be retrieved is own data Array.prototype.forEach - element to be retrieved is own data
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -19,7 +16,6 @@ function testcase() {
} }
} }
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 9; return 9;
@ -29,9 +25,4 @@ function testcase() {
[11].forEach(callbackfn); [11].forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-8
description: > description: >
Array.prototype.forEach - element to be retrieved is inherited Array.prototype.forEach - element to be retrieved is inherited
data property on an Array data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var testResult = false; var testResult = false;
function callbackfn(val, idx, obj) { function callbackfn(val, idx, obj) {
@ -19,14 +16,8 @@ function testcase() {
} }
} }
try {
Array.prototype[1] = 13; Array.prototype[1] = 13;
[, , , ].forEach(callbackfn); [, , , ].forEach(callbackfn);
return testResult; assert(testResult, 'testResult !== true');
} finally {
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -4,17 +4,9 @@
/*--- /*---
es5id: 15.4.4.14-1-10 es5id: 15.4.4.14-1-10
description: Array.prototype.indexOf applied to the Math object description: Array.prototype.indexOf applied to the Math object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Math[1] = true; Math[1] = true;
Math.length = 2; Math.length = 2;
return Array.prototype.indexOf.call(Math, true) === 1;
} finally { assert.sameValue(Array.prototype.indexOf.call(Math, true), 1, 'Array.prototype.indexOf.call(Math, true)');
delete Math[1];
delete Math.length;
}
}
runTestCase(testcase);

View File

@ -4,18 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-1-13 es5id: 15.4.4.14-1-13
description: Array.prototype.indexOf applied to the JSON object description: Array.prototype.indexOf applied to the JSON object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
try {
JSON[3] = targetObj; JSON[3] = targetObj;
JSON.length = 5; JSON.length = 5;
return Array.prototype.indexOf.call(JSON, targetObj) === 3;
} finally { assert.sameValue(Array.prototype.indexOf.call(JSON, targetObj), 3, 'Array.prototype.indexOf.call(JSON, targetObj)');
delete JSON[3];
delete JSON.length;
}
}
runTestCase(testcase);

View File

@ -4,20 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-1-17 es5id: 15.4.4.14-1-17
description: Array.prototype.indexOf applied to the global object description: Array.prototype.indexOf applied to the global object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
try {
var oldLen = fnGlobalObject().length; var oldLen = fnGlobalObject().length;
fnGlobalObject()[1] = true; fnGlobalObject()[1] = true;
fnGlobalObject().length = 2; fnGlobalObject().length = 2;
return Array.prototype.indexOf.call(fnGlobalObject(), true) === 1;
} finally { assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), true), 1, 'Array.prototype.indexOf.call(fnGlobalObject(), true)');
delete fnGlobalObject()[1];
fnGlobalObject().length = oldLen;
}
}
runTestCase(testcase);

View File

@ -4,19 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-1-3 es5id: 15.4.4.14-1-3
description: Array.prototype.indexOf applied to boolean primitive description: Array.prototype.indexOf applied to boolean primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
try {
Boolean.prototype[1] = targetObj; Boolean.prototype[1] = targetObj;
Boolean.prototype.length = 2; Boolean.prototype.length = 2;
return Array.prototype.indexOf.call(true, targetObj) === 1; assert.sameValue(Array.prototype.indexOf.call(true, targetObj), 1, 'Array.prototype.indexOf.call(true, targetObj)');
} finally {
delete Boolean.prototype[1];
delete Boolean.prototype.length;
}
}
runTestCase(testcase);

View File

@ -4,19 +4,11 @@
/*--- /*---
es5id: 15.4.4.14-1-5 es5id: 15.4.4.14-1-5
description: Array.prototype.indexOf applied to number primitive description: Array.prototype.indexOf applied to number primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
try {
Number.prototype[1] = targetObj; Number.prototype[1] = targetObj;
Number.prototype.length = 2; Number.prototype.length = 2;
return Array.prototype.indexOf.call(5, targetObj) === 1; assert.sameValue(Array.prototype.indexOf.call(5, targetObj), 1, 'Array.prototype.indexOf.call(5, targetObj)');
} finally {
delete Number.prototype[1];
delete Number.prototype.length;
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.indexOf - 'length' is own accessor property Array.prototype.indexOf - 'length' is own accessor property
without a get function that overrides an inherited accessor without a get function that overrides an inherited accessor
property property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Object.prototype, "length", { Object.defineProperty(Object.prototype, "length", {
get: function () { get: function () {
return 20; return 20;
@ -25,9 +22,4 @@ function testcase() {
configurable: true configurable: true
}); });
return Array.prototype.indexOf.call(obj, 1) === -1; assert.sameValue(Array.prototype.indexOf.call(obj, 1), -1, 'Array.prototype.indexOf.call(obj, 1)');
} finally {
delete Object.prototype.length;
}
}
runTestCase(testcase);

View File

@ -6,17 +6,11 @@ es5id: 15.4.4.14-2-18
description: > description: >
Array.prototype.indexOf applied to String object, which implements Array.prototype.indexOf applied to String object, which implements
its own property get method its own property get method
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var str = new String("012"); var str = new String("012");
try {
String.prototype[3] = "3"; String.prototype[3] = "3";
return Array.prototype.indexOf.call(str, "2") === 2 &&
Array.prototype.indexOf.call(str, "3") === -1; assert.sameValue(Array.prototype.indexOf.call(str, "2"), 2, 'Array.prototype.indexOf.call(str, "2")');
} finally { assert.sameValue(Array.prototype.indexOf.call(str, "3"), -1, 'Array.prototype.indexOf.call(str, "3")');
delete String.prototype[3];
}
}
runTestCase(testcase);

View File

@ -4,19 +4,12 @@
/*--- /*---
es5id: 15.4.4.14-2-2 es5id: 15.4.4.14-2-2
description: Array.prototype.indexOf - 'length' is own data property on an Array description: Array.prototype.indexOf - 'length' is own data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
try {
Array.prototype[2] = targetObj; Array.prototype[2] = targetObj;
return [0, targetObj].indexOf(targetObj) === 1 &&
[0, 1].indexOf(targetObj) === -1;
} finally { assert.sameValue([0, targetObj].indexOf(targetObj), 1, '[0, targetObj].indexOf(targetObj)');
delete Array.prototype[2]; assert.sameValue([0, 1].indexOf(targetObj), -1, '[0, 1].indexOf(targetObj)');
}
}
runTestCase(testcase);

View File

@ -6,23 +6,12 @@ es5id: 15.4.4.14-2-4
description: > description: >
Array.prototype.indexOf - 'length' is own data property that Array.prototype.indexOf - 'length' is own data property that
overrides an inherited data property on an Array overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var targetObj = {}; var targetObj = {};
var arrProtoLen; var arrProtoLen;
try {
arrProtoLen = Array.prototype.length; arrProtoLen = Array.prototype.length;
Array.prototype.length = 0; Array.prototype.length = 0;
return [0, targetObj].indexOf(targetObj) === 1; assert.sameValue([0, targetObj].indexOf(targetObj), 1, '[0, targetObj].indexOf(targetObj)');
} finally {
Array.prototype.length = arrProtoLen;
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-10
description: > description: >
Array.prototype.indexOf - properties can be added to prototype Array.prototype.indexOf - properties can be added to prototype
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, "0", { Object.defineProperty(arr, "0", {
@ -26,10 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
try { assert.sameValue(arr.indexOf(6.99), 1, 'arr.indexOf(6.99)');
return arr.indexOf(6.99) === 1;
} finally {
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-13
description: > description: >
Array.prototype.indexOf - deleting property of prototype causes Array.prototype.indexOf - deleting property of prototype causes
prototype index property not to be visited on an Array-like Object prototype index property not to be visited on an Array-like Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = { 2: 2, length: 20 }; var arr = { 2: 2, length: 20 };
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -21,11 +18,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
return -1 === Array.prototype.indexOf.call(arr, 1);
} finally { assert.sameValue(Array.prototype.indexOf.call(arr, 1), -1, 'Array.prototype.indexOf.call(arr, 1)');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-14
description: > description: >
Array.prototype.indexOf - deleting property of prototype causes Array.prototype.indexOf - deleting property of prototype causes
prototype index property not to be visited on an Array prototype index property not to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, , 2]; var arr = [0, , 2];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -21,11 +18,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
return -1 === arr.indexOf(1);
} finally { assert.sameValue(arr.indexOf(1), -1, 'arr.indexOf(1)');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.indexOf - deleting own property with prototype Array.prototype.indexOf - deleting own property with prototype
property causes prototype index property to be visited on an property causes prototype index property to be visited on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = { 0: 0, 1: 111, 2: 2, length: 10 }; var arr = { 0: 0, 1: 111, 2: 2, length: 10 };
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -22,11 +19,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.prototype[1] = 1; Object.prototype[1] = 1;
return 1 === Array.prototype.indexOf.call(arr, 1);
} finally { assert.sameValue(Array.prototype.indexOf.call(arr, 1), 1, 'Array.prototype.indexOf.call(arr, 1)');
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-16
description: > description: >
Array.prototype.indexOf - deleting own property with prototype Array.prototype.indexOf - deleting own property with prototype
property causes prototype index property to be visited on an Array property causes prototype index property to be visited on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 111, 2]; var arr = [0, 111, 2];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -21,11 +18,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Array.prototype[1] = 1; Array.prototype[1] = 1;
return 1 === arr.indexOf(1);
} finally { assert.sameValue(arr.indexOf(1), 1, 'arr.indexOf(1)');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,14 +6,10 @@ es5id: 15.4.4.14-9-a-18
description: > description: >
Array.prototype.indexOf - decreasing length of array with Array.prototype.indexOf - decreasing length of array with
prototype property causes prototype index property to be visited prototype property causes prototype index property to be visited
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1, 2]; var arr = [0, 1, 2];
try {
Object.defineProperty(Array.prototype, "2", { Object.defineProperty(Array.prototype, "2", {
get: function () { get: function () {
return "prototype"; return "prototype";
@ -29,9 +25,4 @@ function testcase() {
configurable: true configurable: true
}); });
return 2 === arr.indexOf("prototype"); assert.sameValue(arr.indexOf("prototype"), 2, 'arr.indexOf("prototype")');
} finally {
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-a-9
description: > description: >
Array.prototype.indexOf - properties can be added to prototype Array.prototype.indexOf - properties can be added to prototype
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: 2 }; var arr = { length: 2 };
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -26,10 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
try { assert.sameValue(Array.prototype.indexOf.call(arr, 6.99), 1, 'Array.prototype.indexOf.call(arr, 6.99)');
return Array.prototype.indexOf.call(arr, 6.99) === 1;
} finally {
delete Object.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,13 +6,10 @@ es5id: 15.4.4.14-9-b-i-11
description: > description: >
Array.prototype.indexOf - element to be retrieved is own accessor Array.prototype.indexOf - element to be retrieved is own accessor
property that overrides an inherited data property on an Array property that overrides an inherited data property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
try {
Array.prototype[0] = false; Array.prototype[0] = false;
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
get: function () { get: function () {
@ -21,9 +18,4 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === arr.indexOf(true); assert.sameValue(arr.indexOf(true), 0, 'arr.indexOf(true)');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Array.prototype.indexOf - element to be retrieved is own accessor Array.prototype.indexOf - element to be retrieved is own accessor
property that overrides an inherited data property on an property that overrides an inherited data property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { length: 1 }; var obj = { length: 1 };
try {
Object.prototype[0] = false; Object.prototype[0] = false;
Object.defineProperty(obj, "0", { Object.defineProperty(obj, "0", {
get: function () { get: function () {
@ -22,9 +19,4 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === Array.prototype.indexOf.call(obj, true); assert.sameValue(Array.prototype.indexOf.call(obj, true), 0, 'Array.prototype.indexOf.call(obj, true)');
} finally {
delete Object.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,13 +6,10 @@ es5id: 15.4.4.14-9-b-i-13
description: > description: >
Array.prototype.indexOf - element to be retrieved is own accessor Array.prototype.indexOf - element to be retrieved is own accessor
property that overrides an inherited accessor property on an Array property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return false; return false;
@ -27,9 +24,4 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === arr.indexOf(true); assert.sameValue(arr.indexOf(true), 0, 'arr.indexOf(true)');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Array.prototype.indexOf - element to be retrieved is own accessor Array.prototype.indexOf - element to be retrieved is own accessor
property that overrides an inherited accessor property on an property that overrides an inherited accessor property on an
Array-like object Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = { length: 1 }; var obj = { length: 1 };
try {
Object.defineProperty(Object.prototype, "0", { Object.defineProperty(Object.prototype, "0", {
get: function () { get: function () {
return false; return false;
@ -29,9 +25,4 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === Array.prototype.indexOf.call(obj, true); assert.sameValue(Array.prototype.indexOf.call(obj, true), 0, 'Array.prototype.indexOf.call(obj, true)');
} finally {
delete Object.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-b-i-15
description: > description: >
Array.prototype.indexOf - element to be retrieved is inherited Array.prototype.indexOf - element to be retrieved is inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 10; return 10;
@ -32,13 +29,6 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === [, , , ].indexOf(10) && assert.sameValue([, , , ].indexOf(10), 0, '[, , , ].indexOf(10)');
1 === [, , , ].indexOf(20) && assert.sameValue([, , , ].indexOf(20), 1, '[, , , ].indexOf(20)');
2 === [, , , ].indexOf(30); assert.sameValue([, , , ].indexOf(30), 2, '[, , , ].indexOf(30)');
} finally {
delete Array.prototype[0];
delete Array.prototype[1];
delete Array.prototype[2];
}
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.4.4.14-9-b-i-16
description: > description: >
Array.prototype.indexOf - element to be retrieved is inherited Array.prototype.indexOf - element to be retrieved is inherited
accessor property on an Array-like object accessor property on an Array-like object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Object.prototype, "0", { Object.defineProperty(Object.prototype, "0", {
get: function () { get: function () {
return 10; return 10;
@ -33,13 +29,6 @@ function testcase() {
configurable: true configurable: true
}); });
return 0 === Array.prototype.indexOf.call({ length: 3 }, 10) && assert.sameValue(Array.prototype.indexOf.call({ length: 3 }, 10), 0, 'Array.prototype.indexOf.call({ length: 3 }, 10)');
1 === Array.prototype.indexOf.call({ length: 3 }, 20) && assert.sameValue(Array.prototype.indexOf.call({ length: 3 }, 20), 1, 'Array.prototype.indexOf.call({ length: 3 }, 20)');
2 === Array.prototype.indexOf.call({ length: 3 }, 30); assert.sameValue(Array.prototype.indexOf.call({ length: 3 }, 30), 2, 'Array.prototype.indexOf.call({ length: 3 }, 30)');
} finally {
delete Object.prototype[0];
delete Object.prototype[1];
delete Object.prototype[2];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.indexOf - element to be retrieved is own accessor Array.prototype.indexOf - element to be retrieved is own accessor
property without a get function that overrides an inherited property without a get function that overrides an inherited
accessor property on an Array accessor property on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -19,7 +16,6 @@ function testcase() {
configurable: true configurable: true
}); });
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 2; return 2;
@ -27,9 +23,4 @@ function testcase() {
configurable: true configurable: true
}); });
return arr.indexOf(undefined) === 0; assert.sameValue(arr.indexOf(undefined), 0, 'arr.indexOf(undefined)');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,18 +6,11 @@ es5id: 15.4.4.14-9-b-i-21
description: > description: >
Array.prototype.indexOf - element to be retrieved is inherited Array.prototype.indexOf - element to be retrieved is inherited
accessor property without a get function on an Array accessor property without a get function on an Array
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
set: function () { }, set: function () { },
configurable: true configurable: true
}); });
return 0 === [, ].indexOf(undefined);
} finally { assert.sameValue([, ].indexOf(undefined), 0, '[, ].indexOf(undefined)');
delete Array.prototype[0];
}
}
runTestCase(testcase);

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