t: document 'test_must_fail ok=<signal-name>'
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 <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Feb 9, 2018 at 03:42 UTC
12e31a6b12b0a8497f35b327219c348186e0a666
2 files changed
+22
-2
t/README
+12
-2
@@ -658,7 +658,7 @@ library for your script to use.
658
test_expect_code 1 git merge "merge msg" B master
659
'
660
661
- - test_must_fail <git-command>
661
+ - test_must_fail [<options>] <git-command>
662
663
Run a git command and ensure it fails in a controlled way. Use
664
this instead of "! <git-command>". When git-command dies due to a
@@ -666,11 +666,21 @@ library for your script to use.
666
treats it as just another expected failure, which would let such a
667
bug go unnoticed.
668
669
- - test_might_fail <git-command>
669
+ Accepts the following options:
670
+
671
+ ok=<signal-name>[,<...>]:
672
+ Don't treat an exit caused by the given signal as error.
673
+ Multiple signals can be specified as a comma separated list.
674
+ Currently recognized signal names are: sigpipe, success.
675
+ (Don't use 'success', use 'test_might_fail' instead.)
676
+
677
+ - test_might_fail [<options>] <git-command>
678
679
Similar to test_must_fail, but tolerate success, too. Use this
680
instead of "<git-command> || :" to catch failures due to segv.
681
682
+ Accepts the same options as test_must_fail.
683
+
684
- test_cmp <expected> <actual>
685
686
Check whether the content of the <actual> file matches the
t/test-lib-functions.sh
+10
@@ -610,6 +610,14 @@ list_contains () {
610
#
611
# Writing this as "! git checkout ../outerspace" is wrong, because
612
# the failure could be due to a segv. We want a controlled failure.
613
+#
614
+# Accepts the following options:
615
+#
616
+# ok=<signal-name>[,<...>]:
617
+# Don't treat an exit caused by the given signal as error.
618
+# Multiple signals can be specified as a comma separated list.
619
+# Currently recognized signal names are: sigpipe, success.
620
+# (Don't use 'success', use 'test_might_fail' instead.)
621
622
test_must_fail () {
623
case "$1" in
@@ -656,6 +664,8 @@ test_must_fail () {
664
#
665
# Writing "git config --unset all.configuration || :" would be wrong,
666
# because we want to notice if it fails due to segv.
667
+#
668
+# Accepts the same options as test_must_fail.
669
670
test_might_fail () {
671
test_must_fail ok=success "$@"