Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/expression-await-thenable-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 thenable = {
14 then: function(resolve, reject) {
15 resolve("a");
16 }
17 };
18
19 var iter = (async function*() {
20 yield await thenable;
21 })();
22
23 iter.next().then(function(result) {
24 assert.sameValue(result.value, "a", 'First result `value`');
25 assert.sameValue(result.done, false, 'First result `done` flag');
26 }).then(undefined, $DONE);
27
28 iter.next().then(function(result) {
29 assert.sameValue(result.value, undefined, 'Second result `value`');
30 assert.sameValue(result.done, true, 'Second result `done` flag');
31 }).then($DONE, $DONE);