11'use strict' ;
22
3- // Tests that drop() only revokes the exact resource that was explicitly granted.
3+ require ( '../common' ) ;
44
55const { spawnSync } = require ( 'child_process' ) ;
66const assert = require ( 'assert' ) ;
@@ -9,8 +9,6 @@ const { isMainThread } = require('worker_threads');
99if ( ! isMainThread ) {
1010 process . exit ( 0 ) ;
1111}
12-
13- require ( '../common' ) ;
1412const tmpdir = require ( '../common/tmpdir' ) ;
1513const fs = require ( 'fs' ) ;
1614const path = require ( 'path' ) ;
@@ -45,7 +43,7 @@ fs.writeFileSync(path.join(dir, 'item2.txt'), 'bbb');
4543 if ( child . status !== 0 ) {
4644 console . error ( 'Case 1 stderr:' , child . stderr ?. toString ( ) ) ;
4745 }
48- assert . strictEqual ( child . status , 0 , 'Case 1 failed' ) ;
46+ assert . strictEqual ( child . status , 0 ) ;
4947}
5048
5149// Grant a directory, drop the same directory - should revoke all access
@@ -69,7 +67,7 @@ fs.writeFileSync(path.join(dir, 'item2.txt'), 'bbb');
6967 if ( child . status !== 0 ) {
7068 console . error ( 'Case 2 stderr:' , child . stderr ?. toString ( ) ) ;
7169 }
72- assert . strictEqual ( child . status , 0 , 'Case 2 failed' ) ;
70+ assert . strictEqual ( child . status , 0 ) ;
7371}
7472
7573// Grant two directories, drop one - the other remains accessible
@@ -105,7 +103,7 @@ fs.writeFileSync(path.join(dir, 'item2.txt'), 'bbb');
105103 if ( child . status !== 0 ) {
106104 console . error ( 'Case 3 stderr:' , child . stderr ?. toString ( ) ) ;
107105 }
108- assert . strictEqual ( child . status , 0 , 'Case 3 failed' ) ;
106+ assert . strictEqual ( child . status , 0 ) ;
109107}
110108
111109// Grant a directory and a file inside it separately, drop the file
@@ -132,7 +130,7 @@ fs.writeFileSync(path.join(dir, 'item2.txt'), 'bbb');
132130 if ( child . status !== 0 ) {
133131 console . error ( 'Case 4 stderr:' , child . stderr ?. toString ( ) ) ;
134132 }
135- assert . strictEqual ( child . status , 0 , 'Case 4 failed' ) ;
133+ assert . strictEqual ( child . status , 0 ) ;
136134}
137135
138136// Drop entire scope without reference - revokes everything
@@ -156,5 +154,5 @@ fs.writeFileSync(path.join(dir, 'item2.txt'), 'bbb');
156154 if ( child . status !== 0 ) {
157155 console . error ( 'Case 5 stderr:' , child . stderr ?. toString ( ) ) ;
158156 }
159- assert . strictEqual ( child . status , 0 , 'Case 5 failed' ) ;
157+ assert . strictEqual ( child . status , 0 ) ;
160158}
0 commit comments