mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-29 14:27:50 +00:00
Print summaries at the end of test.sh scripts
This commit is contained in:
@@ -14,16 +14,21 @@ rescolors="$(tput op)"
|
||||
|
||||
RGBGFX=../../rgbgfx
|
||||
|
||||
tests=0
|
||||
failed=0
|
||||
rc=0
|
||||
|
||||
new_test() {
|
||||
cmdline="$*"
|
||||
echo "${bold}${green}Testing: ${cmdline}${rescolors}${resbold}" >&2
|
||||
}
|
||||
test() {
|
||||
(( tests++ ))
|
||||
eval "$cmdline"
|
||||
}
|
||||
fail() {
|
||||
rc=1
|
||||
(( failed++ ))
|
||||
echo "${bold}${red}Test ${cmdline} failed!${1:+ (RC=$1)}${rescolors}${resbold}"
|
||||
}
|
||||
|
||||
@@ -69,4 +74,10 @@ for f in *.png; do
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$failed" -eq 0 ]]; then
|
||||
echo "${bold}${green}All ${tests} tests passed!${rescolors}${resbold}"
|
||||
else
|
||||
echo "${bold}${red}${failed} of the tests failed!${rescolors}${resbold}"
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
|
||||
Reference in New Issue
Block a user