Skip to content

Commit 12e31a6

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fc849d8 commit 12e31a6

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

t/README

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,19 +658,29 @@ library for your script to use.
658658
test_expect_code 1 git merge "merge msg" B master
659659
'
660660

661-
- test_must_fail <git-command>
661+
- test_must_fail [<options>] <git-command>
662662

663663
Run a git command and ensure it fails in a controlled way. Use
664664
this instead of "! <git-command>". When git-command dies due to a
665665
segfault, test_must_fail diagnoses it as an error; "! <git-command>"
666666
treats it as just another expected failure, which would let such a
667667
bug go unnoticed.
668668

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>
670678

671679
Similar to test_must_fail, but tolerate success, too. Use this
672680
instead of "<git-command> || :" to catch failures due to segv.
673681

682+
Accepts the same options as test_must_fail.
683+
674684
- test_cmp <expected> <actual>
675685

676686
Check whether the content of the <actual> file matches the

t/test-lib-functions.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,14 @@ list_contains () {
610610
#
611611
# Writing this as "! git checkout ../outerspace" is wrong, because
612612
# 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.)
613621

614622
test_must_fail () {
615623
case "$1" in
@@ -656,6 +664,8 @@ test_must_fail () {
656664
#
657665
# Writing "git config --unset all.configuration || :" would be wrong,
658666
# because we want to notice if it fails due to segv.
667+
#
668+
# Accepts the same options as test_must_fail.
659669

660670
test_might_fail () {
661671
test_must_fail ok=success "$@"

0 commit comments

Comments
 (0)