From 12e31a6b12b0a8497f35b327219c348186e0a666 Mon Sep 17 00:00:00 2001 From: =?utf8?q?SZEDER=20G=C3=A1bor?= Date: Fri, 9 Feb 2018 03:42:33 +0100 Subject: [PATCH] t: document 'test_must_fail ok=' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since 'test_might_fail' is implemented as a thin wrapper around 'test_must_fail', it also accepts the same options. Mention this in the docs as well. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- t/README | 14 ++++++++++++-- t/test-lib-functions.sh | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/t/README b/t/README index 4b079e4494..c69b1eaf6d 100644 --- a/t/README +++ b/t/README @@ -658,7 +658,7 @@ library for your script to use. test_expect_code 1 git merge "merge msg" B master ' - - test_must_fail + - test_must_fail [] Run a git command and ensure it fails in a controlled way. Use this instead of "! ". When git-command dies due to a @@ -666,11 +666,21 @@ library for your script to use. treats it as just another expected failure, which would let such a bug go unnoticed. - - test_might_fail + Accepts the following options: + + ok=[,<...>]: + Don't treat an exit caused by the given signal as error. + Multiple signals can be specified as a comma separated list. + Currently recognized signal names are: sigpipe, success. + (Don't use 'success', use 'test_might_fail' instead.) + + - test_might_fail [] Similar to test_must_fail, but tolerate success, too. Use this instead of " || :" to catch failures due to segv. + Accepts the same options as test_must_fail. + - test_cmp Check whether the content of the file matches the diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 1701fe2a06..26b149ac1d 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -610,6 +610,14 @@ list_contains () { # # Writing this as "! git checkout ../outerspace" is wrong, because # the failure could be due to a segv. We want a controlled failure. +# +# Accepts the following options: +# +# ok=[,<...>]: +# Don't treat an exit caused by the given signal as error. +# Multiple signals can be specified as a comma separated list. +# Currently recognized signal names are: sigpipe, success. +# (Don't use 'success', use 'test_might_fail' instead.) test_must_fail () { case "$1" in @@ -656,6 +664,8 @@ test_must_fail () { # # Writing "git config --unset all.configuration || :" would be wrong, # because we want to notice if it fails due to segv. +# +# Accepts the same options as test_must_fail. test_might_fail () { test_must_fail ok=success "$@" -- 2.39.2