summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrestez Dan Leonard <cdleonard@gmail.com>2010-02-02 11:16:29 +0200
committerCrestez Dan Leonard <cdleonard@gmail.com>2010-02-02 11:16:29 +0200
commitc3bb4416d71dfb73c813179e2b4a37767e5adb0d (patch)
tree2358b4832f8e40fe1ff13d3659d1edeb79ac9e3c
parent61f83856fb1365e8c9df525dbcc5b74708ddbfe4 (diff)
downloadbash-completion-c3bb4416d71dfb73c813179e2b4a37767e5adb0d.tar.gz
Fixed tests when BASH_COMPLETION or TESTDIR contain spaces.
-rw-r--r--CHANGES1
-rw-r--r--bash_completion12
-rw-r--r--test/lib/completions/scp.exp2
-rw-r--r--test/lib/completions/screen.exp2
-rw-r--r--test/lib/completions/sftp.exp2
-rw-r--r--test/lib/completions/ssh.exp4
-rw-r--r--test/lib/library.exp12
-rw-r--r--test/unit/compgen.exp2
8 files changed, 19 insertions, 18 deletions
diff --git a/CHANGES b/CHANGES
index 106f997b..c6baded9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -68,6 +68,7 @@ bash-completion (2.x)
* Improve ssh -o suboption completion (Alioth: #312122).
* Fix NFS mounts completion (Alioth: #312285).
* Fix completion of usernames (Alioth: #311396, Debian: #511788).
+ * Fixed tests when BASH_COMPLETION or TESTDIR contain spaces.
[ Raphaƫl Droz ]
* Add xsltproc completion (Alioth: #311843).
diff --git a/bash_completion b/bash_completion
index d59ef6f2..8467272a 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1674,7 +1674,7 @@ _filedir_xspec()
# get first exclusion compspec that matches this command
xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" \
- $BASH_COMPLETION )
+ "$BASH_COMPLETION" )
# prune to leave nothing but the -X spec
xspec=${xspec#*-X }
xspec=${xspec%% *}
@@ -1701,7 +1701,7 @@ _filedir_xspec()
COMPREPLY=( "${toks[@]}" )
}
-list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' $BASH_COMPLETION | \
+list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
# read exclusion compspecs
(
while read line
@@ -1727,19 +1727,19 @@ unset list
# source completion directory definitions
if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \
-x $BASH_COMPLETION_COMPAT_DIR ]]; then
- for i in $(LC_ALL=C command ls $BASH_COMPLETION_COMPAT_DIR); do
+ for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do
i=$BASH_COMPLETION_COMPAT_DIR/$i
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
- && ( -f $i || -h $i ) && -r $i ]] && . $i
+ && ( -f $i || -h $i ) && -r $i ]] && . "$i"
done
fi
if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
-d $BASH_COMPLETION_DIR && -r $BASH_COMPLETION_DIR && \
-x $BASH_COMPLETION_DIR ]]; then
- for i in $(LC_ALL=C command ls $BASH_COMPLETION_DIR); do
+ for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do
i=$BASH_COMPLETION_DIR/$i
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
- && ( -f $i || -h $i ) && -r $i ]] && . $i
+ && ( -f $i || -h $i ) && -r $i ]] && . "$i"
done
fi
unset i
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index 4203b5ef..efe2b686 100644
--- a/test/lib/completions/scp.exp
+++ b/test/lib/completions/scp.exp
@@ -112,7 +112,7 @@ if {[match_items [lsort -unique $expected] $test]} {
if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"}
}; # if
sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_bash_exec {cd "$TESTDIR"}
sync_after_int
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
index 4bd5ad0a..f486b463 100644
--- a/test/lib/completions/screen.exp
+++ b/test/lib/completions/screen.exp
@@ -42,7 +42,7 @@ expect {
default { unresolved "$test" }
}; # expect
sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_bash_exec {cd "$TESTDIR"}
diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp
index 59faaabf..24c37cb5 100644
--- a/test/lib/completions/sftp.exp
+++ b/test/lib/completions/sftp.exp
@@ -71,7 +71,7 @@ expect {
default { unresolved "$test" }
}; # expect
sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_bash_exec {cd "$TESTDIR"}
teardown
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
index c3341294..8a0d88d2 100644
--- a/test/lib/completions/ssh.exp
+++ b/test/lib/completions/ssh.exp
@@ -29,7 +29,7 @@ expect {
default { unresolved "$test" }
}; # expect
sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_bash_exec {cd "$TESTDIR"}
sync_after_int
@@ -97,7 +97,7 @@ expect {
default { unresolved "$test" }
}; # expect
sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_bash_exec {cd "$TESTDIR"}
sync_after_int
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 60062ccd..fa554c73 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -98,7 +98,7 @@ proc assert_bash_list_dir {expected cmd dir {test ""} {prompt /@} {size 20}} {
assert_bash_exec "cd $dir" "" $prompt
assert_bash_list $expected $cmd $test $prompt $size
sync_after_int $prompt
- assert_bash_exec "cd \$TESTDIR"
+ assert_bash_exec {cd "$TESTDIR"}
}; # assert_bash_list_dir()
@@ -268,7 +268,7 @@ proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} {
assert_bash_exec "cd $dir" "" $prompt
assert_complete $expected $cmd $test $prompt $size $cword
sync_after_int $prompt
- assert_bash_exec "cd \$TESTDIR"
+ assert_bash_exec {cd "$TESTDIR"}
}; # assert_complete_dir
@@ -631,16 +631,16 @@ proc save_env {{file ""}} {
# @param string File to save the environment to. Default is "$TESTDIR/tmp/env1~".
# @see assert_env_unmodified()
proc _save_env {{file ""}} {
- assert_bash_exec "{ set; declare -F; shopt -p; } > $file"
+ assert_bash_exec "{ set; declare -F; shopt -p; } > \"$file\""
}; # _save_env()
# Source bash_completion package
proc source_bash_completion {} {
- assert_bash_exec {BASH_COMPLETION_DIR=$(cd $TESTDIR/..; pwd)/contrib}
+ assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/contrib}
assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
- assert_bash_exec {BASH_COMPLETION=$(cd $TESTDIR/..; pwd)/bash_completion}
- assert_bash_exec {source $BASH_COMPLETION}
+ assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion}
+ assert_bash_exec {source "$BASH_COMPLETION"}
}; # source_bash_completion()
diff --git a/test/unit/compgen.exp b/test/unit/compgen.exp
index 8c33c414..6673bf0e 100644
--- a/test/unit/compgen.exp
+++ b/test/unit/compgen.exp
@@ -41,7 +41,7 @@ expect {
-re eof { unresolved "eof" }
}; # expect
sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_bash_exec {cd "$TESTDIR"}
#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen