test-lib: Allow completions containing whitespace.

This is necessary to test the completion of task text.
This commit is contained in:
Ingo Karkat
2012-02-28 09:38:57 +01:00
parent e5a308eb03
commit ebce735d04
2 changed files with 8 additions and 6 deletions

View File

@@ -191,11 +191,13 @@ library for your script to use.
This takes three strings as parameter. Based on <cmdline>, This takes three strings as parameter. Based on <cmdline>,
the todo_completion script is triggered in the current test the todo_completion script is triggered in the current test
environment and completions are compared with <completions>, environment and completions are compared with <completions>,
which should be a space-separated list. Include a trailing which should be a space-separated list. If any completion
space in <cmdline> when you want to check new argument contains whitespace, quote it; the entire <completions>
completion; otherwise, completion is triggered with the argument is eval()'ed.
context of the last argument. <message> should state what it Include a trailing space in <cmdline> when you want to check
is testing. new argument completion; otherwise, completion is triggered
with the context of the last argument. <message> should state
what it is testing.
- test_todo_custom_completion <completefunc> <message> <cmdline> <completions> - test_todo_custom_completion <completefunc> <message> <cmdline> <completions>

View File

@@ -655,7 +655,7 @@ test_todo_custom_completion () {
IFS=' ' set -- $2 IFS=' ' set -- $2
COMP_WORDS=("$@") COMP_WORDS=("$@")
COMP_CWORD=$(($# - $offset)) COMP_CWORD=$(($# - $offset))
IFS=' ' set -- $expected IFS=' ' eval "set -- $expected"
EXPECT=("$@") EXPECT=("$@")
source "$TEST_DIRECTORY/../todo_completion" source "$TEST_DIRECTORY/../todo_completion"