Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-02-03 06:47:26 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2019-12-26 00:15:41 +0300
commit403c84a1cf964a24608a79c2952230270b6d1ca8 (patch)
tree419783e0944b6f7a61940765589d114d1a75769f /test
parent486ffa2abcee3be1210044a1654df2fb50eaa42f (diff)
src: port --bash-completion to C++
So that it gets handle earlier and faster during the bootstrap process. Drive-by fixes: - Remove `[has_eval_string]` and `[ssl_openssl_cert_store]` from the completion output - Set `kProfProcess` execution mode for `--prof-process` instead of `kPrintBashProcess` which is removed in this patch. - Append new line to the end of the output of --bash-completion PR-URL: https://github.com/nodejs/node/pull/25901 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-bash-completion.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/parallel/test-bash-completion.js b/test/parallel/test-bash-completion.js
index 50378a7b0f8..f6a1cc405eb 100644
--- a/test/parallel/test-bash-completion.js
+++ b/test/parallel/test-bash-completion.js
@@ -2,22 +2,32 @@
require('../common');
const assert = require('assert');
const child_process = require('child_process');
+const { inspect } = require('util');
const p = child_process.spawnSync(
process.execPath, [ '--completion-bash' ]);
assert.ifError(p.error);
-assert.ok(p.stdout.toString().includes(
- `_node_complete() {
+
+const output = p.stdout.toString().trim().replace(/\r/g, '');
+console.log(output);
+
+const prefix = `_node_complete() {
local cur_word options
cur_word="\${COMP_WORDS[COMP_CWORD]}"
if [[ "\${cur_word}" == -* ]] ; then
- COMPREPLY=( $(compgen -W '`));
-assert.ok(p.stdout.toString().includes(
- `' -- "\${cur_word}") )
+ COMPREPLY=( $(compgen -W '`.replace(/\r/g, '');
+const suffix = `' -- "\${cur_word}") )
return 0
else
COMPREPLY=( $(compgen -f "\${cur_word}") )
return 0
fi
}
-complete -F _node_complete node node_g`));
+complete -F _node_complete node node_g`.replace(/\r/g, '');
+
+assert.ok(
+ output.includes(prefix),
+ `Expect\n\n ${inspect(output)}\n\nto include\n\n${inspect(prefix)}`);
+assert.ok(
+ output.includes(suffix),
+ `Expect\n\n ${inspect(output)}\n\nto include\n\n${inspect(suffix)}`);