diff options
author | Michele Locati <michele@locati.it> | 2018-03-13 17:15:03 +0100 |
---|---|---|
committer | Michele Locati <michele@locati.it> | 2018-03-13 17:15:03 +0100 |
commit | c9b06645de2e0ceff23272de930418fb66b870e0 (patch) | |
tree | b9581d210e52c2ce24ab48ced2ea21f11aa9425a /test/all-tests.sh | |
parent | 913a57e4bec599ca8a06f8b4aef6e9594842efe6 (diff) | |
download | incremental-git-filter-branch-c9b06645de2e0ceff23272de930418fb66b870e0.tar.gz incremental-git-filter-branch-c9b06645de2e0ceff23272de930418fb66b870e0.tar.bz2 incremental-git-filter-branch-c9b06645de2e0ceff23272de930418fb66b870e0.zip |
Start adding tests
Diffstat (limited to 'test/all-tests.sh')
-rw-r--r-- | test/all-tests.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/all-tests.sh b/test/all-tests.sh new file mode 100644 index 0000000..be10e10 --- /dev/null +++ b/test/all-tests.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +IS_TEST_CASE=0 +if ! . "$(cd -- "$(dirname -- "$0")" && pwd -P)/bootstrap.sh" +then + echo 'Unable to find bootstrap script'>&2 + exit 1 +fi + +wantedFilter='' +if test $# -eq 1 +then + wantedFilter="${1}" +else + wantedFilter='' +fi + +someTestExecuted=0 +for testFile in "${DIR_TESTCASES}"/* +do + fullTestName="$(basename "${testFile}")" + testName=${fullTestName%.success} + if test "${fullTestName}" != "${testName}" + then + should='succeed' + else + testName=${fullTestName%.fail} + if test "${fullTestName}" != "${testName}" + then + should='fail' + else + printf 'Unrecognized test case: %s\n', "${fullTestName}" + exit 1 + fi + fi + if test -z "${wantedFilter}" -o "${testName}" = "${wantedFilter}" + then + printf '%s should %s... ' "${testName}" "${should}" + case "${should}" in + 'succeed') + if testOutput="$(${testFile} 2>&1)" + then + printf 'ok.\n' + else + printf 'FAILED!\n' + printf '%s\n' "${testOutput}" >&2 + exit 1 + fi + ;; + 'fail') + if testOutput="$(${testFile} 2>&1)" + then + printf 'FAILED!\n' + printf '%s\n' "${testOutput}" >&2 + exit 1 + else + printf 'ok.\n' + fi + ;; + esac + someTestExecuted=1 + fi +done + +if test ${someTestExecuted} -eq 0 +then + echo 'No test found!'>&2 + exit 1 +fi |