mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 15:34:29 +02:00
use isConstructor
assertion in "non-constructor" tests
This commit is contained in:
parent
7f2668f807
commit
28b31c0bf1
@ -18,9 +18,16 @@ info: |
|
|||||||
b. If C is null, let C be undefined.
|
b. If C is null, let C be undefined.
|
||||||
[...]
|
[...]
|
||||||
9. If IsConstructor(C) is false, throw a TypeError exception.
|
9. If IsConstructor(C) is false, throw a TypeError exception.
|
||||||
features: [Symbol.species]
|
includes: [isConstructor.js]
|
||||||
|
features: [Symbol.species, Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(parseInt),
|
||||||
|
false,
|
||||||
|
'precondition: isConstructor(parseInt) must return false'
|
||||||
|
);
|
||||||
|
|
||||||
var a = [];
|
var a = [];
|
||||||
|
|
||||||
a.constructor = {};
|
a.constructor = {};
|
||||||
|
@ -19,9 +19,16 @@ info: |
|
|||||||
b. If C is null, let C be undefined.
|
b. If C is null, let C be undefined.
|
||||||
[...]
|
[...]
|
||||||
9. If IsConstructor(C) is false, throw a TypeError exception.
|
9. If IsConstructor(C) is false, throw a TypeError exception.
|
||||||
features: [Symbol.species]
|
includes: [isConstructor.js]
|
||||||
|
features: [Symbol.species, Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(parseInt),
|
||||||
|
false,
|
||||||
|
'precondition: isConstructor(parseInt) must return false'
|
||||||
|
);
|
||||||
|
|
||||||
var a = [];
|
var a = [];
|
||||||
var callCount = 0;
|
var callCount = 0;
|
||||||
var cb = function() {
|
var cb = function() {
|
||||||
@ -33,5 +40,5 @@ a.constructor[Symbol.species] = parseInt;
|
|||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
a.filter(cb);
|
a.filter(cb);
|
||||||
});
|
}, 'a.filter(cb) throws a TypeError exception');
|
||||||
assert.sameValue(callCount, 0);
|
assert.sameValue(callCount, 0);
|
||||||
|
@ -19,9 +19,16 @@ info: |
|
|||||||
b. If C is null, let C be undefined.
|
b. If C is null, let C be undefined.
|
||||||
[...]
|
[...]
|
||||||
9. If IsConstructor(C) is false, throw a TypeError exception.
|
9. If IsConstructor(C) is false, throw a TypeError exception.
|
||||||
features: [Symbol.species]
|
includes: [isConstructor.js]
|
||||||
|
features: [Symbol.species, Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(parseInt),
|
||||||
|
false,
|
||||||
|
'precondition: isConstructor(parseInt) must return false'
|
||||||
|
);
|
||||||
|
|
||||||
var a = [];
|
var a = [];
|
||||||
var callCount = 0;
|
var callCount = 0;
|
||||||
var cb = function() {
|
var cb = function() {
|
||||||
@ -33,5 +40,5 @@ a.constructor[Symbol.species] = parseInt;
|
|||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
a.map(cb);
|
a.map(cb);
|
||||||
});
|
}, 'a.map(cb) throws a TypeError exception');
|
||||||
assert.sameValue(callCount, 0);
|
assert.sameValue(callCount, 0);
|
||||||
|
@ -19,9 +19,16 @@ info: |
|
|||||||
b. If C is null, let C be undefined.
|
b. If C is null, let C be undefined.
|
||||||
[...]
|
[...]
|
||||||
9. If IsConstructor(C) is false, throw a TypeError exception.
|
9. If IsConstructor(C) is false, throw a TypeError exception.
|
||||||
features: [Symbol.species]
|
includes: [isConstructor.js]
|
||||||
|
features: [Symbol.species, Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(parseInt),
|
||||||
|
false,
|
||||||
|
'precondition: isConstructor(parseInt) must return false'
|
||||||
|
);
|
||||||
|
|
||||||
var a = [];
|
var a = [];
|
||||||
|
|
||||||
a.constructor = {};
|
a.constructor = {};
|
||||||
@ -29,4 +36,4 @@ a.constructor[Symbol.species] = parseInt;
|
|||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
a.slice();
|
a.slice();
|
||||||
});
|
}, 'a.slice() throws a TypeError exception');
|
||||||
|
@ -19,9 +19,16 @@ info: |
|
|||||||
b. If C is null, let C be undefined.
|
b. If C is null, let C be undefined.
|
||||||
[...]
|
[...]
|
||||||
9. If IsConstructor(C) is false, throw a TypeError exception.
|
9. If IsConstructor(C) is false, throw a TypeError exception.
|
||||||
features: [Symbol.species]
|
includes: [isConstructor.js]
|
||||||
|
features: [Symbol.species, Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(parseInt),
|
||||||
|
false,
|
||||||
|
'precondition: isConstructor(parseInt) must return false'
|
||||||
|
);
|
||||||
|
|
||||||
var a = [];
|
var a = [];
|
||||||
|
|
||||||
a.constructor = {};
|
a.constructor = {};
|
||||||
@ -29,4 +36,4 @@ a.constructor[Symbol.species] = parseInt;
|
|||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
a.splice();
|
a.splice();
|
||||||
});
|
}, 'a.splice() throws a TypeError exception');
|
||||||
|
@ -5,9 +5,17 @@
|
|||||||
info: RegExp.prototype.toString has not prototype property
|
info: RegExp.prototype.toString has not prototype property
|
||||||
es5id: 15.10.6.4_A6
|
es5id: 15.10.6.4_A6
|
||||||
description: Checking RegExp.prototype.toString.prototype
|
description: Checking RegExp.prototype.toString.prototype
|
||||||
|
includes: [isConstructor.js]
|
||||||
|
features: [Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
RegExp.prototype.toString.prototype,
|
RegExp.prototype.toString.prototype,
|
||||||
undefined,
|
undefined,
|
||||||
'The value of RegExp.prototype.toString.prototype is expected to equal undefined'
|
'The value of RegExp.prototype.toString.prototype is expected to equal undefined'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(RegExp.prototype.toString),
|
||||||
|
false,
|
||||||
|
'isConstructor(RegExp.prototype.toString) must return false'
|
||||||
|
);
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
info: RegExp.prototype.toString can't be used as constructor
|
info: RegExp.prototype.toString can't be used as constructor
|
||||||
es5id: 15.10.6.4_A7
|
es5id: 15.10.6.4_A7
|
||||||
description: Checking if creating the RegExp.prototype.toString object fails
|
description: Checking if creating the RegExp.prototype.toString object fails
|
||||||
|
includes: [isConstructor.js]
|
||||||
|
features: [Reflect.construct]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var __FACTORY = RegExp.prototype.toString;
|
var __FACTORY = RegExp.prototype.toString;
|
||||||
@ -20,4 +22,10 @@ try {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
isConstructor(RegExp.prototype.toString),
|
||||||
|
false,
|
||||||
|
'isConstructor(RegExp.prototype.toString) must return false'
|
||||||
|
);
|
||||||
|
|
||||||
// TODO: Convert to assert.throws() format.
|
// TODO: Convert to assert.throws() format.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user