Add test for custom add-on action completion.

This commit is contained in:
Ingo Karkat
2012-02-28 10:27:28 +01:00
parent c9a158338b
commit f4145348d0
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#!/bin/bash
#
test_description='Bash add-on action completion functionality
This test checks todo_completion of custom actions in .todo.actions.d
'
. ./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'
readonly ADDONS='bar baz foobar'
mkdir "$HOME/.todo.actions.d"
for addon in $ADDONS
do
> "$HOME/.todo.actions.d/$addon"
chmod +x "$HOME/.todo.actions.d/$addon"
done
test_todo_completion 'all arguments' 'todo.sh ' "$ACTIONS $ADDONS $OPTIONS"
test_todo_completion 'all arguments after option' 'todo.sh -a ' "$ACTIONS $ADDONS $OPTIONS"
test_todo_completion 'all arguments beginning with b' 'todo.sh b' 'bar baz'
test_todo_completion 'all arguments beginning with f after options' 'todo.sh -a -v f' 'foobar'
test_todo_completion 'nothing after addon action' 'todo.sh foobar ' ''
test_done