From 65878aa07452b45c3f17c3ab15508400edd46476 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 18 Sep 2024 07:56:39 +0200 Subject: Some shellcheck --- test/test.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index ce120eb..14b4ca3 100755 --- a/test/test.sh +++ b/test/test.sh @@ -8,19 +8,19 @@ TESTERR="test/last.err" CUBEOBJ="debugcube.o" for t in test/*; do - if [ -n "$re" ] && [ -z "$(echo "$t" | grep "$re")" ]; then + if [ -n "$re" ] && !(echo "$t" | grep -q "$re"); then continue fi # Verify if $t is a directory and if its name starts with three digits - if [ -d "$t" ] && echo "$(basename "$t")" | grep -Eq '^[0-9]{3}'; then - $CC -o $TESTBIN $t/*.c $CUBEOBJ || exit 1 - for cin in $t/*.in; do + if [ -d "$t" ] && basename "$t" | grep -Eq '^[0-9]{3}'; then + $CC -o $TESTBIN "$t"/*.c $CUBEOBJ || exit 1 + for cin in "$t"/*.in; do c=$(echo "$cin" | sed 's/\.in//') - cout=$c.out - printf "$c: " + cout="$c.out" + printf "%s: " "$c" $TESTBIN < "$cin" > $TESTOUT 2> $TESTERR - if diff $cout $TESTOUT; then + if diff "$cout" "$TESTOUT"; then printf "OK\n" else printf "Test failed! stderr:\n" -- cgit v1.3