mirror of https://github.com/tc39/test262.git
Updates for ES2016 Draft 2015-12-01
- RegExp.prototype[Symbol.split] calls ToUint32 (https://github.com/tc39/ecma262/issues/92) - Species lookup removed from Promise.all and Promise.race (https://github.com/tc39/ecma262/issues/151) - Generator functions are no longer constructors (https://github.com/tc39/ecma262/pull/171) Fixes #444
This commit is contained in:
parent
fd44cd73df
commit
bd8c91e250
|
@ -1,16 +0,0 @@
|
||||||
// Copyright (C) 2013 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 25.2
|
|
||||||
description: >
|
|
||||||
If the generator was invoked using [[Construct]], the this bind is not
|
|
||||||
initialized and any references to `this` within the FunctionBody will
|
|
||||||
produce a ReferenceError exception.
|
|
||||||
---*/
|
|
||||||
|
|
||||||
function* g() { this; }
|
|
||||||
var iter = new g();
|
|
||||||
|
|
||||||
assert.throws(ReferenceError, function() {
|
|
||||||
iter.next();
|
|
||||||
});
|
|
|
@ -3,23 +3,23 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Error thrown when retrieving `Symbol.species` property of the `this` value
|
Promise.all() does not retrieve `Symbol.species` property of the `this` value
|
||||||
es6id: 25.4.4.1
|
es6id: 25.4.4.1
|
||||||
info: >
|
info: >
|
||||||
1. Let C be the this value.
|
1. Let C be the this value.
|
||||||
2. If Type(C) is not Object, throw a TypeError exception.
|
2. If Type(C) is not Object, throw a TypeError exception.
|
||||||
3. Let S be Get(C, @@species).
|
3. Let promiseCapability be ? NewPromiseCapability(C).
|
||||||
4. ReturnIfAbrupt(S).
|
...
|
||||||
features: [Symbol.species]
|
features: [Symbol.species]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var C = {};
|
function C(executor) {
|
||||||
|
executor(function(){}, function(){});
|
||||||
|
}
|
||||||
Object.defineProperty(C, Symbol.species, {
|
Object.defineProperty(C, Symbol.species, {
|
||||||
get: function() {
|
get: function() {
|
||||||
throw new Test262Error();
|
$ERROR("Getter for Symbol.species called");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
Promise.all.call(C, []);
|
||||||
Promise.all.call(C);
|
|
||||||
});
|
|
||||||
|
|
|
@ -3,23 +3,23 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Error thrown when retrieving `Symbol.species` property of the `this` value
|
Promise.race() does not retrieve `Symbol.species` property of the `this` value
|
||||||
es6id: 25.4.4.3
|
es6id: 25.4.4.3
|
||||||
info: >
|
info: >
|
||||||
1. Let C be the this value.
|
1. Let C be the this value.
|
||||||
2. If Type(C) is not Object, throw a TypeError exception.
|
2. If Type(C) is not Object, throw a TypeError exception.
|
||||||
3. Let S be Get(C, @@species).
|
3. Let promiseCapability be ? NewPromiseCapability(C).
|
||||||
4. ReturnIfAbrupt(S).
|
...
|
||||||
features: [Symbol.species]
|
features: [Symbol.species]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var C = {};
|
function C(executor) {
|
||||||
|
executor(function(){}, function(){});
|
||||||
|
}
|
||||||
Object.defineProperty(C, Symbol.species, {
|
Object.defineProperty(C, Symbol.species, {
|
||||||
get: function() {
|
get: function() {
|
||||||
throw new Test262Error();
|
$ERROR("Getter for Symbol.species called");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
Promise.race.call(C, []);
|
||||||
Promise.race.call(C);
|
|
||||||
});
|
|
||||||
|
|
|
@ -6,17 +6,17 @@ es6id: 21.2.5.11
|
||||||
description: Length coercion of `limit` argument
|
description: Length coercion of `limit` argument
|
||||||
info: >
|
info: >
|
||||||
[...]
|
[...]
|
||||||
17. If limit is undefined, let lim be 253–1; else let lim be
|
17. If limit is undefined, let lim be 2^32-1; else let lim be ? ToUint32(limit).
|
||||||
ToLength(limit).
|
|
||||||
[...]
|
[...]
|
||||||
features: [Symbol.split]
|
features: [Symbol.split]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var result;
|
var result;
|
||||||
|
|
||||||
|
// ToUint32(-23) = 4294967273
|
||||||
result = /./[Symbol.split]('abc', -23);
|
result = /./[Symbol.split]('abc', -23);
|
||||||
assert(Array.isArray(result));
|
assert(Array.isArray(result));
|
||||||
assert.sameValue(result.length, 0);
|
assert.sameValue(result.length, 4);
|
||||||
|
|
||||||
result = /./[Symbol.split]('abc', 1.9);
|
result = /./[Symbol.split]('abc', 1.9);
|
||||||
assert(Array.isArray(result));
|
assert(Array.isArray(result));
|
||||||
|
|
|
@ -10,4 +10,3 @@ es6id: 25.3
|
||||||
var g = function*() {};
|
var g = function*() {};
|
||||||
|
|
||||||
assert(g() instanceof g, 'Instance created via function invocation');
|
assert(g() instanceof g, 'Instance created via function invocation');
|
||||||
assert(new g() instanceof g, 'Instance created via constructor invocation');
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Generator expressions cannot be used as constructors.
|
||||||
|
es6id: 14.4
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var g = function*(){};
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var instance = new g();
|
||||||
|
});
|
|
@ -16,8 +16,3 @@ assert.sameValue(
|
||||||
g.prototype,
|
g.prototype,
|
||||||
'Instance created via function invocation'
|
'Instance created via function invocation'
|
||||||
);
|
);
|
||||||
assert.sameValue(
|
|
||||||
Object.getPrototypeOf(new g()),
|
|
||||||
g.prototype,
|
|
||||||
'Instance created via constructor invocation'
|
|
||||||
);
|
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
Generator functions declared as methods may be used as constructors.
|
Generator functions declared as methods cannot be used as constructors.
|
||||||
es6id: 14.4.13
|
es6id: 14.4.13
|
||||||
features: [generators]
|
features: [generators]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var method = { *method() {} }.method;
|
var method = { *method() {} }.method;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
var instance = new method();
|
var instance = new method();
|
||||||
|
});
|
||||||
assert.sameValue(instance instanceof method, true);
|
|
||||||
|
|
|
@ -10,4 +10,3 @@ es6id: 25.3
|
||||||
function* g() {}
|
function* g() {}
|
||||||
|
|
||||||
assert(g() instanceof g, 'Instance created via function invocation');
|
assert(g() instanceof g, 'Instance created via function invocation');
|
||||||
assert(new g() instanceof g, 'Instance created via constructor invocation');
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Generator statements cannot be used as constructors.
|
||||||
|
es6id: 14.4
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g(){}
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var instance = new g();
|
||||||
|
});
|
|
@ -16,8 +16,3 @@ assert.sameValue(
|
||||||
g.prototype,
|
g.prototype,
|
||||||
'Instance created via function invocation'
|
'Instance created via function invocation'
|
||||||
);
|
);
|
||||||
assert.sameValue(
|
|
||||||
Object.getPrototypeOf(new g()),
|
|
||||||
g.prototype,
|
|
||||||
'Instance created via constructor invocation'
|
|
||||||
);
|
|
||||||
|
|
Loading…
Reference in New Issue