test262/src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
André Bargull f810ad2550 Fix issues in async generator case files
Incorrect $DONE handlers which led to calling $DONE twice
- async-generators/yield-promise-reject-next-yield-star-async-iterator.case
- dstr-assignment-for-await/array-elem-trlg-iter-rest-nrml-close-skip.case

$DONE handler not called at all:
- dstr-assignment-for-await/array-elem-put-const.case
- dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close-null.case

Incorrect assumed execution sequence in IteratorDestructuringAssignmentEvaluation:
- dstr-assignment-for-await/array-elem-iter-rtrn-close-null.case
2017-09-04 09:42:06 -04:00

32 lines
875 B
Plaintext

// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: yield * (async iterator) is treated as throw value
template: default
flags: [async]
---*/
//- setup
let error = new Error();
async function * readFile() {
yield Promise.reject(error);
yield "unreachable";
}
//- body
yield * readFile();
//- assertions
iter.next().then(() => {
throw new Test262Error("Promise incorrectly resolved.");
}, rejectValue => {
// yield Promise.reject(error);
assert.sameValue(rejectValue, error);
iter.next().then(({done, value}) => {
// iter is closed now.
assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
}).then($DONE, $DONE);
}, $DONE).catch($DONE);