Add test for custom add-on action completion.
This commit is contained in:
@@ -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 option' 'todo.sh -a ' "$ACTIONS $OPTIONS"
|
||||||
test_todo_completion 'all arguments after options' 'todo.sh -a -p ' "$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 'all options after options' 'todo.sh -a -p -' "$OPTIONS"
|
||||||
|
test_todo_completion 'nothing after action' 'todo.sh archive ' ''
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|||||||
26
tests/t6050-completion-addons.sh
Executable file
26
tests/t6050-completion-addons.sh
Executable 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
|
||||||
Reference in New Issue
Block a user