summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-06-10 18:25:12 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-06-10 18:25:12 +0100
commit5d8e32854c1d89e337bc606d423634a667f9b0ff (patch)
tree2fd8daceed380a8a42717d605cd5b989e1208d9f /tests
parent609f108165197b1d7a55a4908a321bad40a86442 (diff)
Test suite: Move most of mustfail into t-expect-fail
Diffstat (limited to 'tests')
-rw-r--r--tests/lib13
-rwxr-xr-xtests/tests/drs-push-rejects16
2 files changed, 14 insertions, 15 deletions
diff --git a/tests/lib b/tests/lib
index 332bef2..c91020b 100644
--- 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 () {
diff --git a/tests/tests/drs-push-rejects b/tests/tests/drs-push-rejects
index 640aeae..13567c3 100755
--- a/tests/tests/drs-push-rejects
+++ b/tests/tests/drs-push-rejects
@@ -11,20 +11,12 @@ t-worktree drs
cd $p
mustfail () {
- local wantmsg="$1"; shift
+ local mpat="$1"; shift
t-reporefs pre-push
- set +o pipefail
+
+ t-expect-fail "$mpat" \
git push origin "$@" 2>&1 |tee $tmp/mustfail.txt
- ps="${PIPESTATUS[*]}"
- set -o pipefail
- case $ps in
- "0 0") fail "push unexpectedly succeeded (instead of: $wantmsg)" ;;
- *" 0") ;;
- *) fail "tee failed" ;;
- esac
- if ! fgrep "$wantmsg" $tmp/mustfail.txt >/dev/null; then
- fail "error message not found"
- fi
+
t-reporefs post-push
diff $tmp/show-refs.{pre,post}-push
}