diff options
author | Aivo Paas <aivo.paas@pipedrive.com> | 2018-11-06 15:52:09 +0000 |
---|---|---|
committer | Gireesh Punathil <gpunathi@in.ibm.com> | 2018-11-11 19:58:58 +0530 |
commit | 288076d4a50df88c600ca6ac006b0e8fb0826780 (patch) | |
tree | 680ff2c3b68e77f8c0e15ee799035798421c32b5 /test/parallel/test-bash-completion.js | |
parent | d968e4324b2653866d1718c68281b52da7bcbc24 (diff) | |
download | android-node-v8-288076d4a50df88c600ca6ac006b0e8fb0826780.tar.gz android-node-v8-288076d4a50df88c600ca6ac006b0e8fb0826780.tar.bz2 android-node-v8-288076d4a50df88c600ca6ac006b0e8fb0826780.zip |
test: add test case for completion bash flag
This test case verifies that starting Node.js with the completion
bash flag prints out the expected result and ends right after.
PR-URL: https://github.com/nodejs/node/pull/24168
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-bash-completion.js')
-rw-r--r-- | test/parallel/test-bash-completion.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/parallel/test-bash-completion.js b/test/parallel/test-bash-completion.js new file mode 100644 index 0000000000..50378a7b0f --- /dev/null +++ b/test/parallel/test-bash-completion.js @@ -0,0 +1,23 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const child_process = require('child_process'); + +const p = child_process.spawnSync( + process.execPath, [ '--completion-bash' ]); +assert.ifError(p.error); +assert.ok(p.stdout.toString().includes( + `_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}") ) + return 0 + else + COMPREPLY=( $(compgen -f "\${cur_word}") ) + return 0 + fi +} +complete -F _node_complete node node_g`)); |