OLD | NEW |
(Empty) | |
| 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 <caitp@igalia.com> |
| 6 esid: 14.4 |
| 7 description: > |
| 8 `yield` is a valid statement within async generator function bodies. |
| 9 flags: [async] |
| 10 ---*/ |
| 11 |
| 12 var g1 = async function*() { yield; }; |
| 13 var g2 = async function*() { yield 1; }; |
| 14 |
| 15 var iter1 = g1(); |
| 16 iter1.next().then(function(result) { |
| 17 assert.sameValue( |
| 18 result.value, undefined, "Without right-hand-side: first result `value`"); |
| 19 assert.sameValue( |
| 20 result.done, false, "Without right-hand-side: first result `done` flag"); |
| 21 }).then(undefined, $DONE); |
| 22 iter1.next(function(result) { |
| 23 assert.sameValue( |
| 24 result.value, undefined, "Without right-hand-side: second result `value`"); |
| 25 assert.sameValue( |
| 26 result.done, true, "Without right-hand-side: second result `done` flag"); |
| 27 }).then(undefined, $DONE); |
| 28 |
| 29 var iter2 = g2(); |
| 30 iter2.next().then(function(result) { |
| 31 assert.sameValue( |
| 32 result.value, 1, "With right-hand-side: first result `value`"); |
| 33 assert.sameValue( |
| 34 result.done, false, "With right-hand-side: first result `done` flag"); |
| 35 }).then(undefined, $DONE); |
| 36 iter2.next(function(result) { |
| 37 assert.sameValue( |
| 38 result.value, undefined, "With right-hand-side: second result `value`"); |
| 39 assert.sameValue( |
| 40 result.done, true, "With right-hand-side: second result `done` flag"); |
| 41 }).then($DONE, $DONE); |
OLD | NEW |