chiark / gitweb /
Test suite: Move most of mustfail into t-expect-fail
[dgit.git] / tests / lib
index 332bef24414331a9bbd4f2774b1aabca5103dd0c..c91020bc3285a3e5545fe0e5d71b3d0340d42e8f 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -59,10 +59,17 @@ t-expect-fail () {
 
        set +o pipefail
        LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output
-       local gotstatus=${PIPESTATUS[0]}
+       local ps="${PIPESTATUS[*]}"
        set -o pipefail
-       test $gotstatus != 0
-       $grepper -e "$mpat" $tmp/t.output ||false
+
+       case $ps in
+       "0 0")  fail "command unexpectedly succeeded (instead of: $mpat)" ;;
+       *" 0")  ;;
+       *)      fail "tee failed"  ;;
+       esac
+
+       $grepper -e "$mpat" $tmp/t.output ||
+               fail "error message not found"
 }
 
 t-reporefs () {