Skip to content

Commit

Permalink
add test for PR 2819
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot authored and Ms2ger committed Sep 6, 2022
1 parent cbb104c commit fb97b47
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (C) 2022 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-generator-function-definitions-runtime-semantics-evaluation
description: >
`yield*` in an async generator does not await promises returned by a manually implemented async iterator.
flags: [async]
features: [async-iteration]
---*/

var innerPromise = Promise.resolve("unwrapped value");

var asyncIter = {
[Symbol.asyncIterator]() {
return this;
},
next() {
return {
done: false,
value: innerPromise,
};
},
get return() {
throw new Test262Error(".return should not be accessed");
},
get throw() {
throw new Test262Error(".throw should not be accessed");
},
};

async function* f() {
yield* asyncIter;
}

f()
.next()
.then(v => {
assert.sameValue(v.value, innerPromise, "yield* should not unwrap promises from manually-implemented async iterators");
})
.then($DONE, $DONE)

0 comments on commit fb97b47

Please sign in to comment.