(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)
This commit is contained in:
Freddy Vulto 2009-12-30 14:48:17 +01:00
parent 3251038c9d
commit f321c377af
3 changed files with 45 additions and 23 deletions

View File

View File

@ -417,6 +417,16 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
}; # assert_exec() }; # 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 # Get hostnames
# @return list Hostnames # @return list Hostnames
proc get_hosts {} { proc get_hosts {} {
@ -467,16 +477,6 @@ proc get_signals {} {
}; # 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 # Initialize tcl globals with bash variables
proc init_tcl_bash_globals {} { proc init_tcl_bash_globals {} {
global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS
@ -488,6 +488,12 @@ proc init_tcl_bash_globals {} {
}; # 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. # Expect items.
# Break items into chunks because `expect' seems to have a limited buffer size # Break items into chunks because `expect' seems to have a limited buffer size
# @param list $items # @param list $items

View File

@ -11,15 +11,22 @@ proc setup {} {
assert_bash_exec { \ assert_bash_exec { \
complete -F _f -o filenames f2 \ complete -F _f -o filenames f2 \
} }
# Create directory `a*b' # Create directories `a*b' and `a\b' only when not running on Cygwin/Windows;
# NOTE: directory `a*b' isn't included in Git, because a directory # directories containing `*' or `\' aren't allowed on Cygwin/Windows
# containing an asterisk (*) causes troubles on Cygwin/Windows if {! [is_cygwin]} {
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/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() }; # setup()
proc teardown {} { 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 COMPREPLY cur}
assert_bash_exec {unset -f _f} assert_bash_exec {unset -f _f}
assert_bash_exec {complete -r f} assert_bash_exec {complete -r f}
@ -79,12 +86,17 @@ foreach name {f f2} {
sync_after_int sync_after_int
set test "completing $name a\\\\b/ should return g" # Execute these tests only when not running on Cygwin/Windows, because
set cmd "$name a\\\\b/" # directories containing asterisk (*) or backslash (\) aren't allowed on
assert_complete_dir g $cmd "fixtures/_filedir" # 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" set test "completing $name a\\&b/ should return f"
@ -147,12 +159,16 @@ foreach name {f f2} {
sync_after_int sync_after_int
set test "completing $name 'a\\b/ should return g" # Execute these tests only when not running on Cygwin/Windows, because
set cmd "$name 'a\\b/" # directories containing `*' or `\' aren't allowed on Cygwin/Windows
assert_complete_dir {g'} $cmd "fixtures/_filedir" 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" set test "completing $name 'a&b/ should return f"