Skip to content

Commit 68559c4

Browse files
committed
Merge branch 'sg/doc-test-must-fail-args' into maint
Devdoc update. * sg/doc-test-must-fail-args: t: document 'test_must_fail ok=<signal-name>'
2 parents 67b7dd3 + 12e31a6 commit 68559c4

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
@@ -655,19 +655,29 @@ library for your script to use.
655655
test_expect_code 1 git merge "merge msg" B master
656656
'
657657

658-
- test_must_fail <git-command>
658+
- test_must_fail [<options>] <git-command>
659659

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

666-
- test_might_fail <git-command>
666+
Accepts the following options:
667+
668+
ok=<signal-name>[,<...>]:
669+
Don't treat an exit caused by the given signal as error.
670+
Multiple signals can be specified as a comma separated list.
671+
Currently recognized signal names are: sigpipe, success.
672+
(Don't use 'success', use 'test_might_fail' instead.)
673+
674+
- test_might_fail [<options>] <git-command>
667675

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

679+
Accepts the same options as test_must_fail.
680+
671681
- test_cmp <expected> <actual>
672682

673683
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)