Files
scm_breeze/run_tests.sh
2024-02-27 05:27:30 -05:00

31 lines
676 B
Bash
Executable File

#!/bin/sh
# Run SCM Breeze shUnit2 tests
failed=false
env | grep ^SHELL
# allow list of shells to run tests in to be overriden by environment variable
# if empty or null, use defaults
if [ -z "$TEST_SHELLS" ]; then
TEST_SHELLS="bash zsh"
fi
echo "== Will run all tests with following shells: ${TEST_SHELLS}"
cd -P -- "${0%/*}" # Change to directory this script lives in
for test in $(find test/lib -name *_test.sh); do
for shell in $TEST_SHELLS; do
echo "== Running tests with [$shell]: $test"
$shell $test || failed=true
printf '==\n\n'
done
done
if [ "$failed" = "true" ]; then
echo "Tests failed!"
false
else
echo "All tests passed!"
true
fi