Fixed helper and default setup executed successfully

This commit is contained in:
Nikola Jokic
2023-12-07 12:54:26 +01:00
parent a9b60e4565
commit 416c9942f1
3 changed files with 37 additions and 15 deletions

View File

@@ -35,9 +35,30 @@ function env_test() {
fi
}
function usage() {
echo "Usage: $0 [test_name]"
echo " test_name: the name of the test to run"
echo " if not specified, all tests will be run"
echo " test_name should be the name of the test file without the .test.sh suffix"
echo ""
exit 1
}
function main() {
local failed=()
env_test
if [[ -z "${1}" ]]; then
echo "Running all tests"
set_targets
elif [[ -f "${TEST_DIR}/${1}.test.sh" ]]; then
echo "Running test ${1}"
TARGETS=("${1}.test.sh")
else
usage
fi
for target in "${TARGETS[@]}"; do
echo "============================================================"
test="${TEST_DIR}/${target}"
@@ -68,8 +89,4 @@ function main() {
fi
}
set_targets
env_test
main
main $@