Generate tests

This commit is contained in:
Leonardo Balter 2017-03-16 15:54:24 -04:00 committed by Leo Balter
parent 76001a503f
commit 74b07de387
No known key found for this signature in database
GPG Key ID: 2C75F319D398E36B
48 changed files with 1096 additions and 88 deletions

View File

@ -0,0 +1,50 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/class-expr-static-method.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static generator method as a ClassExpression element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
var C = class { static *gen() {
callCount += 1;
return {
...(function() {
var yield;
throw new Test262Error();
}()),
}
}}
var gen = C.gen;
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/class-expr-static-method.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static generator method as a ClassExpression element)
esid: prod-GeneratorMethod
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
var C = class { static *gen() {
callCount += 1;
(function() {
var yield;
throw new Test262Error();
}())
}}
var gen = C.gen;
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,48 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/class-expr-static-method.template
/*---
description: Use yield value in a array spread position (Static generator method as a ClassExpression element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var item;
var callCount = 0;
var C = class { static *gen() {
callCount += 1;
yield [...yield yield];
}}
var gen = C.gen;
var iter = gen();
iter.next(false);
item = iter.next(['a', 'b', 'c']);
item = iter.next(item.value);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/class-expr-static-method.template
/*---
description: Use yield value in a array spread position (Static generator method as a ClassExpression element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var callCount = 0;
var C = class { static *gen() {
callCount += 1;
yield [...yield];
}}
var gen = C.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/class-expr-static-method.template
/*---
description: Use yield value in a object spread position (Static generator method as a ClassExpression element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
var C = class { static *gen() {
callCount += 1;
yield {
...yield,
y: 1,
...yield yield,
};
}}
var gen = C.gen;
var iter = gen();
iter.next();
iter.next({ x: 42 });
iter.next({ x: 'lol' });
var item = iter.next({ y: 39 });
assert.sameValue(item.value.x, 42);
assert.sameValue(item.value.y, 39);
assert.sameValue(Object.keys(item.value).length, 2);
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -1,8 +1,8 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/class-method-definition.template
// - src/generators/default/class-expr-method.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method as a ClassElement)
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method as a ClassExpression element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated, onlyStrict]
@ -10,16 +10,16 @@ negative:
phase: early
type: SyntaxError
info: |
ClassElement[Yield, Await]:
MethodDefinition[?Yield, ?Await]
ClassElement :
MethodDefinition
MethodDefinition[Yield, Await]:
GeneratorMethod[?Yield, ?Await]
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
@ -31,7 +31,7 @@ info: |
var callCount = 0;
class C { *gen() {
var C = class {*gen() {
callCount += 1;
return {
...(function() {

View File

@ -1,29 +1,29 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/class-method-definition.template
// - src/generators/default/class-expr-method.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method as a ClassElement)
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method as a ClassExpression element)
esid: prod-GeneratorMethod
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement[Yield, Await]:
MethodDefinition[?Yield, ?Await]
ClassElement :
MethodDefinition
MethodDefinition[Yield, Await]:
GeneratorMethod[?Yield, ?Await]
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
class C { *gen() {
var C = class {*gen() {
callCount += 1;
(function() {
var yield;

View File

@ -1,22 +1,22 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/class-method-definition.template
// - src/generators/default/class-expr-method.template
/*---
description: Use yield value in a array spread position (Generator method as a ClassElement)
description: Use yield value in a array spread position (Generator method as a ClassExpression element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement[Yield, Await]:
MethodDefinition[?Yield, ?Await]
ClassElement :
MethodDefinition
MethodDefinition[Yield, Await]:
GeneratorMethod[?Yield, ?Await]
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
@ -29,7 +29,7 @@ var item;
var callCount = 0;
class C { *gen() {
var C = class {*gen() {
callCount += 1;
yield [...yield yield];
}}

View File

@ -1,22 +1,22 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/class-method-definition.template
// - src/generators/default/class-expr-method.template
/*---
description: Use yield value in a array spread position (Generator method as a ClassElement)
description: Use yield value in a array spread position (Generator method as a ClassExpression element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement[Yield, Await]:
MethodDefinition[?Yield, ?Await]
ClassElement :
MethodDefinition
MethodDefinition[Yield, Await]:
GeneratorMethod[?Yield, ?Await]
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
@ -28,7 +28,7 @@ var arr = ['a', 'b', 'c'];
var callCount = 0;
class C { *gen() {
var C = class {*gen() {
callCount += 1;
yield [...yield];
}}

View File

@ -1,23 +1,23 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/class-method-definition.template
// - src/generators/default/class-expr-method.template
/*---
description: Use yield value in a object spread position (Generator method as a ClassElement)
description: Use yield value in a object spread position (Generator method as a ClassExpression element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement[Yield, Await]:
MethodDefinition[?Yield, ?Await]
ClassElement :
MethodDefinition
MethodDefinition[Yield, Await]:
GeneratorMethod[?Yield, ?Await]
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
@ -29,7 +29,7 @@ info: |
var callCount = 0;
class C { *gen() {
var C = class {*gen() {
callCount += 1;
yield {
...yield,

View File

@ -0,0 +1,37 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-non-strict.case
// - src/generators/non-strict/expression-named.template
/*---
description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator named expression - valid for non-strict only cases)
esid: prod-GeneratorExpression
flags: [generated, noStrict]
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
var gen = function *g() {
callCount += 1;
return (function(arg) {
var yield = arg + 1;
return yield;
}(yield))
};
var iter = gen();
var item = iter.next();
assert.sameValue(item.done, false);
assert.sameValue(item.value, undefined);
item = iter.next(42);
assert.sameValue(item.done, true);
assert.sameValue(item.value, 43);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-non-strict.case
// - src/generators/non-strict/expression-named.template
/*---
description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator named expression - valid for non-strict only cases)
esid: prod-GeneratorExpression
features: [object-spread]
flags: [generated, noStrict]
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
var gen = function *g() {
callCount += 1;
yield {
...yield yield,
...(function(arg) {
var yield = arg;
return {...yield};
}(yield)),
...yield,
}
};
var iter = gen();
var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
var item = iter.next({ z: 30, b: 2 });
assert.sameValue(item.done, false);
assert.sameValue(item.value.x, 10);
assert.sameValue(item.value.y, 20);
assert.sameValue(item.value.z, 30);
assert.sameValue(item.value.a, 1);
assert.sameValue(item.value.b, 2);
assert.sameValue(Object.keys(item.value).length, 5);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/expression-named.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Named generator expression)
esid: prod-GeneratorExpression
features: [object-spread]
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
var gen = function *g() {
callCount += 1;
return {
...(function() {
var yield;
throw new Test262Error();
}()),
}
};
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/expression-named.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Named generator expression)
esid: prod-GeneratorExpression
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
var gen = function *g() {
callCount += 1;
(function() {
var yield;
throw new Test262Error();
}())
};
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/expression-named.template
/*---
description: Use yield value in a array spread position (Named generator expression)
esid: prod-GeneratorExpression
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var item;
var callCount = 0;
var gen = function *g() {
callCount += 1;
yield [...yield yield];
};
var iter = gen();
iter.next(false);
item = iter.next(['a', 'b', 'c']);
item = iter.next(item.value);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/expression-named.template
/*---
description: Use yield value in a array spread position (Named generator expression)
esid: prod-GeneratorExpression
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var callCount = 0;
var gen = function *g() {
callCount += 1;
yield [...yield];
};
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,47 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/expression-named.template
/*---
description: Use yield value in a object spread position (Named generator expression)
esid: prod-GeneratorExpression
features: [object-spread]
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
var gen = function *g() {
callCount += 1;
yield {
...yield,
y: 1,
...yield yield,
};
};
var iter = gen();
iter.next();
iter.next({ x: 42 });
iter.next({ x: 'lol' });
var item = iter.next({ y: 39 });
assert.sameValue(item.value.x, 42);
assert.sameValue(item.value.y, 39);
assert.sameValue(Object.keys(item.value).length, 2);
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -9,7 +9,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View File

@ -10,7 +10,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Spread Properties

View File

@ -2,7 +2,7 @@
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/expression.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator expression)
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Unnamed generator expression)
esid: prod-GeneratorExpression
features: [object-spread]
flags: [generated, onlyStrict]
@ -13,7 +13,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Spread Properties

View File

@ -2,7 +2,7 @@
// - src/generators/yield-identifier-strict.case
// - src/generators/default/expression.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator expression)
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Unnamed generator expression)
esid: prod-GeneratorExpression
flags: [generated, onlyStrict]
negative:
@ -12,7 +12,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View File

@ -2,7 +2,7 @@
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/expression.template
/*---
description: Use yield value in a array spread position (Generator expression)
description: Use yield value in a array spread position (Unnamed generator expression)
esid: prod-GeneratorExpression
flags: [generated]
includes: [compareArray.js]
@ -10,7 +10,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Array Initializer

View File

@ -2,7 +2,7 @@
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/expression.template
/*---
description: Use yield value in a array spread position (Generator expression)
description: Use yield value in a array spread position (Unnamed generator expression)
esid: prod-GeneratorExpression
flags: [generated]
includes: [compareArray.js]
@ -10,7 +10,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Array Initializer

View File

@ -2,7 +2,7 @@
// - src/generators/yield-spread-obj.case
// - src/generators/default/expression.template
/*---
description: Use yield value in a object spread position (Generator expression)
description: Use yield value in a object spread position (Unnamed generator expression)
esid: prod-GeneratorExpression
features: [object-spread]
flags: [generated]
@ -11,7 +11,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
Spread Properties

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-non-strict.case
// - src/generators/non-strict/method-definition.template
// - src/generators/non-strict/obj-method.template
/*---
description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases)
esid: prod-GeneratorMethod
@ -9,7 +9,7 @@ info: |
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-non-strict.case
// - src/generators/non-strict/method-definition.template
// - src/generators/non-strict/obj-method.template
/*---
description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases)
esid: prod-GeneratorMethod
@ -10,7 +10,7 @@ info: |
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/method-definition.template
// - src/generators/default/obj-method.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method)
esid: prod-GeneratorMethod

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/method-definition.template
// - src/generators/default/obj-method.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method)
esid: prod-GeneratorMethod

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/method-definition.template
// - src/generators/default/obj-method.template
/*---
description: Use yield value in a array spread position (Generator method)
esid: prod-GeneratorMethod

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/method-definition.template
// - src/generators/default/obj-method.template
/*---
description: Use yield value in a array spread position (Generator method)
esid: prod-GeneratorMethod

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/method-definition.template
// - src/generators/default/obj-method.template
/*---
description: Use yield value in a object spread position (Generator method)
esid: prod-GeneratorMethod

View File

@ -0,0 +1,50 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/class-decl-static-method.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static generator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
class C {static *gen() {
callCount += 1;
return {
...(function() {
var yield;
throw new Test262Error();
}()),
}
}}
var gen = C.gen;
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/class-decl-static-method.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static generator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
class C {static *gen() {
callCount += 1;
(function() {
var yield;
throw new Test262Error();
}())
}}
var gen = C.gen;
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,48 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/class-decl-static-method.template
/*---
description: Use yield value in a array spread position (Static generator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var item;
var callCount = 0;
class C {static *gen() {
callCount += 1;
yield [...yield yield];
}}
var gen = C.gen;
var iter = gen();
iter.next(false);
item = iter.next(['a', 'b', 'c']);
item = iter.next(item.value);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/class-decl-static-method.template
/*---
description: Use yield value in a array spread position (Static generator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var callCount = 0;
class C {static *gen() {
callCount += 1;
yield [...yield];
}}
var gen = C.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/class-decl-static-method.template
/*---
description: Use yield value in a object spread position (Static generator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
class C {static *gen() {
callCount += 1;
yield {
...yield,
y: 1,
...yield yield,
};
}}
var gen = C.gen;
var iter = gen();
iter.next();
iter.next({ x: 42 });
iter.next({ x: 'lol' });
var item = iter.next({ y: 39 });
assert.sameValue(item.value.x, 42);
assert.sameValue(item.value.y, 39);
assert.sameValue(Object.keys(item.value).length, 2);
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,50 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/class-decl-method.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Geenerator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement :
MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
class C { *gen() {
callCount += 1;
return {
...(function() {
var yield;
throw new Test262Error();
}()),
}
}}
var gen = C.prototype.gen;
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/class-decl-method.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Geenerator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
flags: [generated, onlyStrict]
negative:
phase: early
type: SyntaxError
info: |
ClassElement :
MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
class C { *gen() {
callCount += 1;
(function() {
var yield;
throw new Test262Error();
}())
}}
var gen = C.prototype.gen;
var iter = gen();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,48 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/class-decl-method.template
/*---
description: Use yield value in a array spread position (Geenerator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var item;
var callCount = 0;
class C { *gen() {
callCount += 1;
yield [...yield yield];
}}
var gen = C.prototype.gen;
var iter = gen();
iter.next(false);
item = iter.next(['a', 'b', 'c']);
item = iter.next(item.value);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/class-decl-method.template
/*---
description: Use yield value in a array spread position (Geenerator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var callCount = 0;
class C { *gen() {
callCount += 1;
yield [...yield];
}}
var gen = C.prototype.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/class-decl-method.template
/*---
description: Use yield value in a object spread position (Geenerator method as a ClassDeclaration element)
esid: prod-GeneratorMethod
features: [object-spread]
flags: [generated]
includes: [compareArray.js]
info: |
ClassElement :
MethodDefinition
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
---*/
var callCount = 0;
class C { *gen() {
callCount += 1;
yield {
...yield,
y: 1,
...yield yield,
};
}}
var gen = C.prototype.gen;
var iter = gen();
iter.next();
iter.next({ x: 42 });
iter.next({ x: 'lol' });
var item = iter.next({ y: 39 });
assert.sameValue(item.value.x, 42);
assert.sameValue(item.value.y, 39);
assert.sameValue(Object.keys(item.value).length, 2);
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-non-strict.case
// - src/generators/non-strict/statement.template
// - src/generators/non-strict/declaration.template
/*---
description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator function declaration - valid for non-strict only cases)
esid: prod-GeneratorDeclaration

View File

@ -1,6 +1,6 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-non-strict.case
// - src/generators/non-strict/statement.template
// - src/generators/non-strict/declaration.template
/*---
description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator function declaration - valid for non-strict only cases)
esid: prod-GeneratorDeclaration

View File

@ -1,8 +1,8 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-spread-strict.case
// - src/generators/default/statement.template
// - src/generators/default/declaration.template
/*---
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator function declaration)
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator Function declaration)
esid: prod-GeneratorDeclaration
features: [object-spread]
flags: [generated, onlyStrict]
@ -12,8 +12,8 @@ negative:
info: |
14.4 Generator Function Definitions
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorDeclaration :
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
Spread Properties

View File

@ -1,8 +1,8 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-identifier-strict.case
// - src/generators/default/statement.template
// - src/generators/default/declaration.template
/*---
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator function declaration)
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator Function declaration)
esid: prod-GeneratorDeclaration
flags: [generated, onlyStrict]
negative:
@ -11,8 +11,8 @@ negative:
info: |
14.4 Generator Function Definitions
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorDeclaration :
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View File

@ -1,16 +1,16 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
// - src/generators/default/statement.template
// - src/generators/default/declaration.template
/*---
description: Use yield value in a array spread position (Generator function declaration)
description: Use yield value in a array spread position (Generator Function declaration)
esid: prod-GeneratorDeclaration
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorDeclaration :
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
Array Initializer

View File

@ -1,16 +1,16 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-single.case
// - src/generators/default/statement.template
// - src/generators/default/declaration.template
/*---
description: Use yield value in a array spread position (Generator function declaration)
description: Use yield value in a array spread position (Generator Function declaration)
esid: prod-GeneratorDeclaration
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorDeclaration :
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
Array Initializer

View File

@ -1,8 +1,8 @@
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-obj.case
// - src/generators/default/statement.template
// - src/generators/default/declaration.template
/*---
description: Use yield value in a object spread position (Generator function declaration)
description: Use yield value in a object spread position (Generator Function declaration)
esid: prod-GeneratorDeclaration
features: [object-spread]
flags: [generated]
@ -10,8 +10,8 @@ includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorDeclaration :
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
Spread Properties