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 <usmanakinyemi202@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Usman Akinyemi committed
Oct 12, 2024 at 23:09 UTC
19c291e5b2427b717869be3732822e33eb5b4f83
1 file changed
+14
-14
t/t3404-rebase-interactive.sh
+14
-14
@@ -281,8 +281,9 @@ test_expect_success 'stop on conflicting pick' '
281
test_cmp expect2 file1 &&
282
test "$(git diff --name-status |
283
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)
287
'
288
289
test_expect_success 'show conflicted patch' '
@@ -401,8 +402,8 @@ test_expect_success 'multi-squash only fires up editor once' '
402
) &&
403
test $base = $(git rev-parse HEAD^) &&
404
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
407
'
408
409
test_expect_success 'multi-fixup does not fire up editor' '
@@ -416,8 +417,7 @@ test_expect_success 'multi-fixup does not fire up editor' '
417
) &&
418
test $base = $(git rev-parse HEAD^) &&
419
git show >output &&
419
- count=$(grep NEVER output | wc -l) &&
420
- test 0 = $count &&
420
+ ! grep NEVER output &&
421
git checkout @{-1} &&
422
git branch -D multi-fixup
423
'
@@ -436,8 +436,8 @@ test_expect_success 'commit message used after conflict' '
436
) &&
437
test $base = $(git rev-parse HEAD^) &&
438
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 &&
441
git checkout @{-1} &&
442
git branch -D conflict-fixup
443
'
@@ -456,8 +456,8 @@ test_expect_success 'commit message retained after conflict' '
456
) &&
457
test $base = $(git rev-parse HEAD^) &&
458
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 &&
461
git checkout @{-1} &&
462
git branch -D conflict-squash
463
'
@@ -501,8 +501,8 @@ test_expect_success 'squash ignores comments' '
501
) &&
502
test $base = $(git rev-parse HEAD^) &&
503
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 &&
506
git checkout @{-1} &&
507
git branch -D skip-comments
508
'
@@ -519,8 +519,8 @@ test_expect_success 'squash ignores blank lines' '
519
) &&
520
test $base = $(git rev-parse HEAD^) &&
521
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 &&
524
git checkout @{-1} &&
525
git branch -D skip-blank-lines
526
'