diff options
author | Michele Locati <michele@locati.it> | 2018-03-15 18:36:04 +0100 |
---|---|---|
committer | Michele Locati <michele@locati.it> | 2018-03-15 18:36:04 +0100 |
commit | 30bf11d417eb0d65cb3620e44afe4efb8c7a1d09 (patch) | |
tree | 00588f51459a5cb2fe9258bd229717192f6c6854 /test/run-tests | |
parent | d07138f8e7001fc4e497510dcf1ac432725ae6c0 (diff) | |
download | incremental-git-filter-branch-30bf11d417eb0d65cb3620e44afe4efb8c7a1d09.tar.gz incremental-git-filter-branch-30bf11d417eb0d65cb3620e44afe4efb8c7a1d09.tar.bz2 incremental-git-filter-branch-30bf11d417eb0d65cb3620e44afe4efb8c7a1d09.zip |
Remove useless .sh file extension
Diffstat (limited to 'test/run-tests')
-rwxr-xr-x | test/run-tests | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/run-tests b/test/run-tests new file mode 100755 index 0000000..8be4720 --- /dev/null +++ b/test/run-tests @@ -0,0 +1,69 @@ +#!/bin/sh + +IS_TEST_CASE=0 +if ! . "$(cd -- "$(dirname -- "$0")" && pwd -P)/bootstrap" +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 |