test-lib: Add test_todo_custom_completion variant.
This extension of test_todo_completion additionally takes the completion function to use, so that customized completions for todo.sh aliases can be tested.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user