--- a/mallard-ducktype-1.0.2/tests/runtests +++ b/mallard-ducktype-1.0.2/tests/runtests @@ -8,19 +8,20 @@ silent=0 glob="" -for arg in $@; do - if [ "x$arg" = "x-s" ]; then +for arg do + if [ "$arg" = "-s" ]; then silent=1 - elif [ "x$arg" != "x" ]; then + elif [ -n "$arg" ]; then glob="$arg" fi done for duck in *$glob*.duck; do + [ -f "$duck" ] || continue count=$(( count + 1 )) - out=$(echo $duck | sed -e 's/\.duck$/.out/') - page=$(echo $duck | sed -e 's/\.duck$/.page/') - error=$(echo $duck | sed -e 's/\.duck$/.error/') + out=${duck%.duck}.out + page=${duck%.duck}.page + error=${duck%.duck}.error fail="" if [ -f "$page" ]; then python3 runtest.py "$duck" > "$out" || fail="exit status $?" @@ -29,7 +30,6 @@ diff -u "$out" "$page" >&2 || : fi elif [ -f "$error" ]; then - status=0 python3 runtest.py "$duck" > "$out" || : if ! cmp "$out" "$error" >&2; then fail="unexpected error message" @@ -39,7 +39,7 @@ fail="neither $page nor $error exists" fi if [ -z "$fail" ]; then - if [ $silent = 0 ]; then + if [ "$silent" = 0 ]; then echo "ok $count - $duck" fi else