()
| 5 | const { opendirSync, promises: fs } = require('fs'); |
| 6 | |
| 7 | async function explicitCall() { |
| 8 | const fh = await fs.open(__filename); |
| 9 | fh.on('close', common.mustCall()); |
| 10 | await fh[Symbol.asyncDispose](); |
| 11 | |
| 12 | const dh = await fs.opendir(__dirname); |
| 13 | await dh[Symbol.asyncDispose](); |
| 14 | // Repeat invocations should not reject |
| 15 | await dh[Symbol.asyncDispose](); |
| 16 | await assert.rejects(dh.read(), { code: 'ERR_DIR_CLOSED' }); |
| 17 | |
| 18 | const dhSync = opendirSync(__dirname); |
| 19 | dhSync[Symbol.dispose](); |
| 20 | // Repeat invocations should not throw |
| 21 | dhSync[Symbol.dispose](); |
| 22 | assert.throws(() => dhSync.readSync(), { code: 'ERR_DIR_CLOSED' }); |
| 23 | } |
| 24 | |
| 25 | async function implicitCall() { |
| 26 | let fh; |
no test coverage detected