Skip to content

Commit 0a5e3c5

Browse files
peffgitster
authored andcommitted
t: use test_must_fail instead of hand-rolled blocks
These test scripts likely predate test_must_fail, and can be made simpler by using it (in addition to making them pass --chain-lint). The case in t6036 loses some verbosity in the failure case, but it is so tied to a specific failure mode that it is not worth keeping around (and the outcome of the test is not affected at all). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a167ece commit 0a5e3c5

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

t/t4124-apply-ws-rule.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ test_expect_success 'whitespace=warn, default rule' '
9999

100100
test_expect_success 'whitespace=error-all, default rule' '
101101
102-
apply_patch --whitespace=error-all && return 1
103-
test -s target && return 1
104-
: happy
102+
test_must_fail apply_patch --whitespace=error-all &&
103+
! test -s target
105104
106105
'
107106

t/t6036-recursive-corner-cases.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,7 @@ test_expect_success 'git detects differently handled merges conflict' '
195195
git reset --hard &&
196196
git checkout D^0 &&
197197
198-
git merge -s recursive E^0 && {
199-
echo "BAD: should have conflicted"
200-
test "Incorrectly merged content" = "$(cat new_a)" &&
201-
echo "BAD: Silently accepted wrong content"
202-
return 1
203-
}
198+
test_must_fail git merge -s recursive E^0 &&
204199
205200
test 3 = $(git ls-files -s | wc -l) &&
206201
test 3 = $(git ls-files -u | wc -l) &&

t/t9300-fast-import.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -2853,8 +2853,8 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'
28532853
# from
28542854
#
28552855
test_expect_success 'S: from with garbage after mark must fail' '
2856-
# no &&
2857-
git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err
2856+
test_must_fail \
2857+
git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&
28582858
commit refs/heads/S2
28592859
mark :303
28602860
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -2865,9 +2865,6 @@ test_expect_success 'S: from with garbage after mark must fail' '
28652865
M 100644 :403 hello.c
28662866
EOF
28672867
2868-
ret=$? &&
2869-
echo returned $ret &&
2870-
test $ret -ne 0 && # failed, but it created the commit
28712868
28722869
# go create the commit, need it for merge test
28732870
git fast-import --import-marks=marks --export-marks=marks <<-EOF &&

0 commit comments

Comments
 (0)