More consistent whitespace in tests.sh

This commit is contained in:
Sage Vaillancourt 2021-07-04 23:56:55 -04:00
parent 0c9c876d00
commit 2af48f63ca
1 changed files with 21 additions and 21 deletions

View File

@ -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"