// 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 * [Promise.reject(value)] is treated as throw value template: default flags: [async] ---*/ //- setup let error = new Error(); async function * readFile() { yield Promise.reject(error); yield "unreachable"; } //- body for await (let line of readFile()) { yield line; } //- 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); }).catch($DONE);