X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Ftap.sh;h=1811f5dde48aacbf9ed9945d9a15eb8596d40ba9;hb=dc08462c5c1d2cb9ae52a7b1df98603cb1160262;hp=553128ffe01e9a55e5e58570acc07699f1dab1ea;hpb=7b53df56cc94695572fa6ea8b075cf7e89b3690c;p=zpackage diff --git a/t/tap.sh b/t/tap.sh index 553128f..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,12 +15,32 @@ 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 "$*" } @@ -42,7 +62,7 @@ exitwith() { note= 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))