summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-05-21 04:02:20 -0700
committerJunio C Hamano <gitster@pobox.com>2010-05-21 04:02:20 -0700
commitf9a518e884b62a76dde3b30aa5d0ac22381f47a8 (patch)
treec502dbf972d82db51a8e75e61866e4bf407d6620 /t/test-lib.sh
parent9215f76fb6d938ae93889f46f27cff22723fe0e4 (diff)
parentfdf1bc48caa008c7f285db3323498f25a7758879 (diff)
downloadgit-f9a518e884b62a76dde3b30aa5d0ac22381f47a8.tar.gz
Merge branch 'jn/t7006-fixup'
* jn/t7006-fixup: t7006: guard cleanup with test_expect_success
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7422bba47e..9bfa14be7f 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:
#