Skip to content

Commit 1a7137f

Browse files
committed
test suite: Generalize xspec completion install check
Extract from acroread, use for kdvi, kpdf, and vi in addition to it. Fixes #130
1 parent 0a32296 commit 1a7137f

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

test/completion/acroread.exp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
set test "Completion via _filedir_xspec() should be installed"
2-
set cmd "complete -p acroread"
3-
send "$cmd\r"
4-
5-
set expected "^$cmd\r\ncomplete -F _filedir_xspec acroread\r\n/@$"
6-
expect {
7-
-re $expected { pass "$test" }
8-
-re /@ { fail "$test at prompt" }
9-
}; # expect
10-
1+
assert_xspec_completion_installed acroread
112

123
source "$::srcdir/lib/completions/acroread.exp"

test/completion/kdvi.exp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
assert_source_completions kdvi
1+
assert_xspec_completion_installed kdvi
2+
3+
source "$::srcdir/lib/completions/kdvi.exp"

test/completion/kpdf.exp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
assert_source_completions kpdf
1+
assert_xspec_completion_installed kpdf
2+
3+
source "$::srcdir/lib/completions/kpdf.exp"

test/completion/vi.exp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
assert_source_completions vi
1+
assert_xspec_completion_installed vi
2+
3+
source "$::srcdir/lib/completions/vi.exp"

test/lib/library.exp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,21 @@ proc assert_source_completions {command {file ""}} {
602602
}
603603

604604

605+
# Assert that a _filedir_xspec completion is installed for specified command
606+
# @param string $command Command to check completion installation for.
607+
proc assert_xspec_completion_installed {command} {
608+
set test "Completion via _filedir_xspec() should be installed"
609+
set cmd "complete -p $command"
610+
send "$cmd\r"
611+
612+
set expected "^$cmd\r\ncomplete -F _filedir_xspec $command\r\n/@$"
613+
expect {
614+
-re $expected { pass "$test" }
615+
-re /@ { fail "$test at prompt" }
616+
}
617+
}
618+
619+
605620
# Sort list.
606621
# `exec sort' is used instead of `lsort' to achieve exactly the
607622
# same sort order as in bash.

0 commit comments

Comments
 (0)