Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/named-yield-star-next-not-callable-undefined-throw.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/async-generators/yield-star-next-not-callable-undefined-throw.case
3 // - src/async-generators/default/async-expression-named.template
4 /*---
5 description: Not-callable next value in a yield star position - undefined (Named async generator expression)
6 esid: prod-AsyncGeneratorExpression
7 features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
8 flags: [generated, async]
9 info: |
10 Async Generator Function Definitions
11
12 AsyncGeneratorExpression :
13 async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
14 AsyncGeneratorBody }
15
16
17 YieldExpression: yield * AssignmentExpression
18 ...
19 6. Repeat
20 a. If received.[[Type]] is normal, then
21 ii. Let innerResult be ? Invoke(iterator, "next",
22 « received.[[Value]] »).
23 ...
24
25 ---*/
26 var obj = {
27 get [Symbol.iterator]() {
28 throw new Test262Error('it should not get Symbol.iterator');
29 },
30 [Symbol.asyncIterator]() {
31 return {
32 next: undefined
33 };
34 }
35 };
36
37
38
39 var callCount = 0;
40
41 var gen = async function *g() {
42 callCount += 1;
43 yield* obj;
44 throw new Test262Error('abrupt completion closes iter');
45
46 };
47
48 var iter = gen();
49
50 iter.next().then(() => {
51 throw new Test262Error('Promise incorrectly fulfilled.');
52 }, v => {
53 assert.sameValue(v.constructor, TypeError, "TypeError");
54
55 iter.next().then(({ done, value }) => {
56 assert.sameValue(done, true, 'the iterator is completed');
57 assert.sameValue(value, undefined, 'value is undefined');
58 }).then($DONE, $DONE);
59 }).catch($DONE);
60
61 assert.sameValue(callCount, 1);