aboutsummaryrefslogtreecommitdiff
path: root/t/t2008-checkout-subdir.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-28 13:09:30 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-29 00:00:29 -0800
commit7435982102093179474a128648179a44042d8a1c (patch)
tree0241bd25b24d222758ed70363340379fec5d12e8 /t/t2008-checkout-subdir.sh
parent301e42edc3fa277059be97b3be5b97d86ddc9d9f (diff)
downloadgit-7435982102093179474a128648179a44042d8a1c.tar.gz
git-7435982102093179474a128648179a44042d8a1c.tar.xz
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>
Diffstat (limited to 't/t2008-checkout-subdir.sh')
-rwxr-xr-xt/t2008-checkout-subdir.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh
index 4a723dc0e..3e098ab31 100755
--- a/t/t2008-checkout-subdir.sh
+++ b/t/t2008-checkout-subdir.sh
@@ -68,15 +68,15 @@ test_expect_success 'checkout with simple prefix' '
'
test_expect_success 'relative path outside tree should fail' \
- '! git checkout HEAD -- ../../Makefile'
+ 'test_must_fail git checkout HEAD -- ../../Makefile'
test_expect_success 'incorrect relative path to file should fail (1)' \
- '! git checkout HEAD -- ../file0'
+ 'test_must_fail git checkout HEAD -- ../file0'
test_expect_success 'incorrect relative path should fail (2)' \
- '( cd dir1 && ! git checkout HEAD -- ./file0 )'
+ '( cd dir1 && test_must_fail git checkout HEAD -- ./file0 )'
test_expect_success 'incorrect relative path should fail (3)' \
- '( cd dir1 && ! git checkout HEAD -- ../../file0 )'
+ '( cd dir1 && test_must_fail git checkout HEAD -- ../../file0 )'
test_done