| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,5 +22,29 @@ async function explicitCall() { | |||
| 22 | 22 | assert.throws(() => dhSync.readSync(), { code: 'ERR_DIR_CLOSED' }); | |
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | + async function implicitCall() { | ||
| 26 | + let fh; | ||
| 27 | + { | ||
| 28 | + await using openHandle = await fs.open(__filename); | ||
| 29 | + fh = openHandle; | ||
| 30 | + fh.on('close', common.mustCall()); | ||
| 31 | + } | ||
| 32 | + assert.strictEqual(fh.fd, -1); | ||
| 33 | + | ||
| 34 | + let dh; | ||
| 35 | + { | ||
| 36 | + await using dirHandle = await fs.opendir(__dirname); | ||
| 37 | + dh = dirHandle; | ||
| 38 | + } | ||
| 39 | + await assert.rejects(dh.read(), { code: 'ERR_DIR_CLOSED' }); | ||
| 40 | + | ||
| 41 | + let dhSync; | ||
| 42 | + { | ||
| 43 | + using dirHandleSync = opendirSync(__dirname); | ||
| 44 | + dhSync = dirHandleSync; | ||
| 45 | + } | ||
| 46 | + assert.throws(() => dhSync.readSync(), { code: 'ERR_DIR_CLOSED' }); | ||
| 47 | + } | ||
| 48 | + | ||
| 25 | 49 | explicitCall().then(common.mustCall()); | |
| 26 | - // TODO(aduh95): add test for implicit calls, with `await using` syntax. | ||
| 50 | + implicitCall().then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments