mirror of
https://github.com/tc39/test262.git
synced 2025-05-27 18:20:28 +02:00
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
32 lines
875 B
Plaintext
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);
|