Refactoring: Extract make_action into actions-test-lib.sh.

This reduces the duplication in the individual test files.
This commit is contained in:
Ingo Karkat
2012-04-27 12:42:10 +02:00
parent 42424d5881
commit 99e5e57a75
5 changed files with 22 additions and 51 deletions

18
tests/actions-test-lib.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
make_action()
{
unset TODO_ACTIONS_DIR
[ -d .todo.actions.d ] || mkdir .todo.actions.d
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"
}