Thread (20 messages) 20 messages, 6 authors, 2021-06-24

Re: [PATCH 4/4] t6402: use test_line_count_cmd to count # of lines in stdout

flat view

From: Eric Sunshine <hidden>
Date: 2021-06-13 03:43:36

On Sat, Jun 12, 2021 at 12:28 AM Đoàn Trần Công Danh
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Đoàn Trần Công Danh <redacted>
---
diff --git a/t/t6402-merge-rename.sh b/t/t6402-merge-rename.sh
@@ -330,8 +320,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
-       test 3 -eq "$(git ls-files -u | wc -l)" &&
-       test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
+       test_line_count_cmd --out = 3 git ls-files -u  &&
+       test_line_count_cmd --out = 2 git ls-files -u dir/file-in-the-way  &&
Nit: too many spaces before `&&`: s/\s+/ /
quoted hunk ↗ jump to hunk
@@ -357,8 +347,8 @@ test_expect_success 'Same as previous, but merged other way' '
-       test 3 -eq "$(git ls-files -u | wc -l)" &&
-       test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
+       test_line_count_cmd --out = 3 git ls-files -u  &&
+       test_line_count_cmd --out = 2 git ls-files -u dir/file-in-the-way  &&
Ditto.
quoted hunk ↗ jump to hunk
@@ -374,8 +364,8 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in
-       test 3 -eq "$(git ls-files -u | wc -l)" &&
-       test 3 -eq "$(git ls-files -u dir | wc -l)" &&
+       test_line_count_cmd --out = 3 git ls-files -u  &&
+       test_line_count_cmd --out = 3 git ls-files -u dir  &&
Ditto.
quoted hunk ↗ jump to hunk
@@ -409,14 +399,15 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
-       test 5 -eq "$(git ls-files -u | wc -l)" &&
+       test_line_count_cmd --out = 5 git ls-files -u  &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
        then
-               test 3 -eq "$(git ls-files -u dir~HEAD | wc -l)"
+               test_line_count_cmd --out = 3 git ls-files -u dir~HEAD
        else
-               test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)"
+               git ls-files -u dir >out &&
+               test_line_count_cmd --out = 3 grep -v file-in-the-way out
        fi &&
-       test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
+       test_line_count_cmd --out = 2 git ls-files -u dir/file-in-the-way  &&
And again.
quoted hunk ↗ jump to hunk
@@ -432,14 +423,15 @@ test_expect_success 'Same as previous, but merged other way' '
-       test 5 -eq "$(git ls-files -u | wc -l)" &&
+       test_line_count_cmd --out = 5 git ls-files -u  &&
Here too.
-       test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
+       test_line_count_cmd --out = 2 git ls-files -u dir/file-in-the-way  &&
Blorp.

And the rest of the changes suffer the same problem, so I won't
continue commenting...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help