summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl-tab-complete.js
diff options
context:
space:
mode:
authorAnto Aravinth <anto.aravinth.cse@gmail.com>2019-04-25 20:14:47 +0530
committerAnto Aravinth <anto.aravinth.cse@gmail.com>2019-04-29 07:28:27 +0530
commitd69f00465790f1ac7788ac111bb61689543536ae (patch)
tree33bb84b6f50b5d29198bfa82aca628b6d6a28425 /test/parallel/test-repl-tab-complete.js
parent377939eef847d2475768c0db0b3eb1a699f545f1 (diff)
downloadandroid-node-v8-d69f00465790f1ac7788ac111bb61689543536ae.tar.gz
android-node-v8-d69f00465790f1ac7788ac111bb61689543536ae.tar.bz2
android-node-v8-d69f00465790f1ac7788ac111bb61689543536ae.zip
repl: add autocomplete for filesystem modules
PR-URL: https://github.com/nodejs/node/pull/26648 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-repl-tab-complete.js')
-rw-r--r--test/parallel/test-repl-tab-complete.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js
index 02cd06c953..364d880e8c 100644
--- a/test/parallel/test-repl-tab-complete.js
+++ b/test/parallel/test-repl-tab-complete.js
@@ -397,6 +397,45 @@ testMe.complete('obj.', common.mustCall((error, data) => {
assert(data[0].includes('obj.key'));
}));
+// Tab completion for files/directories
+{
+ putIn.run(['.clear']);
+ process.chdir(__dirname);
+
+ const readFileSync = 'fs.readFileSync("';
+ const fixturePath = `${readFileSync}../fixtures/test-repl-tab-completion`;
+ if (!common.isWindows) {
+ testMe.complete(fixturePath, common.mustCall((err, data) => {
+ assert.strictEqual(err, null);
+ assert.ok(data[0][0].includes('.hiddenfiles'));
+ assert.ok(data[0][1].includes('hellorandom.txt'));
+ assert.ok(data[0][2].includes('helloworld.js'));
+ }));
+
+ testMe.complete(`${fixturePath}/hello`,
+ common.mustCall((err, data) => {
+ assert.strictEqual(err, null);
+ assert.ok(data[0][0].includes('hellorandom.txt'));
+ assert.ok(data[0][1].includes('helloworld.js'));
+ })
+ );
+
+ testMe.complete(`${fixturePath}/.h`,
+ common.mustCall((err, data) => {
+ assert.strictEqual(err, null);
+ assert.ok(data[0][0].includes('.hiddenfiles'));
+ })
+ );
+
+ testMe.complete(`${readFileSync}./xxxRandom/random`,
+ common.mustCall((err, data) => {
+ assert.strictEqual(err, null);
+ assert.strictEqual(data[0].length, 0);
+ })
+ );
+ }
+}
+
[
Array,
Buffer,