| 1 |
// Copyright 2017 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
author: Caitlin Potter <[email protected]> |
| 6 |
esid: sec-generator-function-definitions |
| 7 |
description: > |
| 8 |
`yield` expressions may be used as the right-hand-side of other `yield` |
| 9 |
expressions. |
| 10 |
flags: [async] |
| 11 |
features: [async-iteration] |
| 12 |
---*/ |
| 13 |
|
| 14 |
var g = async function*() { |
| 15 |
yield yield 1; |
| 16 |
}; |
| 17 |
|
| 18 |
var iter = g(); |
| 19 |
iter.next().then(function(result) { |
| 20 |
assert.sameValue(result.value, 1, 'First result `value`'); |
| 21 |
assert.sameValue(result.done, false, 'First result `done` flag'); |
| 22 |
}).then(undefined, $DONE); |
| 23 |
|
| 24 |
iter.next().then(function(result) { |
| 25 |
assert.sameValue(result.value, undefined, 'Second result `value`'); |
| 26 |
assert.sameValue(result.done, false, 'Second result `done` flag'); |
| 27 |
}).then(undefined, $DONE); |
| 28 |
|
| 29 |
iter.next().then(function(result) { |
| 30 |
assert.sameValue(result.value, undefined, 'Third result `value`'); |
| 31 |
assert.sameValue(result.done, true, 'Thid result `done` flag'); |
| 32 |
}).then($DONE, $DONE); |