diff --git a/src/tests.sh b/src/tests.sh index a800dff..bd4b9af 100755 --- a/src/tests.sh +++ b/src/tests.sh @@ -4,8 +4,8 @@ VALCOM="valgrind -q --leak-check=full --track-origins=yes" TOTAL_PASSES=0 TOTAL_FAILS=0 -PASSES=0 FAILS=0 +FAIL_OUTPUT="" VALGRIND=0 CURRENT_BLOCK="" @@ -15,26 +15,26 @@ if [ "$1" == "-val" ]; then fi endBlock() { - echo "$PASSES tests PASSED" + echo "" if (($FAILS != 0)); then - echo "$FAILS tests FAILED" + echo -e "$FAIL_OUTPUT" + FAIL_OUTPUT="" fi - PASSES=0 FAILS=0 - echo "" } title() { - echo "$1" + echo -n "[$1] " } pass() { - ((PASSES++)) + echo -n "✓" ((TOTAL_PASSES++)) } fail() { - echo "$1 test FAILED $2" + echo -n "X" + FAIL_OUTPUT="$FAIL_OUTPUT $1 test FAILED $2" ((FAILS++)) ((TOTAL_FAILS++)) } @@ -51,14 +51,14 @@ check() { pass $1 else fail $1 "$2" - echo " Expected '$3' but received '$output'" + FAIL_OUTPUT="${FAIL_OUTPUT}\n Expected '$3' but received '$output'" fi } echo "STARTING TESTS" echo "" -title "Plain return tests" +title "Plain returns" check "PlainRet" "10" "10" check "StrRetrn" "\"hey\"" "hey" check "SingleStrRetrn" "'hey'" "hey"