author | Junio C Hamano <gitster@pobox.com> | |
Thu, 28 Feb 2008 21:09:30 +0000 (13:09 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 3 Mar 2008 07:15:06 +0000 (23:15 -0800) | ||
commit | 90d0ed96b76ee51f8ae6f32923b92e7b20ba73c0 | |
tree | 52960079fe7077394215af7fb5b2cac40c061c65 | tree | snapshot |
parent | fcbcfe707ae23b37d72025a229f31c450fb4d3b3 | commit | diff |
tests: introduce test_must_fail
When we expect a git command to notice and signal errors, we
carelessly wrote in our tests:
test_expect_success 'reject bogus request' '
do something &&
do something else &&
! git command
'
but a non-zero exit could come from the "git command" segfaulting.
A new helper function "tset_must_fail" is introduced and it is
meant to be used to make sure the command gracefully fails (iow,
dying and exiting with non zero status is counted as a failure
to "gracefully fail"). The above example should be written as:
test_expect_success 'reject bogus request' '
do something &&
do something else &&
test_must_fail git command
'
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When we expect a git command to notice and signal errors, we
carelessly wrote in our tests:
test_expect_success 'reject bogus request' '
do something &&
do something else &&
! git command
'
but a non-zero exit could come from the "git command" segfaulting.
A new helper function "tset_must_fail" is introduced and it is
meant to be used to make sure the command gracefully fails (iow,
dying and exiting with non zero status is counted as a failure
to "gracefully fail"). The above example should be written as:
test_expect_success 'reject bogus request' '
do something &&
do something else &&
test_must_fail git command
'
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2008-checkout-subdir.sh | diff | blob | history | |
t/test-lib.sh | diff | blob | history |