Skip to content

Commit 19c291e

Browse files
Unique-Usmanttaylorr
authored andcommitted
t3404: replace test with test_line_count()
Refactor t3404 to replace instances of `test` with `test_line_count()` for checking line counts. This improves readability and aligns with Git's current test practices. Signed-off-by: Usman Akinyemi <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent c8fbae2 commit 19c291e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

t/t3404-rebase-interactive.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,9 @@ test_expect_success 'stop on conflicting pick' '
281281
test_cmp expect2 file1 &&
282282
test "$(git diff --name-status |
283283
sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 &&
284-
test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) &&
285-
test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo)
284+
grep -v "^#" <.git/rebase-merge/done >actual &&
285+
test_line_count = 4 actual &&
286+
test 0 = $(grep -c "^[^#]" <.git/rebase-merge/git-rebase-todo)
286287
'
287288

288289
test_expect_success 'show conflicted patch' '
@@ -401,8 +402,8 @@ test_expect_success 'multi-squash only fires up editor once' '
401402
) &&
402403
test $base = $(git rev-parse HEAD^) &&
403404
git show >output &&
404-
count=$(grep ONCE output | wc -l) &&
405-
test 1 = $count
405+
grep ONCE output >actual &&
406+
test_line_count = 1 actual
406407
'
407408

408409
test_expect_success 'multi-fixup does not fire up editor' '
@@ -416,8 +417,7 @@ test_expect_success 'multi-fixup does not fire up editor' '
416417
) &&
417418
test $base = $(git rev-parse HEAD^) &&
418419
git show >output &&
419-
count=$(grep NEVER output | wc -l) &&
420-
test 0 = $count &&
420+
! grep NEVER output &&
421421
git checkout @{-1} &&
422422
git branch -D multi-fixup
423423
'
@@ -436,8 +436,8 @@ test_expect_success 'commit message used after conflict' '
436436
) &&
437437
test $base = $(git rev-parse HEAD^) &&
438438
git show >output &&
439-
count=$(grep ONCE output | wc -l) &&
440-
test 1 = $count &&
439+
grep ONCE output >actual &&
440+
test_line_count = 1 actual &&
441441
git checkout @{-1} &&
442442
git branch -D conflict-fixup
443443
'
@@ -456,8 +456,8 @@ test_expect_success 'commit message retained after conflict' '
456456
) &&
457457
test $base = $(git rev-parse HEAD^) &&
458458
git show >output &&
459-
count=$(grep TWICE output | wc -l) &&
460-
test 2 = $count &&
459+
grep TWICE output >actual &&
460+
test_line_count = 2 actual &&
461461
git checkout @{-1} &&
462462
git branch -D conflict-squash
463463
'
@@ -501,8 +501,8 @@ test_expect_success 'squash ignores comments' '
501501
) &&
502502
test $base = $(git rev-parse HEAD^) &&
503503
git show >output &&
504-
count=$(grep ONCE output | wc -l) &&
505-
test 1 = $count &&
504+
grep ONCE output >actual &&
505+
test_line_count = 1 actual &&
506506
git checkout @{-1} &&
507507
git branch -D skip-comments
508508
'
@@ -519,8 +519,8 @@ test_expect_success 'squash ignores blank lines' '
519519
) &&
520520
test $base = $(git rev-parse HEAD^) &&
521521
git show >output &&
522-
count=$(grep ONCE output | wc -l) &&
523-
test 1 = $count &&
522+
grep ONCE output >actual &&
523+
test_line_count = 1 actual &&
524524
git checkout @{-1} &&
525525
git branch -D skip-blank-lines
526526
'

0 commit comments

Comments
 (0)