Refactoring: Extract make_action into actions-test-lib.sh.
This reduces the duplication in the individual test files.
This commit is contained in:
@@ -4,31 +4,15 @@ test_description='actions help functionality
|
||||
|
||||
This test checks listing the usage help of a custom action.
|
||||
'
|
||||
. ./actions-test-lib.sh
|
||||
. ./test-lib.sh
|
||||
|
||||
unset TODO_ACTIONS_DIR
|
||||
test_todo_session 'custom action help with no custom action directory' <<'EOF'
|
||||
>>> todo.sh help foo
|
||||
TODO: No actions directory exists.
|
||||
=== 1
|
||||
EOF
|
||||
|
||||
mkdir .todo.actions.d
|
||||
make_action()
|
||||
{
|
||||
cat > ".todo.actions.d/$1" <<EOF
|
||||
#!/bin/bash
|
||||
[ "\$1" = "usage" ] && {
|
||||
echo " $1 ITEM#[, ITEM#, ...] [TERM...]"
|
||||
echo " This custom action does $1."
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
echo "custom action $1"
|
||||
EOF
|
||||
chmod +x ".todo.actions.d/$1"
|
||||
}
|
||||
|
||||
make_action "foo"
|
||||
make_action "bar"
|
||||
make_action "quux"
|
||||
|
||||
Reference in New Issue
Block a user