diff options
author | Jeff King <peff@peff.net> | 2015-03-20 06:10:21 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-20 10:20:15 -0700 |
commit | a6a4a88af0b99fec688f66256a2c23a15e110c1f (patch) | |
tree | bfee73a8fc4decd7c1556a065b2202efadb0670b /t/t6032-merge-large-rename.sh | |
parent | t: use test_must_fail instead of hand-rolled blocks (diff) | |
download | tgif-a6a4a88af0b99fec688f66256a2c23a15e110c1f.tar.xz |
t: fix &&-chaining issues around setup which might fail
Many tests have an initial setup step that might fail based
on whether earlier tests in the script have succeeded or
not. Using a trick like "|| true" breaks the &&-chain,
missing earlier failures (and fooling --chain-lint).
We can use test_might_fail in some cases, which is correct
and makes the intent more obvious. We can also use
test_unconfig for unsetting config (and which is more
robust, as well).
The case in t9500 is an oddball. It wants to run cmd1 _or_
cmd2, and does it like:
cmd1 || cmd2 &&
other_stuff
It's not wrong in this case, but it's a bad habit to get
into, because it breaks the &&-chain if used anywhere except
at the beginning of the test (and we use the correct
solution here, putting it inside a block for precedence).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6032-merge-large-rename.sh')
-rwxr-xr-x | t/t6032-merge-large-rename.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/t/t6032-merge-large-rename.sh b/t/t6032-merge-large-rename.sh index 15beecc3c6..0f79268917 100755 --- a/t/t6032-merge-large-rename.sh +++ b/t/t6032-merge-large-rename.sh @@ -28,10 +28,10 @@ make_text() { test_rename() { test_expect_success "rename ($1, $2)" ' - n='$1' - expect='$2' + n='$1' && + expect='$2' && git checkout -f master && - git branch -D test$n || true && + test_might_fail git branch -D test$n && git reset --hard initial && for i in $(count $n); do make_text $i initial initial >$i |