@@ -21,9 +21,11 @@ proc setup {} {
21
21
_fd() { local cur=$(_get_cword); unset COMPREPLY; _filedir -d; }; \
22
22
complete -F _fd fd \
23
23
}
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)
26
26
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)}
27
29
# Create directory `a*b'
28
30
assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
29
31
# Create directory `a\b'
@@ -34,6 +36,7 @@ proc setup {} {
34
36
35
37
proc teardown {} {
36
38
if {! [is_cygwin]} {
39
+ assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\"b/d && rmdir a\"b/ || true)}
37
40
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\\b/g && rmdir a\\b/ || true)}
38
41
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
39
42
}
@@ -83,14 +86,6 @@ foreach name {f f2} {
83
86
sync_after_int
84
87
85
88
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
-
94
89
set test "completing $name a\\\$b/ should return h"
95
90
set cmd "$name a\\\$b/"
96
91
assert_complete_dir h $cmd "$::srcdir/fixtures/_filedir" $test
@@ -99,15 +94,15 @@ foreach name {f f2} {
99
94
sync_after_int
100
95
101
96
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
+
106
103
set test "completing $name a\\\\b/ should return g"
107
104
set cmd "$name a\\\\b/"
108
105
assert_complete_dir g $cmd "$TESTDIR/tmp" $test
109
-
110
-
111
106
sync_after_int
112
107
}
113
108
@@ -142,27 +137,20 @@ foreach name {f f2} {
142
137
sync_after_int
143
138
144
139
145
- set cmd "$name 'a\"b/"; #"
146
- assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
147
-
148
-
149
- sync_after_int
150
-
151
-
152
140
set cmd "$name 'a\$b/"
153
141
assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
154
142
155
143
156
144
sync_after_int
157
145
158
146
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
+
162
152
set cmd "$name '$TESTDIR/tmp/a\\b/"
163
153
assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
164
-
165
-
166
154
sync_after_int
167
155
}
168
156
0 commit comments