X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Ftap.sh;h=1811f5dde48aacbf9ed9945d9a15eb8596d40ba9;hb=c20db3d43f58abb15e22fca0fe12e23ffb21d0d5;hp=23c52997190d8f127cab8a8384f828d92bcf50f2;hpb=b876033bd42f1924f9f4e85189b88b1741d568cd;p=zpackage diff --git a/t/tap.sh b/t/tap.sh index 23c5299..1811f5d 100755 --- a/t/tap.sh +++ b/t/tap.sh @@ -7,7 +7,7 @@ tryrun() { note="$@" program=$1 shift - $program "$@" + $program "$@" >> test.out 2>&1 if [ $? -ne 0 ]; then printf 'not '; fi @@ -15,21 +15,42 @@ tryrun() { printf 'ok %d - %s %s\n' $tn $program "$*" } +require() { + note="$@" + program=$1 + shift + $program "$@" >> test.out 2>&1 + rv=$? + if [ $rv -ne 0 ]; then + diag "bailing on $((tn + 1)) $program $*" + printf "bail out! fail[$rv]: $@\n" + exit 255; + fi + tn=$((tn + 1)) + printf 'ok %d - %s %s\n' $tn $program "$*" + +} + shownote() { if [ "$note" != "" ]; then printf '# %s\n' "$note" fi } +diag() { + printf '# %s\n' "$@" +} + okexit() { exitwith 0 "$*" } failsok() { + rv=$? note= - if [ $? -eq 0 ]; then + if [ $rv -eq 0 ]; then printf 'not '; - note=$(printf '# got "%d" expected "%d"' "$1" "0") + note=$(printf 'got "%d" expected "%d"' "$rv" "0") fi tn=$((tn + 1)) printf 'ok %d - %s\n' $tn "$*" @@ -37,10 +58,11 @@ failsok() { } exitwith() { + rv=$? note= - if [ $? -ne $1 ]; then + if [ $rv -ne $1 ]; then printf 'not '; - note=$(printf '# got "%d" expected "%d"' "$1" "$2") + note=$(printf '# got "%d" expected "%d"' "$rv" "$1") fi shift tn=$((tn + 1))