Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-null-throw.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/async-generators/yield-star-next-not-callable-null-throw.case
3 // - src/async-generators/default/async-obj-method.template
4 /*---
5 description: Not-callable next value in a yield star position - null (Async generator method)
6 esid: prod-AsyncGeneratorMethod
7 features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
8 flags: [generated, async]
9 info: |
10 Async Generator Function Definitions
11
12 AsyncGeneratorMethod :
13 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
14
15
16 YieldExpression: yield * AssignmentExpression
17 ...
18 6. Repeat
19 a. If received.[[Type]] is normal, then
20 ii. Let innerResult be ? Invoke(iterator, "next",
21 « received.[[Value]] »).
22 ...
23
24 ---*/
25 var obj = {
26 get [Symbol.iterator]() {
27 throw new Test262Error('it should not get Symbol.iterator');
28 },
29 [Symbol.asyncIterator]() {
30 return {
31 next: null
32 };
33 }
34 };
35
36
37 var callCount = 0;
38
39 var gen = {
40 async *method() {
41 callCount += 1;
42 yield* obj;
43 throw new Test262Error('abrupt completion closes iter');
44
45 }
46 }.method;
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);