[Bash-completion-commits] [SCM] bash-completion branch, master, updated. f321c377affad39214c5cff02b66090f49232abe
Freddy Vulto
fvulto at gmail.com
Wed Dec 30 13:50:20 UTC 2009
The following commit has been merged in the master branch:
commit f321c377affad39214c5cff02b66090f49232abe
Author: Freddy Vulto <fvulto at gmail.com>
Date: Wed Dec 30 14:48:17 2009 +0100
(testsuite) Delete directory fixtures/_filedir/a\b
Directories `a\b' and `a*b' are now created run-time on a
non-Cygwin/Windows system only. Tests concerning these directories will
also be run only on a non-Cygwin/Windows system.
(Alioth #312191)
diff --git "a/test/fixtures/_filedir/a\\b/g" "b/test/fixtures/_filedir/a\\b/g"
deleted file mode 100644
index e69de29..0000000
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 968d780..1af23f3 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -417,6 +417,16 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
}; # assert_exec()
+# Sort list.
+# `exec sort' is used instead of `lsort' to achieve exactly the
+# same sort order as in bash.
+# @param list $items
+# @return list Sort list
+proc bash_sort {items} {
+ return [split [exec sort << [join $items "\n"]] "\n"]
+}; # bash_sort()
+
+
# Get hostnames
# @return list Hostnames
proc get_hosts {} {
@@ -467,16 +477,6 @@ proc get_signals {} {
}; # get_signals()
-# Sort list.
-# `exec sort' is used instead of `lsort' to achieve exactly the
-# same sort order as in bash.
-# @param list $items
-# @return list Sort list
-proc bash_sort {items} {
- return [split [exec sort << [join $items "\n"]] "\n"]
-}; # bash_sort()
-
-
# Initialize tcl globals with bash variables
proc init_tcl_bash_globals {} {
global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS
@@ -488,6 +488,12 @@ proc init_tcl_bash_globals {} {
}; # init_tcl_bash_globals()
+# Detect if test suite is running under Cygwin/Windows
+proc is_cygwin {} {
+ expr {[string first [string tolower [exec uname -s]] cygwin] >= 0}
+}; # is_cygwin()
+
+
# Expect items.
# Break items into chunks because `expect' seems to have a limited buffer size
# @param list $items
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index c5dd877..2e4591e 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -11,15 +11,22 @@ proc setup {} {
assert_bash_exec { \
complete -F _f -o filenames f2 \
}
- # Create directory `a*b'
- # NOTE: directory `a*b' isn't included in Git, because a directory
- # containing an asterisk (*) causes troubles on Cygwin/Windows
- assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
+ # Create directories `a*b' and `a\b' only when not running on Cygwin/Windows;
+ # directories containing `*' or `\' aren't allowed on Cygwin/Windows
+ if {! [is_cygwin]} {
+ # Create directory `a*b'
+ assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
+ # Create directory `a\b'
+ assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\\b ] && mkdir a\\b && touch a\\b/g || true)}
+ }; # if
}; # setup()
proc teardown {} {
- assert_bash_exec {(cd fixtures/_filedir && rm -- a\*b/j && rmdir a\*b/ || true)}
+ if {! [is_cygwin]} {
+ assert_bash_exec {(cd fixtures/_filedir && rm -- a\\b/g && rmdir a\\b/ || true)}
+ assert_bash_exec {(cd fixtures/_filedir && rm -- a\*b/j && rmdir a\*b/ || true)}
+ }; # if
assert_bash_exec {unset COMPREPLY cur}
assert_bash_exec {unset -f _f}
assert_bash_exec {complete -r f}
@@ -79,12 +86,17 @@ foreach name {f f2} {
sync_after_int
- set test "completing $name a\\\\b/ should return g"
- set cmd "$name a\\\\b/"
- assert_complete_dir g $cmd "fixtures/_filedir"
+ # Execute these tests only when not running on Cygwin/Windows, because
+ # directories containing asterisk (*) or backslash (\) aren't allowed on
+ # Cygwin/Windows
+ if {! [is_cygwin]} {
+ set test "completing $name a\\\\b/ should return g"
+ set cmd "$name a\\\\b/"
+ assert_complete_dir g $cmd "fixtures/_filedir"
- sync_after_int
+ sync_after_int
+ }; # if
set test "completing $name a\\&b/ should return f"
@@ -147,12 +159,16 @@ foreach name {f f2} {
sync_after_int
- set test "completing $name 'a\\b/ should return g"
- set cmd "$name 'a\\b/"
- assert_complete_dir {g'} $cmd "fixtures/_filedir"
+ # Execute these tests only when not running on Cygwin/Windows, because
+ # directories containing `*' or `\' aren't allowed on Cygwin/Windows
+ if {! [is_cygwin]} {
+ set test "completing $name 'a\\b/ should return g"
+ set cmd "$name 'a\\b/"
+ assert_complete_dir {g'} $cmd "fixtures/_filedir"
- sync_after_int
+ sync_after_int
+ }; # if
set test "completing $name 'a&b/ should return f"
--
bash-completion
More information about the Bash-completion-commits
mailing list