t3510 (cherry-pick-sequencer): use exit status

All the tests asserting failure use 'test_must_fail', which simply checks for a non-zero exit status, potentially hiding underlying bugs. So, replace instances of 'test_must_fail' with 'test_expect_code' to check the exit status explicitly, where appropriate. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramkumar Ramachandra committed Dec 14, 2011 at 22:24 UTC c6b7c7f3050977577af49e5d81340fae3b5bf2e7
1 file changed +29 -29
t/t3510-cherry-pick-sequence.sh
+29 -29
@@ -46,7 +46,7 @@ test_expect_success setup '
46
47 test_expect_success 'cherry-pick persists data on failure' '
48 pristine_detach initial &&
49 - test_must_fail git cherry-pick -s base..anotherpick &&
49 + test_expect_code 1 git cherry-pick -s base..anotherpick &&
50 test_path_is_dir .git/sequencer &&
51 test_path_is_file .git/sequencer/head &&
52 test_path_is_file .git/sequencer/todo &&
@@ -67,7 +67,7 @@ test_expect_success 'cherry-pick mid-cherry-pick-sequence' '
67
68 test_expect_success 'cherry-pick persists opts correctly' '
69 pristine_detach initial &&
70 - test_must_fail git cherry-pick -s -m 1 --strategy=recursive -X patience -X ours base..anotherpick &&
70 + test_expect_code 128 git cherry-pick -s -m 1 --strategy=recursive -X patience -X ours base..anotherpick &&
71 test_path_is_dir .git/sequencer &&
72 test_path_is_file .git/sequencer/head &&
73 test_path_is_file .git/sequencer/todo &&
@@ -107,7 +107,7 @@ test_expect_success '--abort requires cherry-pick in progress' '
107
108 test_expect_success '--quit cleans up sequencer state' '
109 pristine_detach initial &&
110 - test_must_fail git cherry-pick base..picked &&
110 + test_expect_code 1 git cherry-pick base..picked &&
111 git cherry-pick --quit &&
112 test_path_is_missing .git/sequencer
113 '
@@ -121,7 +121,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' '
121 :000000 100644 OBJID OBJID A foo
122 :000000 100644 OBJID OBJID A unrelated
123 EOF
124 - test_must_fail git cherry-pick base..picked &&
124 + test_expect_code 1 git cherry-pick base..picked &&
125 git cherry-pick --quit &&
126 test_path_is_missing .git/sequencer &&
127 test_must_fail git update-index --refresh &&
@@ -135,7 +135,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' '
135
136 test_expect_success '--abort to cancel multiple cherry-pick' '
137 pristine_detach initial &&
138 - test_must_fail git cherry-pick base..anotherpick &&
138 + test_expect_code 1 git cherry-pick base..anotherpick &&
139 git cherry-pick --abort &&
140 test_path_is_missing .git/sequencer &&
141 test_cmp_rev initial HEAD &&
@@ -145,7 +145,7 @@ test_expect_success '--abort to cancel multiple cherry-pick' '
145
146 test_expect_success '--abort to cancel single cherry-pick' '
147 pristine_detach initial &&
148 - test_must_fail git cherry-pick picked &&
148 + test_expect_code 1 git cherry-pick picked &&
149 git cherry-pick --abort &&
150 test_path_is_missing .git/sequencer &&
151 test_cmp_rev initial HEAD &&
@@ -155,7 +155,7 @@ test_expect_success '--abort to cancel single cherry-pick' '
155
156 test_expect_success 'cherry-pick --abort to cancel multiple revert' '
157 pristine_detach anotherpick &&
158 - test_must_fail git revert base..picked &&
158 + test_expect_code 1 git revert base..picked &&
159 git cherry-pick --abort &&
160 test_path_is_missing .git/sequencer &&
161 test_cmp_rev anotherpick HEAD &&
@@ -165,7 +165,7 @@ test_expect_success 'cherry-pick --abort to cancel multiple revert' '
165
166 test_expect_success 'revert --abort works, too' '
167 pristine_detach anotherpick &&
168 - test_must_fail git revert base..picked &&
168 + test_expect_code 1 git revert base..picked &&
169 git revert --abort &&
170 test_path_is_missing .git/sequencer &&
171 test_cmp_rev anotherpick HEAD
@@ -173,7 +173,7 @@ test_expect_success 'revert --abort works, too' '
173
174 test_expect_success '--abort to cancel single revert' '
175 pristine_detach anotherpick &&
176 - test_must_fail git revert picked &&
176 + test_expect_code 1 git revert picked &&
177 git revert --abort &&
178 test_path_is_missing .git/sequencer &&
179 test_cmp_rev anotherpick HEAD &&
@@ -184,7 +184,7 @@ test_expect_success '--abort to cancel single revert' '
184 test_expect_success '--abort keeps unrelated change, easy case' '
185 pristine_detach unrelatedpick &&
186 echo changed >expect &&
187 - test_must_fail git cherry-pick picked..yetanotherpick &&
187 + test_expect_code 1 git cherry-pick picked..yetanotherpick &&
188 echo changed >unrelated &&
189 git cherry-pick --abort &&
190 test_cmp expect unrelated
@@ -193,7 +193,7 @@ test_expect_success '--abort keeps unrelated change, easy case' '
193 test_expect_success '--abort refuses to clobber unrelated change, harder case' '
194 pristine_detach initial &&
195 echo changed >expect &&
196 - test_must_fail git cherry-pick base..anotherpick &&
196 + test_expect_code 1 git cherry-pick base..anotherpick &&
197 echo changed >unrelated &&
198 test_must_fail git cherry-pick --abort &&
199 test_cmp expect unrelated &&
@@ -208,7 +208,7 @@ test_expect_success '--abort refuses to clobber unrelated change, harder case' '
208
209 test_expect_success 'cherry-pick still writes sequencer state when one commit is left' '
210 pristine_detach initial &&
211 - test_must_fail git cherry-pick base..picked &&
211 + test_expect_code 1 git cherry-pick base..picked &&
212 test_path_is_dir .git/sequencer &&
213 echo "resolved" >foo &&
214 git add foo &&
@@ -232,7 +232,7 @@ test_expect_success 'cherry-pick still writes sequencer state when one commit is
232
233 test_expect_success '--abort after last commit in sequence' '
234 pristine_detach initial &&
235 - test_must_fail git cherry-pick base..picked &&
235 + test_expect_code 1 git cherry-pick base..picked &&
236 git cherry-pick --abort &&
237 test_path_is_missing .git/sequencer &&
238 test_cmp_rev initial HEAD &&
@@ -242,22 +242,22 @@ test_expect_success '--abort after last commit in sequence' '
242
243 test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
244 pristine_detach initial &&
245 - test_must_fail git cherry-pick base..anotherpick &&
245 + test_expect_code 1 git cherry-pick base..anotherpick &&
246 test-chmtime -v +0 .git/sequencer >expect &&
247 - test_must_fail git cherry-pick unrelatedpick &&
247 + test_expect_code 128 git cherry-pick unrelatedpick &&
248 test-chmtime -v +0 .git/sequencer >actual &&
249 test_cmp expect actual
250 '
251
252 test_expect_success '--continue complains when no cherry-pick is in progress' '
253 pristine_detach initial &&
254 - test_must_fail git cherry-pick --continue
254 + test_expect_code 128 git cherry-pick --continue
255 '
256
257 test_expect_success '--continue complains when there are unresolved conflicts' '
258 pristine_detach initial &&
259 - test_must_fail git cherry-pick base..anotherpick &&
260 - test_must_fail git cherry-pick --continue
259 + test_expect_code 1 git cherry-pick base..anotherpick &&
260 + test_expect_code 128 git cherry-pick --continue
261 '
262
263 test_expect_success '--continue of single cherry-pick' '
@@ -321,7 +321,7 @@ test_expect_success '--continue after resolving conflicts' '
321
322 test_expect_success '--continue after resolving conflicts and committing' '
323 pristine_detach initial &&
324 - test_must_fail git cherry-pick base..anotherpick &&
324 + test_expect_code 1 git cherry-pick base..anotherpick &&
325 echo "c" >foo &&
326 git add foo &&
327 git commit &&
@@ -371,7 +371,7 @@ test_expect_success 'follow advice and skip nil patch' '
371
372 test_expect_success '--continue respects opts' '
373 pristine_detach initial &&
374 - test_must_fail git cherry-pick -x base..anotherpick &&
374 + test_expect_code 1 git cherry-pick -x base..anotherpick &&
375 echo "c" >foo &&
376 git add foo &&
377 git commit &&
@@ -412,7 +412,7 @@ test_expect_success '--continue respects -x in first commit in multi-pick' '
412
413 test_expect_success '--signoff is not automatically propagated to resolved conflict' '
414 pristine_detach initial &&
415 - test_must_fail git cherry-pick --signoff base..anotherpick &&
415 + test_expect_code 1 git cherry-pick --signoff base..anotherpick &&
416 echo "c" >foo &&
417 git add foo &&
418 git commit &&
@@ -456,24 +456,24 @@ test_expect_success 'sign-off needs to be reaffirmed after conflict resolution,
456
457 test_expect_success 'malformed instruction sheet 1' '
458 pristine_detach initial &&
459 - test_must_fail git cherry-pick base..anotherpick &&
459 + test_expect_code 1 git cherry-pick base..anotherpick &&
460 echo "resolved" >foo &&
461 git add foo &&
462 git commit &&
463 sed "s/pick /pick/" .git/sequencer/todo >new_sheet &&
464 cp new_sheet .git/sequencer/todo &&
465 - test_must_fail git cherry-pick --continue
465 + test_expect_code 128 git cherry-pick --continue
466 '
467
468 test_expect_success 'malformed instruction sheet 2' '
469 pristine_detach initial &&
470 - test_must_fail git cherry-pick base..anotherpick &&
470 + test_expect_code 1 git cherry-pick base..anotherpick &&
471 echo "resolved" >foo &&
472 git add foo &&
473 git commit &&
474 sed "s/pick/revert/" .git/sequencer/todo >new_sheet &&
475 cp new_sheet .git/sequencer/todo &&
476 - test_must_fail git cherry-pick --continue
476 + test_expect_code 128 git cherry-pick --continue
477 '
478
479 test_expect_success 'empty commit set' '
@@ -483,18 +483,18 @@ test_expect_success 'empty commit set' '
483
484 test_expect_success 'malformed instruction sheet 3' '
485 pristine_detach initial &&
486 - test_must_fail git cherry-pick base..anotherpick &&
486 + test_expect_code 1 git cherry-pick base..anotherpick &&
487 echo "resolved" >foo &&
488 git add foo &&
489 git commit &&
490 sed "s/pick \([0-9a-f]*\)/pick $_r10/" .git/sequencer/todo >new_sheet &&
491 cp new_sheet .git/sequencer/todo &&
492 - test_must_fail git cherry-pick --continue
492 + test_expect_code 128 git cherry-pick --continue
493 '
494
495 test_expect_success 'instruction sheet, fat-fingers version' '
496 pristine_detach initial &&
497 - test_must_fail git cherry-pick base..anotherpick &&
497 + test_expect_code 1 git cherry-pick base..anotherpick &&
498 echo "c" >foo &&
499 git add foo &&
500 git commit &&
@@ -505,7 +505,7 @@ test_expect_success 'instruction sheet, fat-fingers version' '
505
506 test_expect_success 'commit descriptions in insn sheet are optional' '
507 pristine_detach initial &&
508 - test_must_fail git cherry-pick base..anotherpick &&
508 + test_expect_code 1 git cherry-pick base..anotherpick &&
509 echo "c" >foo &&
510 git add foo &&
511 git commit &&