Before adding any more features to todo_completion, I feel like I need test coverage, so this is a first stab at testing the completion results, via a new test function test_todo_completion. Some basic tests showcase the capabilities. Note: test-lib.sh now uses arrays, therefore all tests must use /bin/bash, not /bin/sh to avoid errors when sourcing test-lib. For consistency with todo.sh, we should have used Bash everywhere, anyway. Also note that t2000-multiline.sh needs some more quoting to avoid "Bash: ambiguous redirect" errors.
19 lines
753 B
Bash
Executable File
19 lines
753 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
|
|
test_description='Bash completion functionality
|
|
|
|
This test checks basic todo_completion of actions and options
|
|
'
|
|
. ./test-lib.sh
|
|
|
|
readonly ACTIONS='add a addto addm append app archive command del rm depri dp do help list ls listall lsa listcon lsc listfile lf listpri lsp listproj lsprj move mv prepend prep pri p replace report shorthelp'
|
|
readonly OPTIONS='-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x'
|
|
|
|
test_todo_completion 'all arguments' 'todo.sh ' "$ACTIONS $OPTIONS"
|
|
test_todo_completion 'arguments beginning with a' 'todo.sh a' 'add a addto addm append app archive'
|
|
test_todo_completion 'all options' 'todo.sh -' "$OPTIONS"
|
|
test_todo_completion 'all actions after command action' 'todo.sh command ' "$ACTIONS"
|
|
|
|
test_done
|