Skip to content

Commit 69c318a

Browse files
committed
test/unit: Whitespace tweaks
1 parent add4e3c commit 69c318a

File tree

10 files changed

+35
-363
lines changed

10 files changed

+35
-363
lines changed

test/unit/__expand_tilde_by_ref.exp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,80 +23,51 @@ setup home user
2323

2424
set test "function should run without errors"
2525
assert_bash_exec {__expand_tilde_by_ref > /dev/null} $test
26-
27-
2826
sync_after_int
2927

30-
3128
set test "function should not pollute environment"
3229
# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown()
3330
assert_bash_exec {foo() { local aa="~"; __expand_tilde_by_ref aa; }; foo; unset foo} $test
34-
35-
3631
sync_after_int
3732

38-
3933
set test "~user should return $home"
4034
set cmd [format {var="~%s"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
4135
assert_bash_list "$home" $cmd $test
42-
43-
4436
sync_after_int
4537

46-
4738
set test "~/foo should return $home/foo"
4839
set cmd {var='~/foo'; __expand_tilde_by_ref var; printf "%s\n" "$var"}
4940
assert_bash_list "$home/foo" $cmd $test
50-
51-
5241
sync_after_int
5342

54-
5543
set test "~user/bar should return $home/bar"
5644
set cmd [format {var="~%s/bar"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
5745
assert_bash_list "$home/bar" $cmd $test
58-
59-
6046
sync_after_int
6147

62-
6348
set test "~user/\$HOME should return $home/\$HOME"
6449
set cmd [format {var="~%s/\$HOME"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
6550
assert_bash_list "$home/\$HOME" $cmd $test
66-
67-
6851
sync_after_int
6952

70-
7153
set test "'~user/a b' should return '$home/a b'"
7254
set cmd [format {var="~%s/a b"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
7355
assert_bash_list [list [format {%s/a b} $home]] $cmd $test
74-
75-
7656
sync_after_int
7757

78-
7958
set test "~user/* should return $home/*"
8059
set cmd [format {var="~%s/*"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
8160
assert_bash_list "$home/\*" $cmd $test
82-
83-
8461
sync_after_int
8562

86-
8763
set test "'~user;echo hello' should return '~user;echo hello' (not expanded)"
8864
set cmd [format {var="~%s;echo hello"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
8965
assert_bash_list [format "~%s;echo hello" $user] $cmd $test
90-
91-
9266
sync_after_int
9367

94-
9568
set test "'~user/a;echo hello' should return '$home/a;echo hello'"
9669
set cmd [format {var="~%s/a;echo hello"; __expand_tilde_by_ref var; printf "%%s\n" "$var"} $user]
9770
assert_bash_list "$home/a;echo hello" $cmd $test
98-
99-
10071
sync_after_int
10172

10273

test/unit/_count_args.exp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,31 @@ setup
2020

2121
set test "_count_args should run without errors"
2222
assert_bash_exec {_count_args > /dev/null} $test
23-
24-
2523
sync_after_int
2624

27-
2825
set test "a b| should set args to 1"; # | = cursor position
2926
set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _count_args; echo $args}
3027
assert_bash_list 1 $cmd $test
31-
32-
3328
sync_after_int
3429

35-
3630
set test "a b|c should set args to 1"; # | = cursor position
3731
set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _count_args; echo $args}
3832
assert_bash_list 1 $cmd $test
39-
40-
4133
sync_after_int
4234

43-
4435
set test "a b c| should set args to 2"; # | = cursor position
4536
set cmd {COMP_WORDS=(a b c); COMP_CWORD=2; COMP_LINE='a b c'; COMP_POINT=4; _count_args; echo $args}
4637
assert_bash_list 2 $cmd $test
47-
48-
4938
sync_after_int
5039

51-
5240
set test "a b| c should set args to 1"; # | = cursor position
5341
set cmd {COMP_WORDS=(a b c); COMP_CWORD=1; COMP_LINE='a b c'; COMP_POINT=3; _count_args; echo $args}
5442
assert_bash_list 1 $cmd $test
55-
56-
5743
sync_after_int
5844

59-
6045
set test "a b -c| d should set args to 2"; # | = cursor position
6146
set cmd {COMP_WORDS=(a b -c d); COMP_CWORD=2; COMP_LINE='a b -c d'; COMP_POINT=6; _count_args; echo $args}
6247
assert_bash_list 2 $cmd $test
63-
64-
6548
sync_after_int
6649

6750

test/unit/_expand.exp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,16 @@ set test "function should run without errors"
2323
assert_bash_exec {_expand > /dev/null} $test
2424
sync_after_int
2525

26-
2726
set test "function should not pollute environment"
2827
# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown()
2928
assert_bash_exec {foo() { _expand; }; foo; unset foo} $test
3029
sync_after_int
3130

32-
3331
set test "~$user should set $home to COMPREPLY"
3432
set cmd [format {cur="~%s" ; _expand ; printf "%%s\n" "$COMPREPLY"} $user]
3533
assert_bash_list "$home" $cmd $test
3634
sync_after_int
3735

38-
3936
set test "~$user/a should set $home/a to cur"
4037
set cmd [format {cur="~%s/a" ; _expand ; printf "%%s\n" "$cur"} $user]
4138
assert_bash_list "$home/a" $cmd $test

test/unit/_filedir.exp

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -55,37 +55,25 @@ setup
5555

5656
set test "_filedir should run without errors"
5757
assert_bash_exec {_filedir > /dev/null} $test
58-
59-
6058
sync_after_int
6159

62-
6360
foreach name {f f2} {
6461

6562
set test "completing $name ab/ should return e"
6663
set cmd "$name ab/"
6764
assert_complete_dir e $cmd "$::srcdir/fixtures/_filedir" $test
68-
69-
7065
sync_after_int
7166

72-
7367
set test "completing $name a\\ b/ should return i"
7468
set cmd "$name a\\ b/"
7569
assert_complete_dir i $cmd "$::srcdir/fixtures/_filedir" $test
76-
77-
7870
sync_after_int
7971

80-
8172
set test "completing $name a\\\'b/ should return c"
8273
set cmd "$name a\\\'b/"
8374
assert_complete_dir c $cmd "$::srcdir/fixtures/_filedir" $test
84-
85-
8675
sync_after_int
8776

88-
8977
set test "completing $name a\\\$b/ should return h"
9078
if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} {
9179
xfail $test
@@ -95,7 +83,6 @@ foreach name {f f2} {
9583
sync_after_int
9684
}
9785

98-
9986
if {! [is_cygwin]} { # Illegal characters in file/dir names
10087
set test "completing $name a\\\"b/ should return d"; #"
10188
set cmd "$name a\\\"b/"; #"
@@ -108,44 +95,28 @@ foreach name {f f2} {
10895
sync_after_int
10996
}
11097

111-
11298
set test "completing $name a\\&b/ should return f"
11399
set cmd "$name a\\&b/"
114100
assert_complete_dir f $cmd "$::srcdir/fixtures/_filedir" $test
115-
116-
117101
sync_after_int
118102

119-
120103
set test "completing $name a\$ should return a\\\$b/"
121104
set cmd "$name a\$"
122105
assert_complete_dir "\b\\\\\$b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace
123-
124-
125106
sync_after_int
126107

127-
128108
set cmd "$name 'ab/"
129109
assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
130-
131-
132110
sync_after_int
133111

134-
135112
set cmd "$name 'a b/"
136113
assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
137-
138-
139114
sync_after_int
140115

141-
142116
set cmd "$name 'a\$b/"
143117
assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
144-
145-
146118
sync_after_int
147119

148-
149120
if {! [is_cygwin]} { # Illegal characters in file/dir names
150121
set cmd "$name 'a\"b/"; #"
151122
assert_complete_dir {d'} $cmd "$TESTDIR/tmp"
@@ -156,42 +127,28 @@ foreach name {f f2} {
156127
sync_after_int
157128
}
158129

159-
160130
set cmd "$name 'a&b/"
161131
assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
162-
163-
164132
sync_after_int
165133

166-
167134
set cmd "$name \"ab/"; #"
168135
assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
169-
170-
171136
sync_after_int
172137

173-
174138
set cmd "$name \"a b/"; #"
175139
assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
176-
177-
178140
sync_after_int
179141

180-
181142
set cmd "$name \"a'b/"; #"
182143
assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
183-
184-
185144
sync_after_int
186145

187-
188146
if {! [is_cygwin]} { # Illegal characters in file/dir names
189147
set cmd "$name \"a\\\"b/"; #"
190148
assert_complete_dir {d"} $cmd "$TESTDIR/tmp"; #"
191149
sync_after_int
192150
}
193151

194-
195152
if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} {
196153
xfail "$name \"a\\\$b/ should show completions"
197154
} else {
@@ -200,44 +157,28 @@ foreach name {f f2} {
200157
sync_after_int
201158
}
202159

203-
204160
set cmd "$name \"a\\b/"; #"
205161
assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
206-
207-
208162
sync_after_int
209163

210-
211164
set cmd "$name \"a\\\\b/"; #"
212165
assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
213-
214-
215166
sync_after_int
216167

217-
218168
set cmd "$name \"a&b/"; #"
219169
assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
220-
221-
222170
sync_after_int
223171

224-
225172
set cmd "$name \\\[x"
226173
assert_complete_dir {\[x\]} $cmd "$::srcdir/fixtures/_filedir/brackets"
227-
228-
229174
sync_after_int
230175

231176
}; # foreach
232177

233-
234178
set test "completing with filter '.e1' should show completions"
235179
assert_complete_dir {ee.e1 foo/ gg.e1 ii.E1} "g " "$::srcdir/fixtures/_filedir/ext" $test
236-
237-
238180
sync_after_int
239181

240-
241182
set test "completing f aé should return g"
242183
# Execute this test only with LC_CTYPE matching *UTF-8*
243184
# See also: http://www.mail-archive.com/bash-completion-devel\
@@ -252,16 +193,11 @@ if {
252193
} else {
253194
unsupported "$test"
254195
}
255-
256-
257196
sync_after_int
258197

259-
260198
set test "completing fd a\\ should return a\\ b/"
261199
set cmd "fd a\\ "
262200
assert_complete_dir "a\\ b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace
263-
264-
265201
sync_after_int
266202

267203

0 commit comments

Comments
 (0)