aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-09-29 11:51:15 +0200
committerMichał Górny <mgorny@gentoo.org>2019-04-09 13:05:55 +0200
commitaa5e79362796919573a0841a691107f0c52a3e41 (patch)
treeb69b3e28fe76f8962511d11d391913704d3edcd1 /local/tests/lib.sh
parentupdate-05-manifest: Add tests (diff)
downloadgithooks-aa5e79362796919573a0841a691107f0c52a3e41.tar.gz
githooks-aa5e79362796919573a0841a691107f0c52a3e41.tar.bz2
githooks-aa5e79362796919573a0841a691107f0c52a3e41.zip
Add a runner for all tests
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'local/tests/lib.sh')
-rw-r--r--local/tests/lib.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/local/tests/lib.sh b/local/tests/lib.sh
index 8ecefdf..12160a7 100644
--- a/local/tests/lib.sh
+++ b/local/tests/lib.sh
@@ -3,13 +3,15 @@
# Copyright 2018 Michał Górny
# Distributed under the terms of the GNU General Public License v2 or later
-. /lib/gentoo/functions.sh
+[[ -z ${RC_GOT_FUNCTIONS} ]] && . /lib/gentoo/functions.sh
die() {
echo "died @ ${BASH_SOURCE[1]}:${BASH_LINENO[0]}" >&2
exit 1
}
+TEST_RET=0
+
# Starts a test. Creates temporary git repo and enters it.
# $1 - test description (printed)
tbegin() {
@@ -53,6 +55,7 @@ run_test() {
test_success() {
run_test
tend ${?}
+ : $(( TEST_RET |= ${?} ))
}
# Run the hook for all commits since the initial commit.
@@ -69,4 +72,5 @@ test_failure() {
[[ ${msg} == ${expected} ]]
tend ${?} "'${msg}' != '${expected}'"
+ : $(( TEST_RET |= ${?} ))
}