diff options
Diffstat (limited to 'git-check-commit-msg/run-tests.sh')
-rwxr-xr-x | git-check-commit-msg/run-tests.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/git-check-commit-msg/run-tests.sh b/git-check-commit-msg/run-tests.sh new file mode 100755 index 0000000..d3da61c --- /dev/null +++ b/git-check-commit-msg/run-tests.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +tcdir="${top_srcdir-.}" +script="${top_srcdir-.}/git-check-commit-msg/git-check-commit-msg" + +errors=0 + +while read tc expect restofline +do + tcfile="${tcdir}/git-check-commit-msg/${tc}" + test -s "$tcfile" || continue + + "$script" "$tcfile"; s="$?" + + if [ "$s" -eq 0 ] && [ "x$expect" = "xOK" ]; then :; + elif [ "$s" -ne 0 ] && [ "x$expect" = "xFAIL" ]; then :; + else + sh -x "$script" "$tcfile" + echo "TC: $tc expected $expect, but deviates." + errors="$(expr $errors + 1)" + fi +done<<EOF +commit-1 OK +commit-2 FAIL +commit-3 OK +EOF + +[ "$errors" -ne 0 ] && exit 1 |