diff options
Diffstat (limited to 'run_tests.sh')
| -rwxr-xr-x | run_tests.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 0000000..578392a --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +testdir=test/bin + +red='\e[0;31m' +yellow='\e[0;33m' +green='\e[0;32m' + +reset='\e[0m' + +lprintf() { + local fmt="$1" + local text="$2" + [[ -x "$text" ]] && return + while IFS= read -r line; do + printf "$fmt" "$line" + done <<< "$text" +} + +echo " ╓──────────╖" +echo "╔═╣ leo test ╠════════════════════════════════════" +echo "║ ╙──────────╜" + +for testbin in $testdir/*; do + if [[ -x "$testbin" ]]; then + echo -ne "╟─ running ${yellow}${testbin}${reset}:\t" + output=$(./$testbin 2>&1) # TODO save output and display at end + if [[ $? -eq 0 ]]; then + echo -e "${green}passed${reset}" + else + echo -e "${red}failed${reset}" + lprintf "║ %s\n" "$output" + fi + fi +done + +echo "║" +echo "╚═════════════════════════════════════════════════" |
