chiark / gitweb /
Test suite: break out t-expect-fail
[dgit.git] / tests / lib
index 70cda8f6fefa45d911df58f659da06192542eb0d..7a5ede52f9f96178d17f513454448ecd4a331482 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -46,6 +46,13 @@ fail () {
        exit 1
 }
 
+t-expect-fail () {
+       local mpat="$1"; shift
+       LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output
+       test ${PIPESTATUS[0]} != 0
+       egrep "$mpat" $tmp/t.output ||false
+}
+
 t-untar () {
        local tarfile=$1.tar
        local edittree=$1.edit