Skip to content

Commit fec077d

Browse files
committed
(test suite): Remove test/fixtures/_filedir/a"b from git, create on the fly
Fixes #55, invalid chars in file names on Windows
1 parent 5017ee6 commit fec077d

File tree

2 files changed

+16
-28
lines changed

2 files changed

+16
-28
lines changed

test/fixtures/_filedir/a"b/d

Whitespace-only changes.

test/unit/_filedir.exp

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ proc setup {} {
2121
_fd() { local cur=$(_get_cword); unset COMPREPLY; _filedir -d; }; \
2222
complete -F _fd fd \
2323
}
24-
# Create directories `a*b' and `a\b' only when not running on Cygwin/Windows;
25-
# directories containing `*' or `\' aren't allowed on Cygwin/Windows
24+
# Create directories `a"b', `a*b', and `a\b' only when not running on
25+
# Cygwin/Windows (`"', `*', or `\' aren't allowed in filenames there)
2626
if {! [is_cygwin]} {
27+
# Create directory `a"b'
28+
assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\"b ] && mkdir a\"b && touch a\"b/d || true)}
2729
# Create directory `a*b'
2830
assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
2931
# Create directory `a\b'
@@ -34,6 +36,7 @@ proc setup {} {
3436

3537
proc teardown {} {
3638
if {! [is_cygwin]} {
39+
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\"b/d && rmdir a\"b/ || true)}
3740
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\\b/g && rmdir a\\b/ || true)}
3841
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
3942
}
@@ -83,14 +86,6 @@ foreach name {f f2} {
8386
sync_after_int
8487

8588

86-
set test "completing $name a\\\"b/ should return d"; #"
87-
set cmd "$name a\\\"b/"; #"
88-
assert_complete_dir d $cmd "$::srcdir/fixtures/_filedir" $test
89-
90-
91-
sync_after_int
92-
93-
9489
set test "completing $name a\\\$b/ should return h"
9590
set cmd "$name a\\\$b/"
9691
assert_complete_dir h $cmd "$::srcdir/fixtures/_filedir" $test
@@ -99,15 +94,15 @@ foreach name {f f2} {
9994
sync_after_int
10095

10196

102-
# Execute these tests only when not running on Cygwin/Windows, because
103-
# directories containing asterisk (*) or backslash (\) aren't allowed on
104-
# Cygwin/Windows
105-
if {! [is_cygwin]} {
97+
if {! [is_cygwin]} { # Illegal characters in file/dir names
98+
set test "completing $name a\\\"b/ should return d"; #"
99+
set cmd "$name a\\\"b/"; #"
100+
assert_complete_dir d $cmd "$TESTDIR/tmp" $test
101+
sync_after_int
102+
106103
set test "completing $name a\\\\b/ should return g"
107104
set cmd "$name a\\\\b/"
108105
assert_complete_dir g $cmd "$TESTDIR/tmp" $test
109-
110-
111106
sync_after_int
112107
}
113108

@@ -142,27 +137,20 @@ foreach name {f f2} {
142137
sync_after_int
143138

144139

145-
set cmd "$name 'a\"b/"; #"
146-
assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
147-
148-
149-
sync_after_int
150-
151-
152140
set cmd "$name 'a\$b/"
153141
assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
154142

155143

156144
sync_after_int
157145

158146

159-
# Execute these tests only when not running on Cygwin/Windows, because
160-
# directories containing `*' or `\' aren't allowed on Cygwin/Windows
161-
if {! [is_cygwin]} {
147+
if {! [is_cygwin]} { # Illegal characters in file/dir names
148+
set cmd "$name 'a\"b/"; #"
149+
assert_complete_dir {d'} $cmd "$TESTDIR/tmp"
150+
sync_after_int
151+
162152
set cmd "$name '$TESTDIR/tmp/a\\b/"
163153
assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
164-
165-
166154
sync_after_int
167155
}
168156

0 commit comments

Comments
 (0)