From 7ab90476f73d89dba2d0327006daf3f452edafbe Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Fri, 27 Apr 2012 11:34:46 +0200 Subject: [PATCH] Tests: Add test for ordinary help. --- tests/t2100-help.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 tests/t2100-help.sh diff --git a/tests/t2100-help.sh b/tests/t2100-help.sh new file mode 100755 index 0000000..16de5a0 --- /dev/null +++ b/tests/t2100-help.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# + +test_description='help functionality + +This test covers the help output. +' +. ./test-lib.sh + +unset TODO_ACTIONS_DIR + +# Note: To avoid having to adapt the test whenever the help documentation +# slightly changes, only check for the section headers. +test_todo_session 'help output' <>> todo.sh help | sed '/^ \w/!d' + Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description] + Options: + Built-in Actions: +EOF + +test_todo_session 'verbose help output' <>> todo.sh -v help | sed '/^ \w/!d' + Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description] + Options: + Built-in Actions: +EOF + +test_todo_session 'very verbose help output' <>> todo.sh -vv help | sed '/^ \w/!d' + Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description] + Options: + Environment variables: + Built-in Actions: +EOF + +mkdir .todo.actions.d +make_action() +{ + cat > ".todo.actions.d/$1" <<- EOF + #!/bin/bash + echo "custom action $1" +EOF +chmod +x ".todo.actions.d/$1" +} + +make_action "foo" +test_todo_session 'help output with custom action' <>> todo.sh -v help | sed '/^ \w/!d' + Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description] + Options: + Built-in Actions: + Add-on Actions: +EOF + +test_done