mirror of https://github.com/tc39/test262.git
Remove unnecessary tests
These tests are not adding any coverage to the respective API they should be covering. There are other files checking cases for array-like objects, and playing this with the global might cause issues and unnexpected behavior on specific environments like browsers.
This commit is contained in:
parent
d587abccdb
commit
715b9052cf
|
@ -1,23 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.16-2-15
|
|
||||||
description: Array.prototype.every - 'length' is property of the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn1(val, idx, obj) {
|
|
||||||
return val > 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
function callbackfn2(val, idx, obj) {
|
|
||||||
return val > 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 12;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 9;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
assert(Array.prototype.every.call(this, callbackfn1), 'Array.prototype.every.call(this, callbackfn1) !== true');
|
|
||||||
assert.sameValue(Array.prototype.every.call(this, callbackfn2), false, 'Array.prototype.every.call(this, callbackfn2)');
|
|
|
@ -1,22 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.16-7-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.every - This object is an global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
if (idx === 0) {
|
|
||||||
return val !== 11;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 11;
|
|
||||||
this.length = 1;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.every.call(this, callbackfn), false, 'Array.prototype.every.call(this, callbackfn)');
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.20-2-15
|
|
||||||
description: Array.prototype.filter - 'length' is property of the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
return obj.length === 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 12;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 9;
|
|
||||||
this.length = 2;
|
|
||||||
var newArr = Array.prototype.filter.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert.sameValue(newArr.length, 2, 'newArr.length');
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.20-9-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.filter - This object is the global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
return idx === 0 && val === 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 11;
|
|
||||||
this.length = 1;
|
|
||||||
var newArr = Array.prototype.filter.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert.sameValue(newArr.length, 1, 'newArr.length');
|
|
||||||
assert.sameValue(newArr[0], 11, 'newArr[0]');
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.18-2-15
|
|
||||||
description: Array.prototype.forEach - 'length' is property of the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var result = false;
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
result = (obj.length === 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 12;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 9;
|
|
||||||
this.length = 2;
|
|
||||||
Array.prototype.forEach.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert(result, 'result !== true');
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.18-7-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.forEach - This object is an global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var testResult = false;
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
if (idx === 0) {
|
|
||||||
testResult = (val === 11);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 11;
|
|
||||||
this.length = 1;
|
|
||||||
|
|
||||||
Array.prototype.forEach.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert(testResult, 'testResult !== true');
|
|
|
@ -1,12 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.14-1-17
|
|
||||||
description: Array.prototype.indexOf applied to the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
this[1] = true;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.indexOf.call(this, true), 1, 'Array.prototype.indexOf.call(this, true)');
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.14-2-15
|
|
||||||
description: Array.prototype.indexOf - 'length' is property of the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var targetObj = {};
|
|
||||||
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
this[1] = targetObj;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.indexOf.call(this, targetObj), 1, 'Array.prototype.indexOf.call(this, targetObj)');
|
|
||||||
|
|
||||||
this[1] = {};
|
|
||||||
this[2] = targetObj;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.indexOf.call(this, targetObj), -1, 'Array.prototype.indexOf.call(this, targetObj)');
|
|
|
@ -1,18 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.14-9-b-i-23
|
|
||||||
description: Array.prototype.indexOf - This object is the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var targetObj = {};
|
|
||||||
|
|
||||||
this[0] = targetObj;
|
|
||||||
this[100] = "100";
|
|
||||||
this[200] = "200";
|
|
||||||
this.length = 200;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.indexOf.call(this, targetObj), 0, 'Array.prototype.indexOf.call(this, targetObj)');
|
|
||||||
assert.sameValue(Array.prototype.indexOf.call(this, "100"), 100, 'Array.prototype.indexOf.call(this, "100")');
|
|
||||||
assert.sameValue(Array.prototype.indexOf.call(this, "200"), -1, 'Array.prototype.indexOf.call(this, "200")');
|
|
|
@ -1,14 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.15-1-17
|
|
||||||
description: Array.prototype.lastIndexOf applied to the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var targetObj = ["global"];
|
|
||||||
|
|
||||||
this[1] = targetObj;
|
|
||||||
this.length = 3;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), 1, 'Array.prototype.lastIndexOf.call(this, targetObj)');
|
|
|
@ -1,22 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.15-2-15
|
|
||||||
description: >
|
|
||||||
Array.prototype.lastIndexOf - 'length' is property of the global
|
|
||||||
object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var targetObj = {};
|
|
||||||
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
this[1] = targetObj;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), 1);
|
|
||||||
|
|
||||||
this[1] = {};
|
|
||||||
this[2] = targetObj;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), -1);
|
|
|
@ -1,18 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.15-8-b-i-23
|
|
||||||
description: Array.prototype.lastIndexOf - This object is the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var targetObj = {};
|
|
||||||
|
|
||||||
this[0] = targetObj;
|
|
||||||
this[100] = "100";
|
|
||||||
this[200] = "200";
|
|
||||||
this.length = 200;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), 0, 'Array.prototype.lastIndexOf.call(this, targetObj)');
|
|
||||||
assert.sameValue(Array.prototype.lastIndexOf.call(this, "100"), 100, 'Array.prototype.lastIndexOf.call(this, "100")');
|
|
||||||
assert.sameValue(Array.prototype.lastIndexOf.call(this, "200"), -1, 'Array.prototype.lastIndexOf.call(this, "200")');
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.19-2-15
|
|
||||||
description: >
|
|
||||||
Array.prototype.map - when 'length' is property of the global
|
|
||||||
object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
return val > 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 12;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 9;
|
|
||||||
this.length = 2;
|
|
||||||
var testResult = Array.prototype.map.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert.sameValue(testResult.length, 2, 'testResult.length');
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.19-8-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.map - This object is the global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var kValue = "abc";
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
if (idx === 0) {
|
|
||||||
return val === kValue;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = kValue;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
var testResult = Array.prototype.map.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert.sameValue(testResult[0], true, 'testResult[0]');
|
|
|
@ -1,18 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.21-2-15
|
|
||||||
description: Array.prototype.reduce - 'length' is property of the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
|
||||||
return (obj.length === 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 12;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 9;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
assert.sameValue(Array.prototype.reduce.call(this, callbackfn, 1), true, 'Array.prototype.reduce.call(this, callbackfn, 1)');
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.21-8-b-iii-1-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.reduce - This object is the global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var testResult = false;
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
|
||||||
if (idx === 1) {
|
|
||||||
testResult = (prevVal === 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 0;
|
|
||||||
this[1] = 1;
|
|
||||||
this[2] = 2;
|
|
||||||
this.length = 3;
|
|
||||||
|
|
||||||
Array.prototype.reduce.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert(testResult, 'testResult !== true');
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.21-9-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.reduce - This object is the global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var testResult = false;
|
|
||||||
var initialValue = 0;
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
|
||||||
if (idx === 1) {
|
|
||||||
testResult = (curVal === 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 0;
|
|
||||||
this[1] = 1;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
Array.prototype.reduce.call(this, callbackfn, initialValue);
|
|
||||||
|
|
||||||
assert(testResult, 'testResult !== true');
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.22-2-15
|
|
||||||
description: >
|
|
||||||
Array.prototype.reduceRight - 'length' is property of the global
|
|
||||||
object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var global = this;
|
|
||||||
var accessed = false;
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
|
||||||
accessed = true;
|
|
||||||
return obj.length === global.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 12;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 9;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
assert(Array.prototype.reduceRight.call(this, callbackfn, 111), 'Array.prototype.reduceRight.call(this, callbackfn, 111) !== true');
|
|
||||||
assert(accessed, 'accessed !== true');
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.22-8-b-iii-1-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.reduceRight - This object is the global object
|
|
||||||
which contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var testResult = false;
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
|
||||||
if (idx === 1) {
|
|
||||||
testResult = (prevVal === 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 0;
|
|
||||||
this[1] = 1;
|
|
||||||
this[2] = 2;
|
|
||||||
this.length = 3;
|
|
||||||
|
|
||||||
Array.prototype.reduceRight.call(this, callbackfn);
|
|
||||||
|
|
||||||
assert(testResult, 'testResult !== true');
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.22-9-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.reduceRight - This object is an global object
|
|
||||||
which contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var testResult = false;
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
|
||||||
if (idx === 1) {
|
|
||||||
testResult = (curVal === 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 0;
|
|
||||||
this[1] = 1;
|
|
||||||
this[2] = 2;
|
|
||||||
this.length = 3;
|
|
||||||
|
|
||||||
Array.prototype.reduceRight.call(this, callbackfn, "initialValue");
|
|
||||||
|
|
||||||
assert(testResult, 'testResult !== true');
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.17-2-15
|
|
||||||
description: Array.prototype.some - 'length' is property of the global object
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn1(val, idx, obj) {
|
|
||||||
return val > 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
function callbackfn2(val, idx, obj) {
|
|
||||||
return val > 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 9;
|
|
||||||
this[1] = 11;
|
|
||||||
this[2] = 12;
|
|
||||||
this.length = 2;
|
|
||||||
|
|
||||||
assert(Array.prototype.some.call(this, callbackfn1), 'Array.prototype.some.call(this, callbackfn1) !== true');
|
|
||||||
assert.sameValue(Array.prototype.some.call(this, callbackfn2), false, 'Array.prototype.some.call(this, callbackfn2)');
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
es5id: 15.4.4.17-7-c-i-23
|
|
||||||
description: >
|
|
||||||
Array.prototype.some - This object is an global object which
|
|
||||||
contains index property
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
|
||||||
if (idx === 0) {
|
|
||||||
return val === 11;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this[0] = 11;
|
|
||||||
this.length = 1;
|
|
||||||
|
|
||||||
assert(Array.prototype.some.call(this, callbackfn), 'Array.prototype.some.call(this, callbackfn) !== true');
|
|
Loading…
Reference in New Issue