Generate tests

This commit is contained in:
Leonardo Balter 2017-03-17 13:57:24 -04:00 committed by Leo Balter
parent e34a56774e
commit 8525cdb165
No known key found for this signature in database
GPG Key ID: 2C75F319D398E36B
28 changed files with 196 additions and 96 deletions

View File

@ -41,6 +41,7 @@ var callCount = 0;
(function(obj) {
assert.sameValue(obj[symbol], 1);
assert(Object.hasOwnProperty.call(obj, symbol));
assert.sameValue(obj.c, 4);
assert.sameValue(obj.d, 5);
assert.sameValue(Object.keys(obj).length, 2);

View File

@ -20,6 +20,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -42,8 +43,8 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
item.then(({ done, value }) => {
@ -53,7 +54,9 @@ item.then(({ done, value }) => {
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert.sameValue(Object.keys(value).length, 5);
assert(Object.hasOwnProperty.call(value, s));
}).then($DONE, $DONE);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Named async generator expression)
esid: prod-AsyncGeneratorExpression
flags: [generated, async]
includes: [compareArray.js]
info: |
Async Generator Function Definitions
@ -32,10 +31,15 @@ var gen = async function *g() {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -20,6 +20,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -42,8 +43,8 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
item.then(({ done, value }) => {
@ -53,7 +54,9 @@ item.then(({ done, value }) => {
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert.sameValue(Object.keys(value).length, 5);
assert(Object.hasOwnProperty.call(value, s));
}).then($DONE, $DONE);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Unnamed async generator expression)
esid: prod-AsyncGeneratorExpression
flags: [generated, async]
includes: [compareArray.js]
info: |
Async Generator Function Definitions
@ -32,10 +31,15 @@ var gen = async function *() {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -39,6 +39,7 @@ var callCount = 0;
(function(obj) {
assert.sameValue(obj[symbol], 1);
assert(Object.hasOwnProperty.call(obj, symbol));
assert.sameValue(obj.c, 4);
assert.sameValue(obj.d, 5);
assert.sameValue(Object.keys(obj).length, 2);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Static async generator method as a ClassExpression element)
esid: prod-AsyncGeneratorMethod
flags: [generated, async]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
@ -39,10 +38,15 @@ var gen = C.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Async generator method as a ClassExpression element)
esid: prod-AsyncGeneratorMethod
flags: [generated, async]
includes: [compareArray.js]
info: |
ClassElement :
MethodDefinition
@ -39,10 +38,15 @@ var gen = C.prototype.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -5,7 +5,6 @@
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
@ -22,7 +21,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -38,9 +36,15 @@ var gen = C.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
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 :
MethodDefinition
@ -22,7 +21,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -38,9 +36,15 @@ var gen = C.prototype.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -19,6 +19,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -40,16 +41,20 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
var value = item.value;
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(value.x, 10);
assert.sameValue(value.y, 20);
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert(Object.hasOwnProperty.call(value, s));
assert.sameValue(Object.keys(value).length, 5);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
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
@ -16,7 +15,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -30,9 +28,15 @@ var gen = function *g() {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -19,6 +19,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -40,16 +41,20 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
var value = item.value;
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(value.x, 10);
assert.sameValue(value.y, 20);
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert(Object.hasOwnProperty.call(value, s));
assert.sameValue(Object.keys(value).length, 5);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Unnamed generator expression)
esid: prod-GeneratorExpression
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
@ -16,7 +15,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -30,9 +28,15 @@ var gen = function *() {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -38,6 +38,7 @@ var callCount = 0;
new function(obj) {
assert.sameValue(obj[symbol], 1);
assert(Object.hasOwnProperty.call(obj, symbol));
assert.sameValue(obj.c, 4);
assert.sameValue(obj.d, 5);
assert.sameValue(Object.keys(obj).length, 2);

View File

@ -19,6 +19,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -43,8 +44,8 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
item.then(({ done, value }) => {
@ -54,7 +55,9 @@ item.then(({ done, value }) => {
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert.sameValue(Object.keys(value).length, 5);
assert(Object.hasOwnProperty.call(value, s));
}).then($DONE, $DONE);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Async generator method)
esid: prod-AsyncGeneratorMethod
flags: [generated, async]
includes: [compareArray.js]
info: |
Async Generator Function Definitions
@ -32,10 +31,15 @@ var gen = {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -19,6 +19,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -42,16 +43,20 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
var value = item.value;
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(value.x, 10);
assert.sameValue(value.y, 20);
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert(Object.hasOwnProperty.call(value, s));
assert.sameValue(Object.keys(value).length, 5);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Generator method)
esid: prod-GeneratorMethod
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
@ -16,7 +15,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -32,9 +30,15 @@ var gen = {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -37,6 +37,7 @@ var callCount = 0;
class Test262ParentClass {
constructor(obj) {
assert.sameValue(obj[symbol], 1);
assert(Object.hasOwnProperty.call(obj, symbol));
assert.sameValue(obj.c, 4);
assert.sameValue(obj.d, 5);
assert.sameValue(Object.keys(obj).length, 2);

View File

@ -20,6 +20,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -42,8 +43,8 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
item.then(({ done, value }) => {
@ -53,7 +54,9 @@ item.then(({ done, value }) => {
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert.sameValue(Object.keys(value).length, 5);
assert(Object.hasOwnProperty.call(value, s));
}).then($DONE, $DONE);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Async generator Function declaration)
esid: prod-AsyncGeneratorDeclaration
flags: [generated, async]
includes: [compareArray.js]
info: |
Async Generator Function Definitions
@ -32,10 +31,15 @@ async function *gen() {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Static async generator method as a ClassDeclaration element)
esid: prod-AsyncGeneratorMethod
flags: [generated, async]
includes: [compareArray.js]
info: |
ClassElement :
static MethodDefinition
@ -39,10 +38,15 @@ var gen = C.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -5,7 +5,6 @@
description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
esid: prod-AsyncGeneratorMethod
flags: [generated, async]
includes: [compareArray.js]
info: |
ClassElement :
MethodDefinition
@ -39,10 +38,15 @@ var gen = C.prototype.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
item.then(({ done, value }) => {
assert(compareArray(value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(done, false);
}).then($DONE, $DONE);

View File

@ -5,7 +5,6 @@
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
@ -22,7 +21,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -38,9 +36,15 @@ var gen = C.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
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
@ -22,7 +21,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -38,9 +36,15 @@ var gen = C.prototype.gen;
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);

View File

@ -19,6 +19,7 @@ info: |
...AssignmentExpression[In, ?Yield]
---*/
var s = Symbol('s');
var callCount = 0;
@ -40,16 +41,20 @@ var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0 });
iter.next({ y: 20, a: 1, b: 1 });
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
var value = item.value;
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(value.x, 10);
assert.sameValue(value.y, 20);
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert(Object.hasOwnProperty.call(value, s));
assert.sameValue(Object.keys(value).length, 5);
assert.sameValue(callCount, 1);

View File

@ -5,7 +5,6 @@
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
@ -16,7 +15,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
@ -30,9 +28,15 @@ function *gen() {
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
var item = iter.next(arr);
var value = item.value;
assert(compareArray(item.value, arr));
assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);