From 2af48f63caf02e7616cd2ce7d515059ffd471adb Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sun, 4 Jul 2021 23:56:55 -0400 Subject: [PATCH] More consistent whitespace in tests.sh --- src/tests.sh | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/tests.sh b/src/tests.sh index bd4b9af..1f194d0 100755 --- a/src/tests.sh +++ b/src/tests.sh @@ -6,12 +6,12 @@ TOTAL_PASSES=0 TOTAL_FAILS=0 FAILS=0 FAIL_OUTPUT="" -VALGRIND=0 +VALGRIND=false CURRENT_BLOCK="" if [ "$1" == "-val" ]; then - VALGRIND=1 + VALGRIND=true fi endBlock() { @@ -28,31 +28,31 @@ title() { } pass() { - echo -n "✓" - ((TOTAL_PASSES++)) + echo -n "✓" + ((TOTAL_PASSES++)) } fail() { - echo -n "X" - FAIL_OUTPUT="$FAIL_OUTPUT $1 test FAILED $2" - ((FAILS++)) - ((TOTAL_FAILS++)) + echo -n "X" + FAIL_OUTPUT="$FAIL_OUTPUT $1 test FAILED $2" + ((FAILS++)) + ((TOTAL_FAILS++)) } check() { - local output - if (($VALGRIND == 1)); then - local output=$($VALCOM ./pl "(loadfile \"examples/lib.pbl\") $2") - else - local output=$(./pl "(loadfile \"examples/lib.pbl\") $2") - fi + local output + if $VALGRIND; then + local output=$($VALCOM ./pl "(loadfile \"examples/lib.pbl\") $2") + else + local output=$(./pl "(loadfile \"examples/lib.pbl\") $2") + fi - if [ "$output" == "$3" ]; then - pass $1 - else - fail $1 "$2" - FAIL_OUTPUT="${FAIL_OUTPUT}\n Expected '$3' but received '$output'" - fi + if [ "$output" == "$3" ]; then + pass $1 + else + fail $1 "$2" + FAIL_OUTPUT="${FAIL_OUTPUT}\n Expected '$3' but received '$output'" + fi } echo "STARTING TESTS" @@ -191,7 +191,7 @@ endBlock echo "" if [ "$TOTAL_FAILS" -ne "0" ]; then - echo -n "" + echo -n "" fi echo "$TOTAL_FAILS Tests Failed"