@@ -397,6 +397,45 @@ testMe.complete('obj.', common.mustCall((error, data) => {
397
397
assert ( data [ 0 ] . includes ( 'obj.key' ) ) ;
398
398
} ) ) ;
399
399
400
+ // Tab completion for files/directories
401
+ {
402
+ putIn . run ( [ '.clear' ] ) ;
403
+ process . chdir ( __dirname ) ;
404
+
405
+ const readFileSync = 'fs.readFileSync("' ;
406
+ const fixturePath = `${ readFileSync } ../fixtures/test-repl-tab-completion` ;
407
+ if ( ! common . isWindows ) {
408
+ testMe . complete ( fixturePath , common . mustCall ( ( err , data ) => {
409
+ assert . strictEqual ( err , null ) ;
410
+ assert . ok ( data [ 0 ] [ 0 ] . includes ( '.hiddenfiles' ) ) ;
411
+ assert . ok ( data [ 0 ] [ 1 ] . includes ( 'hellorandom.txt' ) ) ;
412
+ assert . ok ( data [ 0 ] [ 2 ] . includes ( 'helloworld.js' ) ) ;
413
+ } ) ) ;
414
+
415
+ testMe . complete ( `${ fixturePath } /hello` ,
416
+ common . mustCall ( ( err , data ) => {
417
+ assert . strictEqual ( err , null ) ;
418
+ assert . ok ( data [ 0 ] [ 0 ] . includes ( 'hellorandom.txt' ) ) ;
419
+ assert . ok ( data [ 0 ] [ 1 ] . includes ( 'helloworld.js' ) ) ;
420
+ } )
421
+ ) ;
422
+
423
+ testMe . complete ( `${ fixturePath } /.h` ,
424
+ common . mustCall ( ( err , data ) => {
425
+ assert . strictEqual ( err , null ) ;
426
+ assert . ok ( data [ 0 ] [ 0 ] . includes ( '.hiddenfiles' ) ) ;
427
+ } )
428
+ ) ;
429
+
430
+ testMe . complete ( `${ readFileSync } ./xxxRandom/random` ,
431
+ common . mustCall ( ( err , data ) => {
432
+ assert . strictEqual ( err , null ) ;
433
+ assert . strictEqual ( data [ 0 ] . length , 0 ) ;
434
+ } )
435
+ ) ;
436
+ }
437
+ }
438
+
400
439
[
401
440
Array ,
402
441
Buffer ,
0 commit comments