chiark / gitweb /
Test suite: break out t-expect-fail
[dgit.git] / tests / lib
index 1516646f23ae1d239be725cb0ccf468afa8ca00f..7a5ede52f9f96178d17f513454448ecd4a331482 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -22,9 +22,9 @@ if [ x"$tmp" = x ]; then
        mkdir $tmp
 fi
 cd $tmp
-export HOME=$tmp
 
 tmp=`pwd`
+export HOME=$tmp
 export DGIT_TEST_DUMMY_DIR=$tmp
 ln -f $troot/ssh ssh
 
@@ -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
@@ -81,7 +88,20 @@ t-has-ancestor () {
        if [ x$mbase != x$ancestor ]; then
                fail "not ff $ancestor..$now, $mbase != $ancestor"
        fi
-}      
+}
+
+t-prep-newpackage () {
+       p=$1
+       v=$2
+       t-archive-none $p
+       t-git-none
+       v=3-1
+       t-worktree $v
+       cd $p
+       git branch -m dgit/sid master
+       git remote rm dgit
+       cd ..
+}
 
 t-archive-none () {
        p=$1