Commit 68559c46 authored by Junio C Hamano's avatar Junio C Hamano

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>'
parents 67b7dd3d 12e31a6b
...@@ -655,7 +655,7 @@ library for your script to use. ...@@ -655,7 +655,7 @@ library for your script to use.
test_expect_code 1 git merge "merge msg" B master test_expect_code 1 git merge "merge msg" B master
' '
- test_must_fail <git-command> - test_must_fail [<options>] <git-command>
Run a git command and ensure it fails in a controlled way. Use Run a git command and ensure it fails in a controlled way. Use
this instead of "! <git-command>". When git-command dies due to a this instead of "! <git-command>". When git-command dies due to a
...@@ -663,11 +663,21 @@ library for your script to use. ...@@ -663,11 +663,21 @@ library for your script to use.
treats it as just another expected failure, which would let such a treats it as just another expected failure, which would let such a
bug go unnoticed. bug go unnoticed.
- test_might_fail <git-command> Accepts the following options:
ok=<signal-name>[,<...>]:
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 [<options>] <git-command>
Similar to test_must_fail, but tolerate success, too. Use this Similar to test_must_fail, but tolerate success, too. Use this
instead of "<git-command> || :" to catch failures due to segv. instead of "<git-command> || :" to catch failures due to segv.
Accepts the same options as test_must_fail.
- test_cmp <expected> <actual> - test_cmp <expected> <actual>
Check whether the content of the <actual> file matches the Check whether the content of the <actual> file matches the
......
...@@ -610,6 +610,14 @@ list_contains () { ...@@ -610,6 +610,14 @@ list_contains () {
# #
# Writing this as "! git checkout ../outerspace" is wrong, because # Writing this as "! git checkout ../outerspace" is wrong, because
# the failure could be due to a segv. We want a controlled failure. # the failure could be due to a segv. We want a controlled failure.
#
# Accepts the following options:
#
# ok=<signal-name>[,<...>]:
# 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 () { test_must_fail () {
case "$1" in case "$1" in
...@@ -656,6 +664,8 @@ test_must_fail () { ...@@ -656,6 +664,8 @@ test_must_fail () {
# #
# Writing "git config --unset all.configuration || :" would be wrong, # Writing "git config --unset all.configuration || :" would be wrong,
# because we want to notice if it fails due to segv. # because we want to notice if it fails due to segv.
#
# Accepts the same options as test_must_fail.
test_might_fail () { test_might_fail () {
test_must_fail ok=success "[email protected]" test_must_fail ok=success "[email protected]"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment