@@ -48,10 +48,12 @@ load 'util/init.sh'
48
48
mkdir ' completions'
49
49
touch ' completions/prof.bash'
50
50
}; test_util.finish_pkg
51
+ test_util.fake_add " $pkg "
51
52
52
53
run do-plumbing-link-completions " $site /$pkg "
53
54
54
- ! [ -f " $BPM_INSTALL_COMPLETIONS /bash/prof.bash" ]
55
+ assert_success
56
+ assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prof.bash" ]
55
57
}
56
58
57
59
@test " adds bash completions determined from bpm.toml" {
@@ -80,15 +82,18 @@ load 'util/init.sh'
80
82
mkdir ' completions'
81
83
touch ' completions/prof.bash'
82
84
}; test_util.finish_pkg
85
+ test_util.fake_add " $pkg "
83
86
84
87
run do-plumbing-link-completions " $site /$pkg "
85
88
86
- ! [ -f " $BPM_INSTALL_COMPLETIONS /bash/prof.bash" ]
89
+ assert_success
90
+ assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prof.bash" ]
87
91
}
88
92
89
93
@test " adds bash completions determined with heuristics (./?(contrib/)completion?(s))" {
90
94
local site=' github.com'
91
- local pkg=" username/package$i "
95
+ local pkg=" username/package"
96
+
92
97
test_util.setup_pkg " $pkg " ; {
93
98
mkdir -p ./{contrib/,}completion{,s}
94
99
touch " completion/c1.bash"
@@ -107,6 +112,23 @@ load 'util/init.sh'
107
112
assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /bash/c4.bash" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /contrib/completions/c4.bash" ]
108
113
}
109
114
115
+ @test " adds bash completions determined with heuristics (root directory)" {
116
+ local site=' github.com'
117
+ local pkg=" username/package"
118
+
119
+ test_util.setup_pkg " $pkg " ; {
120
+ mkdir ' etc'
121
+
122
+ touch ' git-flow-completion.bash'
123
+ touch ' etc/some-completion.bash'
124
+ }; test_util.finish_pkg
125
+ test_util.fake_add " $pkg "
126
+
127
+ assert_success
128
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /bash/git-flow-completion.bash" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /git-flow-completion.bash" ]
129
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /bash/some-completion.bash" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /etc/some-completion.bash" ]
130
+ }
131
+
110
132
@test " adds bash completions determined with heuristics (share/etc)" {
111
133
local site=' github.com'
112
134
local pkg=' username/package'
@@ -148,7 +170,8 @@ load 'util/init.sh'
148
170
149
171
run do-plumbing-link-completions " $site /$pkg "
150
172
151
- [ -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
173
+ assert_success
174
+ assert [ -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
152
175
}
153
176
154
177
@test " do not add bash completions from heuristics when BASH_COMPLETIONS is specified in package.sh" {
@@ -164,7 +187,8 @@ load 'util/init.sh'
164
187
165
188
run do-plumbing-link-completions " $site /$pkg "
166
189
167
- [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
190
+ assert_success
191
+ assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
168
192
}
169
193
170
194
@test " do not add bash completions from heuristics when completionDirs is specified in bpm.toml" {
@@ -180,10 +204,32 @@ load 'util/init.sh'
180
204
181
205
run do-plumbing-link-completions " $site /$pkg "
182
206
207
+ assert_success
183
208
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
184
209
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
185
210
}
186
211
212
+ @test " bash completions without file extension have an extension appended" {
213
+ local site=' github.com'
214
+ local pkg=" username/package"
215
+
216
+ test_util.setup_pkg " $pkg " ; {
217
+ mkdir -p ' share/bash-completion/completions'
218
+
219
+ touch ' share/bash-completion/completions/seven'
220
+ }; test_util.finish_pkg
221
+ test_util.fake_add " $pkg "
222
+
223
+ run do-plumbing-link-completions " $site /$pkg "
224
+
225
+ assert_success
226
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /bash/seven.bash" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /share/bash-completion/completions/seven" ]
227
+
228
+ assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
229
+ assert [ ! -f " $BPM_INSTALL_COMPLETIONS /bash/prog.bash" ]
230
+ }
231
+
232
+
187
233
# # ZSH ##
188
234
189
235
@test " adds zsh compsys completions determined from package.sh" {
@@ -274,6 +320,23 @@ load 'util/init.sh'
274
320
assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /zsh/compsys//c4.zsh" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /contrib/completions/c4.zsh" ]
275
321
}
276
322
323
+ @test " adds zsh completions determined with heuristics (root directory)" {
324
+ local site=' github.com'
325
+ local pkg=" username/package"
326
+
327
+ test_util.setup_pkg " $pkg " ; {
328
+ mkdir ' etc'
329
+
330
+ touch ' git-flow-completion.zsh'
331
+ touch ' etc/some-completion.zsh'
332
+ }; test_util.finish_pkg
333
+ test_util.fake_add " $pkg "
334
+
335
+ assert_success
336
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /zsh/compctl/git-flow-completion.zsh" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /git-flow-completion.zsh" ]
337
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /zsh/compctl/some-completion.zsh" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /etc/some-completion.zsh" ]
338
+ }
339
+
277
340
@test " adds zsh completions determined from heuristics when when BASH_COMPLETIONS is specified in package.sh" {
278
341
local site=' github.com'
279
342
local pkg=" username/package"
@@ -306,6 +369,7 @@ load 'util/init.sh'
306
369
307
370
run do-plumbing-link-completions " $site /$pkg "
308
371
372
+ assert_success
309
373
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /zsh/compctl/prog.zsh" ]
310
374
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /zsh/compsys/prog.zsh" ]
311
375
}
@@ -323,10 +387,15 @@ load 'util/init.sh'
323
387
324
388
run do-plumbing-link-completions " $site /$pkg "
325
389
390
+ assert_success
326
391
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /zsh/compctl/prog.zsh" ]
327
392
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /zsh/compsys/prog.zsh" ]
328
393
}
329
394
395
+ @test " zsh completions without file extension have an extension appended" {
396
+ skip
397
+ }
398
+
330
399
331
400
# # FISH ##
332
401
@@ -356,15 +425,18 @@ load 'util/init.sh'
356
425
mkdir ' completions'
357
426
touch ' completions/prof.fish'
358
427
}; test_util.finish_pkg
428
+ test_util.fake_add " $pkg "
359
429
360
430
run do-plumbing-link-completions " $site /$pkg "
361
431
362
- ! [ -f " $BPM_INSTALL_COMPLETIONS /fish/prof.fish" ]
432
+ assert_success
433
+ assert_success [ ! -f " $BPM_INSTALL_COMPLETIONS /fish/prof.fish" ]
363
434
}
364
435
365
436
@test " adds fish completions determined with heuristics (./?(contrib/)completion?(s))" {
366
437
local site=' github.com'
367
- local pkg=" username/package$i "
438
+ local pkg=" username/package"
439
+
368
440
test_util.setup_pkg " $pkg " ; {
369
441
mkdir -p ./{contrib/,}completion{,s}
370
442
touch " completion/c1.fish"
@@ -383,6 +455,23 @@ load 'util/init.sh'
383
455
assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /fish/c4.fish" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /contrib/completions/c4.fish" ]
384
456
}
385
457
458
+ @test " adds fish completions determined with heuristics (root directory)" {
459
+ local site=' github.com'
460
+ local pkg=" username/package"
461
+
462
+ test_util.setup_pkg " $pkg " ; {
463
+ mkdir ' etc'
464
+
465
+ touch ' git-flow-completion.fish'
466
+ touch ' etc/some-completion.fish'
467
+ }; test_util.finish_pkg
468
+ test_util.fake_add " $pkg "
469
+
470
+ assert_success
471
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /fish/git-flow-completion.fish" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /git-flow-completion.fish" ]
472
+ assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /fish/some-completion.fish" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /etc/some-completion.fish" ]
473
+ }
474
+
386
475
@test " do not add fish completions from heuristics when completionDirs is specified in bpm.toml" {
387
476
local site=' github.com'
388
477
local pkg=" username/package"
@@ -396,6 +485,7 @@ load 'util/init.sh'
396
485
397
486
run do-plumbing-link-completions " $site /$pkg "
398
487
488
+ assert_success
399
489
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /fish/prog.fish" ]
400
490
assert [ ! -f " $BPM_INSTALL_COMPLETIONS /fish/prog.fish" ]
401
491
}
@@ -418,6 +508,7 @@ load 'util/init.sh'
418
508
419
509
run do-plumbing-link-completions " $site /$pkg "
420
510
511
+ assert_success
421
512
assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /fish/prog.fish" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /completion/prog.fish" ]
422
513
assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /bash/prog1.bash" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /completion/prog1.bash" ]
423
514
assert [ " $( readlink " $BPM_INSTALL_COMPLETIONS /bash/prog2.bash" ) " = " $BPM_PACKAGES_PATH /$site /$pkg /completions/prog2.bash" ]
0 commit comments