From 50aea1e4f001bf988d851f5f4e45b8e61981f204 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Thu, 30 Aug 2012 12:20:09 +0200 Subject: [PATCH] Tests: Add basic coverage of -h / shorthelp. For a start, this is basically an adapted version of tests/t2100-help.sh. --- tests/t2120-shorthelp.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 tests/t2120-shorthelp.sh diff --git a/tests/t2120-shorthelp.sh b/tests/t2120-shorthelp.sh new file mode 100755 index 0000000..8a08de0 --- /dev/null +++ b/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' <>> 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' <>> 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' <>> 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