X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2Ftest-lib.sh;h=9bfa14be7f1c3935013d04318eeaecc68b4ef88c;hb=0d2416e06003da954f0335248c3dc7f76a3735e3;hp=7422bba47e75e00073779e4b2d7a162862cdb426;hpb=f62e53c897c359b5885c474c41341d83845a78f6;p=git.git diff --git a/t/test-lib.sh b/t/test-lib.sh index 7422bba47..9bfa14be7 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -530,6 +530,22 @@ test_must_fail () { test $? -gt 0 -a $? -le 129 -o $? -gt 192 } +# Similar to test_must_fail, but tolerates success, too. This is +# meant to be used in contexts like: +# +# test_expect_success 'some command works without configuration' ' +# test_might_fail git config --unset all.configuration && +# do something +# ' +# +# Writing "git config --unset all.configuration || :" would be wrong, +# because we want to notice if it fails due to segv. + +test_might_fail () { + "$@" + test $? -ge 0 -a $? -le 129 -o $? -gt 192 +} + # test_cmp is a helper function to compare actual and expected output. # You can use it like: #