diff --git a/test/built-ins/GeneratorPrototype/next/context-constructor-invocation.js b/test/built-ins/GeneratorPrototype/next/context-constructor-invocation.js deleted file mode 100644 index 1c5643cdd2aac024c3e3f141eee1d3b1b3df891a..0000000000000000000000000000000000000000 --- a/test/built-ins/GeneratorPrototype/next/context-constructor-invocation.js +++ /dev/null @@ -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(); -}); diff --git a/test/built-ins/Promise/all/species-get-error.js b/test/built-ins/Promise/all/species-get-error.js index 2deb108382a68d3a9f43cf5f2a1dbe22a5e2b293..0ddf88dde2d1651c2c10c5717620cdbe048a86c6 100644 --- a/test/built-ins/Promise/all/species-get-error.js +++ b/test/built-ins/Promise/all/species-get-error.js @@ -3,23 +3,23 @@ /*--- 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 info: > 1. Let C be the this value. 2. If Type(C) is not Object, throw a TypeError exception. - 3. Let S be Get(C, @@species). - 4. ReturnIfAbrupt(S). + 3. Let promiseCapability be ? NewPromiseCapability(C). + ... features: [Symbol.species] ---*/ -var C = {}; +function C(executor) { + executor(function(){}, function(){}); +} Object.defineProperty(C, Symbol.species, { get: function() { - throw new Test262Error(); + $ERROR("Getter for Symbol.species called"); } }); -assert.throws(Test262Error, function() { - Promise.all.call(C); -}); +Promise.all.call(C, []); diff --git a/test/built-ins/Promise/race/species-get-error.js b/test/built-ins/Promise/race/species-get-error.js index 78b01acf1579a74c50e9ebf14819bd354b30d750..975021b04a9c8d4bea416abc6e56cd9f3b04ed9f 100644 --- a/test/built-ins/Promise/race/species-get-error.js +++ b/test/built-ins/Promise/race/species-get-error.js @@ -3,23 +3,23 @@ /*--- 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 info: > 1. Let C be the this value. 2. If Type(C) is not Object, throw a TypeError exception. - 3. Let S be Get(C, @@species). - 4. ReturnIfAbrupt(S). + 3. Let promiseCapability be ? NewPromiseCapability(C). + ... features: [Symbol.species] ---*/ -var C = {}; +function C(executor) { + executor(function(){}, function(){}); +} Object.defineProperty(C, Symbol.species, { get: function() { - throw new Test262Error(); + $ERROR("Getter for Symbol.species called"); } }); -assert.throws(Test262Error, function() { - Promise.race.call(C); -}); +Promise.race.call(C, []); diff --git a/test/built-ins/RegExp/prototype/Symbol.split/coerce-limit.js b/test/built-ins/RegExp/prototype/Symbol.split/coerce-limit.js index db9236ecceb72909d8761c6e78d940809b28026e..7686827116f1cb913b0b58a5c8eba0e14e208ab5 100644 --- a/test/built-ins/RegExp/prototype/Symbol.split/coerce-limit.js +++ b/test/built-ins/RegExp/prototype/Symbol.split/coerce-limit.js @@ -6,17 +6,17 @@ es6id: 21.2.5.11 description: Length coercion of `limit` argument info: > [...] - 17. If limit is undefined, let lim be 253–1; else let lim be - ToLength(limit). + 17. If limit is undefined, let lim be 2^32-1; else let lim be ? ToUint32(limit). [...] features: [Symbol.split] ---*/ var result; +// ToUint32(-23) = 4294967273 result = /./[Symbol.split]('abc', -23); assert(Array.isArray(result)); -assert.sameValue(result.length, 0); +assert.sameValue(result.length, 4); result = /./[Symbol.split]('abc', 1.9); assert(Array.isArray(result)); diff --git a/test/language/expressions/generators/has-instance.js b/test/language/expressions/generators/has-instance.js index f4f8806eb9519527c4d9326dd917179e219057da..b49d7c44c49157e013b69ca99dd3dabfe0f4f082 100644 --- a/test/language/expressions/generators/has-instance.js +++ b/test/language/expressions/generators/has-instance.js @@ -10,4 +10,3 @@ es6id: 25.3 var g = function*() {}; assert(g() instanceof g, 'Instance created via function invocation'); -assert(new g() instanceof g, 'Instance created via constructor invocation'); diff --git a/test/language/expressions/generators/invoke-as-constructor.js b/test/language/expressions/generators/invoke-as-constructor.js new file mode 100755 index 0000000000000000000000000000000000000000..ada8990b1b87f83c0c2a6e4baf3496492ec0a646 --- /dev/null +++ b/test/language/expressions/generators/invoke-as-constructor.js @@ -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(); +}); diff --git a/test/language/expressions/generators/prototype-value.js b/test/language/expressions/generators/prototype-value.js index 0d5066bca285f412af5c6cb6a57cc0ba514c7edf..2a0055de7a5bc906c7fd33ec86b7b21c81b441d6 100644 --- a/test/language/expressions/generators/prototype-value.js +++ b/test/language/expressions/generators/prototype-value.js @@ -16,8 +16,3 @@ assert.sameValue( g.prototype, 'Instance created via function invocation' ); -assert.sameValue( - Object.getPrototypeOf(new g()), - g.prototype, - 'Instance created via constructor invocation' -); diff --git a/test/language/expressions/object/method-definition/generator-invoke-ctor.js b/test/language/expressions/object/method-definition/generator-invoke-ctor.js index 6bbe5d855b4f156d28ed8bf5e5792f285b6c8f36..467c2572d9bff6b0b4d15a3212b7af7b2a67880a 100644 --- a/test/language/expressions/object/method-definition/generator-invoke-ctor.js +++ b/test/language/expressions/object/method-definition/generator-invoke-ctor.js @@ -3,13 +3,13 @@ /*--- 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 features: [generators] ---*/ var method = { *method() {} }.method; -var instance = new method(); - -assert.sameValue(instance instanceof method, true); +assert.throws(TypeError, function() { + var instance = new method(); +}); diff --git a/test/language/statements/generators/has-instance.js b/test/language/statements/generators/has-instance.js index ddf9d239a59940375180971841f732d083334bc0..83b03f4888318bc632e0923704ddca4b363314e3 100644 --- a/test/language/statements/generators/has-instance.js +++ b/test/language/statements/generators/has-instance.js @@ -10,4 +10,3 @@ es6id: 25.3 function* g() {} assert(g() instanceof g, 'Instance created via function invocation'); -assert(new g() instanceof g, 'Instance created via constructor invocation'); diff --git a/test/language/statements/generators/invoke-as-constructor.js b/test/language/statements/generators/invoke-as-constructor.js new file mode 100755 index 0000000000000000000000000000000000000000..8252e70fbb54bcff7ad74e0f4b7578c2da2fc7e8 --- /dev/null +++ b/test/language/statements/generators/invoke-as-constructor.js @@ -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(); +}); diff --git a/test/language/statements/generators/prototype-value.js b/test/language/statements/generators/prototype-value.js index c74f8ccad0e5c81c297785c0ea4b6296d012828d..feadf6d4e03af8d4abec06d8bb15e4832de5c92c 100644 --- a/test/language/statements/generators/prototype-value.js +++ b/test/language/statements/generators/prototype-value.js @@ -16,8 +16,3 @@ assert.sameValue( g.prototype, 'Instance created via function invocation' ); -assert.sameValue( - Object.getPrototypeOf(new g()), - g.prototype, - 'Instance created via constructor invocation' -);