#!/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 "╚═════════════════════════════════════════════════"