await-using-for-of-sync-dispose-not-awaited.js (519B)
1 // |jit-test| skip-if: !getBuildConfiguration("explicit-resource-management"); error:Unhandled rejection: "sync"; --enable-explicit-resource-management 2 3 let fulfilled = false; 4 async function testSyncDisposeAwaitUsingNotAwaited() { 5 const x = { 6 [Symbol.dispose]: () => Promise.reject('sync') 7 }; 8 9 for (await using d of [x]) {} 10 } 11 testSyncDisposeAwaitUsingNotAwaited().then(() => { 12 fulfilled = true; 13 }); 14 drainJobQueue(); 15 // Returning a rejected from the sync dispose shouldn't reject. 16 assertEq(fulfilled, true);