Skip to content

Commit f4ffafe

Browse files
committed
test suite: If colon trim doesn't do anything, trim as usual
If -ltrim-colon-completions is specified for assert_complete_one and there's no colon in the string to trim, trim just its prefix like in other cases. References #123
1 parent 8c5283f commit f4ffafe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/lib/library.exp

+6-2
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ proc assert_complete_one {expected cmd {test ""} {args {}}} {
253253
if {$test == ""} {set test "$cmd should show completion"}
254254
send "$cmd\t"
255255
expect -ex "$cmd"
256+
set trimmed false
256257
if {$arg(ltrim-colon-completions)} {
257258
# If partial contains colon (:), remove partial from begin of items
258-
_ltrim_colon_completions $cmd expected cword
259-
} else {
259+
set trimmed [_ltrim_colon_completions $cmd expected cword]
260+
}
261+
if {! $trimmed} {
260262
set cur ""; # Default to empty word to complete on
261263
set words [split_words_bash $cmd]
262264
if {[llength $words] > 1} {
@@ -437,7 +439,9 @@ proc _ltrim_colon_completions {cmd items dword} {
437439
lset items_out $i [string range $item [string length $cur] end]
438440
}
439441
}
442+
return true
440443
}
444+
return false
441445
}
442446

443447

0 commit comments

Comments
 (0)