Improve some yield cases based on feedback

This commit is contained in:
Leonardo Balter 2017-03-17 13:57:00 -04:00 committed by Leo Balter
parent 66f42efc99
commit e34a56774e
No known key found for this signature in database
GPG Key ID: 2C75F319D398E36B
5 changed files with 36 additions and 18 deletions

View File

@ -16,6 +16,8 @@ features: [object-spread]
flags: [noStrict, async]
---*/
//- setup
var s = Symbol('s');
//- body
yield {
...yield yield,
@ -30,8 +32,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 }) => {
@ -41,5 +43,7 @@ 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);

View File

@ -9,8 +9,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
includes:
- compareArray.js
flags: [async]
---*/
@ -20,9 +18,14 @@ var arr = ['a', 'b', 'c'];
yield [...yield];
//- assertions
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

@ -16,6 +16,8 @@ features: [object-spread]
flags: [noStrict]
---*/
//- setup
var s = Symbol('s');
//- body
yield {
...yield yield,
@ -30,14 +32,18 @@ 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);

View File

@ -9,8 +9,6 @@ info: |
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
includes:
- compareArray.js
---*/
//- setup
@ -19,7 +17,13 @@ var arr = ['a', 'b', 'c'];
yield [...yield];
//- assertions
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);

View File

@ -29,6 +29,7 @@ obj
//- body
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);