X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Ftap.sh;fp=t%2Ftap.sh;h=0d03831bcf03cbb41d63ba198d8ab1f0a96f61a5;hb=4f60c538ec7111597176984e32d3996e4b5adb17;hp=580fcbd2d02d6be9e0627a880af59dee46bd6ad8;hpb=c0c274bfcf9710c279c8438e55f33ebeed3a3f9b;p=zpackage diff --git a/t/tap.sh b/t/tap.sh index 580fcbd..0d03831 100755 --- a/t/tap.sh +++ b/t/tap.sh @@ -7,23 +7,30 @@ tryrun() { note="$@" program=$1 shift - $program "$@" >> test.out 2>&1 - if [ $? -ne 0 ]; then + $program "$@" > test.out 2>&1 + rv=$? + if [ $rv -ne 0 ]; then printf 'not '; fi tn=$((tn + 1)) printf 'ok %d - %s %s\n' $tn $program "$*" + if [ $rv -ne 0 ]; then + cat test.out | diagstdin + fi + return $rv } require() { note="$*" program=$1 shift - $program "$@" >> test.out 2>&1 + $program "$@" > test.out 2>&1 rv=$? tn=$((tn + 1)) if [ $rv -ne 0 ]; then printf 'not ok %d - %s %s\n' $tn $program "$*" + cat test.out | diagstdin + rm test.out bailout "exit status $rv"; fi printf 'ok %d - %s %s\n' $tn $program "$*" @@ -75,7 +82,7 @@ exitwith() { note= if [ $rv -ne $1 ]; then printf 'not '; - note=$(printf '# got "%d" expected "%d"' "$rv" "$1") + note=$(printf 'got "%d" expected "%d"' "$rv" "$1") fi shift tn=$((tn + 1)) @@ -106,3 +113,13 @@ finish() { printf '1..%d\n' $tn fi } + +skip() { + tap_skipping=$1 + shift + while [ $tap_skipping -gt 0 ]; do + tn=$((tn + 1)) + tap_skipping=$((tap_skipping - 1)) + printf 'ok %d - skip %s\n' $tn "$*" + done +}