diff --git a/tests/t6000-completion.sh b/tests/t6000-completion.sh index babe13e..da60288 100755 --- a/tests/t6000-completion.sh +++ b/tests/t6000-completion.sh @@ -17,5 +17,6 @@ test_todo_completion 'all actions after command action' 'todo.sh command ' "$ACT test_todo_completion 'all arguments after option' 'todo.sh -a ' "$ACTIONS $OPTIONS" test_todo_completion 'all arguments after options' 'todo.sh -a -p ' "$ACTIONS $OPTIONS" test_todo_completion 'all options after options' 'todo.sh -a -p -' "$OPTIONS" +test_todo_completion 'nothing after action' 'todo.sh archive ' '' test_done diff --git a/tests/t6050-completion-addons.sh b/tests/t6050-completion-addons.sh new file mode 100755 index 0000000..376da5d --- /dev/null +++ b/tests/t6050-completion-addons.sh @@ -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