Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/expression-await-promise-as-yield-operand.js

raw
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 AwaitExpressions are valid operands to yield expressions.
9 flags: [async]
10 features: [async-iteration]
11 ---*/
12
13 var iter = (async function*() {
14 yield await new Promise(function(resolve) {
15 resolve("a");
16 });
17 })();
18
19 iter.next().then(function(result) {
20 assert.sameValue(result.value, "a", '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, true, 'Second result `done` flag');
27 }).then($DONE, $DONE);