Skip to content

Commit

Permalink
Tests: Add basic coverage of -h / shorthelp.
Browse files Browse the repository at this point in the history
For a start, this is basically an adapted version of tests/t2100-help.sh.
  • Loading branch information
inkarkat committed Aug 30, 2012
1 parent da68336 commit 50aea1e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/t2120-shorthelp.sh
@@ -0,0 +1,39 @@
#!/bin/bash
#

test_description='shorthelp functionality
This test covers the output of the -h option and the shorthelp action.
'
. ./actions-test-lib.sh
. ./test-lib.sh

# Note: To avoid having to adapt the test whenever the actions change, only
# check for the section headers.
test_todo_session '-h output' <<EOF
>>> todo.sh -h | sed '/^ [A-Z]/!d'
Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description]
Actions:
Actions can be added and overridden using scripts in the actions
See "help" for more details.
EOF

test_todo_session 'shorthelp output' <<EOF
>>> todo.sh shorthelp | sed '/^ [A-Z]/!d'
Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description]
Actions:
Actions can be added and overridden using scripts in the actions
See "help" for more details.
EOF

make_action "foo"
test_todo_session 'shorthelp output with custom action' <<EOF
>>> todo.sh -v shorthelp | sed '/^ [A-Z]/!d'
Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description]
Actions:
Actions can be added and overridden using scripts in the actions
Add-on Actions:
See "help" for more details.
EOF

test_done

0 comments on commit 50aea1e

Please sign in to comment.