Skip to content

Commit 1662297

Browse files
mehul2029gitster
authored andcommitted
t5520: reduce commom lines of code
These two tests are almost similar and thus can be folded in a for-loop. Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Mehul Jain <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 44a59ff commit 1662297

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

t/t5520-pull.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,13 @@ test_expect_success 'pull --rebase --no-autostash & rebase.autostash unset' '
298298
test_pull_autostash_fail --rebase --no-autostash
299299
'
300300

301-
test_expect_success 'pull --autostash (without --rebase) should error out' '
302-
test_must_fail git pull --autostash . copy 2>err &&
303-
test_i18ngrep "only valid with --rebase" err
304-
'
305-
306-
test_expect_success 'pull --no-autostash (without --rebase) should error out' '
307-
test_must_fail git pull --no-autostash . copy 2>err &&
308-
test_i18ngrep "only valid with --rebase" err
309-
'
301+
for i in --autostash --no-autostash
302+
do
303+
test_expect_success "pull $i (without --rebase) is illegal" '
304+
test_must_fail git pull $i . copy 2>err &&
305+
test_i18ngrep "only valid with --rebase" err
306+
'
307+
done
310308

311309
test_expect_success 'pull.rebase' '
312310
git reset --hard before-rebase &&

0 commit comments

Comments
 (0)