File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -22,5 +22,26 @@ async function explicitCall() {
2222 assert . throws ( ( ) => dhSync . readSync ( ) , { code : 'ERR_DIR_CLOSED' } ) ;
2323}
2424
25+ async function implicitCall ( ) {
26+ {
27+ await using fh = await fs . open ( __filename ) ;
28+ fh . on ( 'close' , common . mustCall ( ) ) ;
29+ }
30+
31+ let dh ;
32+ {
33+ await using dirHandle = await fs . opendir ( __dirname ) ;
34+ dh = dirHandle ;
35+ }
36+ await assert . rejects ( dh . read ( ) , { code : 'ERR_DIR_CLOSED' } ) ;
37+
38+ let dhSync ;
39+ {
40+ using dirHandleSync = opendirSync ( __dirname ) ;
41+ dhSync = dirHandleSync ;
42+ }
43+ assert . throws ( ( ) => dhSync . readSync ( ) , { code : 'ERR_DIR_CLOSED' } ) ;
44+ }
45+
2546explicitCall ( ) . then ( common . mustCall ( ) ) ;
26- // TODO(aduh95): add test for implicit calls, with `await using` syntax.
47+ implicitCall ( ) . then ( common . mustCall ( ) ) ;
You can’t perform that action at this time.
0 commit comments