mirror of
https://github.com/tc39/test262.git
synced 2025-07-30 17:34:51 +02:00
Remove duplicated constructor tests
A number of tests were found to be duplicative based on an analysis of file contents (included below). Eliminate the duplication by removing the version of each test with less precise metadata. In cases where this removal could technically be considered a reduction in coverage, preserve the verification of additional semantics in the remaining test. $ git grep -El 'new\s+\w+.prototype' | sed 's/[^\/]\+$//g' | sort | uniq -c | grep -vE '^\s+1 ' | awk '{print $2}' | xargs grep -Elr 'new\s+\w+.prototype' test/built-ins/Array/prototype/join/S15.4.4.5_A6.7.js test/built-ins/Array/prototype/join/not-a-constructor.js test/built-ins/Array/prototype/pop/not-a-constructor.js test/built-ins/Array/prototype/pop/S15.4.4.6_A5.7.js test/built-ins/Array/prototype/push/S15.4.4.7_A6.7.js test/built-ins/Array/prototype/push/not-a-constructor.js test/built-ins/Array/prototype/shift/not-a-constructor.js test/built-ins/Array/prototype/shift/S15.4.4.9_A5.7.js test/built-ins/Array/prototype/slice/not-a-constructor.js test/built-ins/Array/prototype/slice/S15.4.4.10_A5.7.js test/built-ins/Array/prototype/sort/not-a-constructor.js test/built-ins/Array/prototype/sort/S15.4.4.11_A7.7.js test/built-ins/Array/prototype/splice/S15.4.4.12_A5.7.js test/built-ins/Array/prototype/splice/not-a-constructor.js test/built-ins/Array/prototype/toLocaleString/S15.4.4.3_A4.7.js test/built-ins/Array/prototype/toLocaleString/not-a-constructor.js test/built-ins/Array/prototype/toString/S15.4.4.2_A4.7.js test/built-ins/Array/prototype/toString/not-a-constructor.js test/built-ins/Array/prototype/unshift/S15.4.4.13_A5.7.js test/built-ins/Array/prototype/unshift/not-a-constructor.js test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js test/built-ins/Function/prototype/apply/not-a-constructor.js test/built-ins/Function/prototype/call/not-a-constructor.js test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js test/built-ins/Function/prototype/toString/not-a-constructor.js test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js test/built-ins/Object/prototype/hasOwnProperty/not-a-constructor.js test/built-ins/Object/prototype/propertyIsEnumerable/not-a-constructor.js test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js test/built-ins/Object/prototype/toLocaleString/not-a-constructor.js test/built-ins/Object/prototype/toString/not-a-constructor.js test/built-ins/Object/prototype/toString/not-ctor.js test/built-ins/Object/prototype/valueOf/not-a-constructor.js test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js
This commit is contained in:
parent
6c2884eb9e
commit
6d5975defc
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The join property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.join
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.join();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The pop property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.pop
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.pop();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The push property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.push
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.push();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The shift property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.shift
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.shift();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The slice property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.slice
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.slice();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The sort property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.sort
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.sort();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The splice property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.splice
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.splice();
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.tolocalestring
|
||||
info: The toLocaleString property of Array can't be used as constructor
|
||||
es5id: 15.4.4.3_A4.7
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.toLocaleString();
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.tostring
|
||||
info: The toString property of Array can't be used as constructor
|
||||
es5id: 15.4.4.2_A4.7
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.toString();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The unshift property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.unshift
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.unshift();
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Function.prototype.apply can`t be used as [[Construct]] caller
|
||||
es5id: 15.3.4.3_A8_T1
|
||||
description: Checking if creating "new Function.prototype.apply" fails
|
||||
---*/
|
||||
|
||||
try {
|
||||
var obj = new Function.prototype.apply;
|
||||
throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller');
|
||||
} catch (e) {
|
||||
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Function.prototype.apply can`t be used as [[Construct]] caller
|
||||
es5id: 15.3.4.3_A8_T2
|
||||
description: Checking if creating "new Function.prototype.apply()" fails
|
||||
---*/
|
||||
|
||||
try {
|
||||
var obj = new Function.prototype.apply();
|
||||
throw new Test262Error('#1: Function.prototype.apply can\'t be used as [[Construct]] caller');
|
||||
} catch (e) {
|
||||
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
|
||||
}
|
@ -27,7 +27,10 @@ assert.sameValue(
|
||||
'isConstructor(Function.prototype.apply) must return false'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Function.prototype.apply;
|
||||
}, '`new Function.prototype.apply` throws TypeError');
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Function.prototype.apply();
|
||||
}, '`new Function.prototype.apply()` throws TypeError');
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Function.prototype.call can't be used as [[Construct]] caller
|
||||
es5id: 15.3.4.4_A7_T1
|
||||
description: Checking if creating "new Function.prototype.call" fails
|
||||
---*/
|
||||
|
||||
try {
|
||||
var obj = new Function.prototype.call;
|
||||
throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller');
|
||||
} catch (e) {
|
||||
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Function.prototype.call can't be used as [[Construct]] caller
|
||||
es5id: 15.3.4.4_A7_T2
|
||||
description: Checking if creating "new Function.prototype.call()" fails
|
||||
---*/
|
||||
|
||||
try {
|
||||
var FACTORY = Function.prototype.call;
|
||||
var obj = new FACTORY();
|
||||
throw new Test262Error('#1: Function.prototype.call can\'t be used as [[Construct]] caller');
|
||||
} catch (e) {
|
||||
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
|
||||
}
|
@ -31,3 +31,11 @@ assert.throws(TypeError, () => {
|
||||
new Function.prototype.call();
|
||||
}, '`new Function.prototype.call()` throws TypeError');
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Function.prototype.call;
|
||||
}, '`new Function.prototype.call` throws TypeError');
|
||||
|
||||
var call = Function.prototype.call;
|
||||
assert.throws(TypeError, () => {
|
||||
new call;
|
||||
}, '`new call()` throws TypeError');
|
||||
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Function.prototype.toString can't be used as constructor
|
||||
es5id: 15.3.4.2_A7
|
||||
description: Checking if creating "new Function.prototype.toString" fails
|
||||
---*/
|
||||
|
||||
var FACTORY = Function.prototype.toString;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new FACTORY;
|
||||
}, '`new FACTORY` throws a TypeError exception');
|
@ -31,3 +31,7 @@ assert.throws(TypeError, () => {
|
||||
new Function.prototype.toString();
|
||||
}, '`new Function.prototype.toString()` throws TypeError');
|
||||
|
||||
var toString = Function.prototype.toString;
|
||||
assert.throws(TypeError, () => {
|
||||
new toString;
|
||||
}, '`new toString` throws TypeError');
|
||||
|
@ -1,12 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Object.prototype.hasOwnProperty can't be used as a constructor
|
||||
es5id: 15.2.4.5_A7
|
||||
description: Checking if creating "new Object.prototype.hasOwnProperty" fails
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Object.prototype.hasOwnProperty();
|
||||
}, '`new Object.prototype.hasOwnProperty()` throws a TypeError exception');
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Object.prototype.propertyIsEnumerable can't be used as a constructor
|
||||
es5id: 15.2.4.7_A7
|
||||
description: >
|
||||
Checking if creating "new Object.prototype.propertyIsEnumerable"
|
||||
fails
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Object.prototype.propertyIsEnumerable();
|
||||
}, '`new Object.prototype.propertyIsEnumerable()` throws a TypeError exception');
|
@ -1,12 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Object.prototype.toLocaleString can't be used as a constructor
|
||||
es5id: 15.2.4.3_A7
|
||||
description: Checking if creating "new Object.prototype.toLocaleString" fails
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Object.prototype.toLocaleString();
|
||||
}, '`new Object.prototype.toLocaleString()` throws a TypeError exception');
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-ecmascript-standard-built-in-objects
|
||||
description: Object.prototype.toString is not a constructor
|
||||
info: |
|
||||
Built-in function objects that are not identified as constructors do
|
||||
not implement the [[Construct]] internal method unless otherwise specified
|
||||
in the description of a particular function
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Object.prototype.toString();
|
||||
});
|
@ -1,12 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Object.prototype.valueOf can't be used as a constructor
|
||||
es5id: 15.2.4.4_A7
|
||||
description: Checking if creating "new Object.prototype.valueOf" fails
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Object.prototype.valueOf();
|
||||
}, '`new Object.prototype.valueOf()` throws a TypeError exception');
|
Loading…
x
Reference in New Issue
Block a user