summaryrefslogtreecommitdiffstats
path: root/git-check-commit-msg/run-tests.sh
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-12-01 23:57:17 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-12-01 23:57:17 +0100
commit9e51706711de4b036ec47bc1b171bccee7f40028 (patch)
tree2f38d91d79c9599b0654824780e044ebcb7ac9c1 /git-check-commit-msg/run-tests.sh
parentde4c8618f2010655dab9eca75c2cc1fc82ef6273 (diff)
Implement git-check-commit-msg
Diffstat (limited to 'git-check-commit-msg/run-tests.sh')
-rwxr-xr-xgit-check-commit-msg/run-tests.sh28
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