summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/settle-async-generator.js
blob: bdc9fcb51cd7ab85e5fb04199fc40c3a2d96a819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Force resolving/rejecting Promises returned by async generator's methods
// should fail.

load(libdir + "asserts.js");

async function* f() {
  yield 1;
}

let p = f().next();
assertThrowsInstanceOf(() => {
  settlePromiseNow(p);
}, Error);

p = f().next();
assertThrowsInstanceOf(() => {
  resolvePromise(p);
}, Error);

p = f().next();
assertThrowsInstanceOf(() => {
  rejectPromise(p);
}, Error);