Normalize IFS

This commit is contained in:
Paul Ouellette
2019-07-02 22:37:09 -04:00
parent 3a0e7a2706
commit 0eac53893b
2 changed files with 7 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ describe("tests related to generation of shell completion scripts", function()
local parser = Parser "foo"
assert.equal([=[
_foo() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -28,6 +29,7 @@ complete -F _foo -o bashdefault -o default foo
parser:option "--bar"
assert.equal([=[
_foo() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -57,6 +59,7 @@ complete -F _foo -o bashdefault -o default foo
:choices {"short", "medium", "full"}
assert.equal([=[
_foo() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -86,6 +89,7 @@ complete -F _foo -o bashdefault -o default foo
:add_help(false)
assert.equal([=[
_foo() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -124,6 +128,7 @@ complete -F _foo -o bashdefault -o default foo
install:flag "-v --verbose"
assert.equal([=[
_foo() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -165,6 +170,7 @@ complete -F _foo -o bashdefault -o default foo
:add_help(false)
assert.equal([=[
_foo() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

View File

@@ -1205,6 +1205,7 @@ end
function Parser:get_bash_complete()
local buf = {([[
_%s() {
local IFS=$' \t\n'
local cur prev cmd opts arg
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"