From: Ian Jackson Date: Sat, 11 Jul 2015 12:40:00 +0000 (+0100) Subject: Test suite: Move setting of grepper in t-expect-fail (nfc) X-Git-Tag: debian/1.0~47 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=5339e3c5dcc53b10ea981c106ad7211b5a701ee1;ds=sidebyside Test suite: Move setting of grepper in t-expect-fail (nfc) --- diff --git a/tests/lib b/tests/lib index 046d3628..7cd8062c 100644 --- a/tests/lib +++ b/tests/lib @@ -47,6 +47,17 @@ END t-expect-fail () { local mpat="$1"; shift + set +o pipefail + LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output + local ps="${PIPESTATUS[*]}" + set -o pipefail + + case $ps in + "0 0") fail "command unexpectedly succeeded (instead of: $mpat)" ;; + *" 0") ;; + *) fail "tee failed" ;; + esac + local grepper=fgrep case "$mpat" in [A-Z]:*) @@ -59,17 +70,6 @@ t-expect-fail () { ;; esac - set +o pipefail - LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output - local ps="${PIPESTATUS[*]}" - set -o pipefail - - 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" }