Debian Codegraph @

js/src/jit-test/tests/explicit-resource-management/await-using-throw-cases.js

raw
1 // |jit-test| skip-if: !getBuildConfiguration("explicit-resource-management"); --enable-explicit-resource-management
2
3 load(libdir + "asserts.js");
4
5 async function throwsOnNonObjectDisposable() {
6 await using a = 1;
7 }
8 throwsOnNonFunctionDispose().catch(e => {
9 assertEq(e instanceof TypeError, true);
10 });
11
12 async function throwsOnNonFunctionDispose() {
13 await using a = { [Symbol.asyncDispose]: 1 };
14 }
15
16 let reason = null;
17 throwsOnNonFunctionDispose().catch(e => {
18 reason = e;
19 });
20 drainJobQueue();
21 assertEq(reason instanceof TypeError, true);