| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
). |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
var reason = {}; |
| 28 |
var obj = { |
| 29 |
get [Symbol.iterator]() { |
| 30 |
throw new Test262Error('it should not get Symbol.iterator'); |
| 31 |
}, |
| 32 |
[Symbol.asyncIterator]() { |
| 33 |
return { |
| 34 |
get next() { |
| 35 |
throw reason; |
| 36 |
} |
| 37 |
}; |
| 38 |
} |
| 39 |
}; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
var callCount = 0; |
| 44 |
|
| 45 |
var gen = async function *g() { |
| 46 |
callCount += 1; |
| 47 |
yield* obj; |
| 48 |
throw new Test262Error('abrupt completion closes iter'); |
| 49 |
|
| 50 |
}; |
| 51 |
|
| 52 |
var iter = gen(); |
| 53 |
|
| 54 |
iter.next().then(() => { |
| 55 |
throw new Test262Error('Promise incorrectly fulfilled.'); |
| 56 |
}, v => { |
| 57 |
assert.sameValue(v, reason, "reject reason"); |
| 58 |
|
| 59 |
iter.next().then(({ done, value }) => { |
| 60 |
assert.sameValue(done, true, 'the iterator is completed'); |
| 61 |
assert.sameValue(value, undefined, 'value is undefined'); |
| 62 |
}).then($DONE, $DONE); |
| 63 |
}).catch($DONE); |
| 64 |
|
| 65 |
assert.sameValue(callCount, 1); |