diff --git a/tests/README b/tests/README index 971c94c..23ca241 100644 --- a/tests/README +++ b/tests/README @@ -197,6 +197,11 @@ library for your script to use. context of the last argument. should state what it is testing. + - test_todo_custom_completion + + Same as above, but in addition allows to specify a custom + completion function. + - test_tick [interval] The test harness has an internal view of time which is diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 3e56af3..7c494d7 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -632,9 +632,11 @@ EOF exit 0 } -test_todo_completion () { - test "$#" = 3 || - error "bug in the test script: not 3 parameters to test_todo_completion" +test_todo_custom_completion () { + test "$#" = 4 || + error "bug in the test script: not 4 parameters to test_todo_custom_completion" + completeFunc=$1 + shift if ! test_skip "$@" then description=$1 @@ -657,7 +659,7 @@ test_todo_completion () { EXPECT=("$@") source "$TEST_DIRECTORY/../todo_completion" - _todo + $completeFunc ret=$? if [ "$ret" = 0 ] then @@ -684,6 +686,11 @@ $(test_cmp expect compreply)" fi echo >&3 "" } +test_todo_completion () { + test "$#" = 3 || + error "bug in the test script: not 3 parameters to test_todo_completion" + test_todo_custom_completion _todo "$@" +} test_init_todo "$test" # Use -P to resolve symlinks in our working directory so that the pwd