Message ID | 20210612042755.28342-4-congdanhqx@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | t: new helper test_line_count_cmd | expand |
Hi Đoàn, > - test 5 -eq $(git ls-files -s | wc -l) && > - test 4 -eq $(git ls-files -u | wc -l) && > + test_line_count_cmd --out = 5 git ls-files -s && > + test_line_count_cmd --out = 4 git ls-files -u && I read lines above as "Formerly I tested that 5/4 should be equal to output of git ls-files -s/-u piped to wc -l, now I do the same with test_line_count_cmd". Am I right?
On Sat, Jun 12, 2021 at 12:28 AM Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote: > > Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> > --- > diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh > @@ -82,13 +82,13 @@ test_expect_success 'modify/delete + directory/file conflict' ' > - test 5 -eq $(git ls-files -s | wc -l) && > - test 4 -eq $(git ls-files -u | wc -l) && > + test_line_count_cmd --out = 5 git ls-files -s && > + test_line_count_cmd --out = 4 git ls-files -u && Nit: too many spaces before the `&&` on the second line: s/\s+/ / > @@ -103,13 +103,13 @@ test_expect_success 'modify/delete + directory/file conflict; other way' ' > - test 5 -eq $(git ls-files -s | wc -l) && > - test 4 -eq $(git ls-files -u | wc -l) && > + test_line_count_cmd --out = 5 git ls-files -s && > + test_line_count_cmd --out = 4 git ls-files -u && Nit: too many spaces before the `&&` on both lines.
On 2021-06-12 11:33:49+0700, Bagas Sanjaya <bagasdotme@gmail.com> wrote: > Hi Đoàn, It's better to call me Danh. Thanks. Don't worry, I was called Dan all the time, too ;) > > > - test 5 -eq $(git ls-files -s | wc -l) && > > - test 4 -eq $(git ls-files -u | wc -l) && > > + test_line_count_cmd --out = 5 git ls-files -s && > > + test_line_count_cmd --out = 4 git ls-files -u && > > I read lines above as "Formerly I tested that 5/4 should be equal to output > of git ls-files -s/-u piped to wc -l, now I do the same with > test_line_count_cmd". > > Am I right? Yes, you read that right. This series is mostly a cleanup for linting "test .* -o" (But that regex wouldn't be put to be used anytime soon).
On 2021-06-12 23:39:51-0400, Eric Sunshine <sunshine@sunshineco.com> wrote: > On Sat, Jun 12, 2021 at 12:28 AM Đoàn Trần Công Danh > <congdanhqx@gmail.com> wrote: > > > > Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> > > --- > > diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh > > @@ -82,13 +82,13 @@ test_expect_success 'modify/delete + directory/file conflict' ' > > - test 5 -eq $(git ls-files -s | wc -l) && > > - test 4 -eq $(git ls-files -u | wc -l) && > > + test_line_count_cmd --out = 5 git ls-files -s && > > + test_line_count_cmd --out = 4 git ls-files -u && > > Nit: too many spaces before the `&&` on the second line: s/\s+/ / Thanks, I'll update them, later. In my defence, this patch was generated mechanically with: :%s/test \([0-9]\+\) -eq "*[$][(]\(.*\)|.*[)]"*/test_line_count_cmd --out = \1 \2/gc I forgot to include the space after final ")" > > @@ -103,13 +103,13 @@ test_expect_success 'modify/delete + directory/file conflict; other way' ' > > - test 5 -eq $(git ls-files -s | wc -l) && > > - test 4 -eq $(git ls-files -u | wc -l) && > > + test_line_count_cmd --out = 5 git ls-files -s && > > + test_line_count_cmd --out = 4 git ls-files -u && > > Nit: too many spaces before the `&&` on both lines.
diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh index 38700d29b5..9d7b9354c5 100755 --- a/t/t6400-merge-df.sh +++ b/t/t6400-merge-df.sh @@ -82,13 +82,13 @@ test_expect_success 'modify/delete + directory/file conflict' ' git checkout delete^0 && test_must_fail git merge modify && - test 5 -eq $(git ls-files -s | wc -l) && - test 4 -eq $(git ls-files -u | wc -l) && + test_line_count_cmd --out = 5 git ls-files -s && + test_line_count_cmd --out = 4 git ls-files -u && if test "$GIT_TEST_MERGE_ALGORITHM" = ort then - test 0 -eq $(git ls-files -o | wc -l) + test_line_count_cmd --out = 2 git ls-files -o else - test 1 -eq $(git ls-files -o | wc -l) + test_line_count_cmd --out = 3 git ls-files -o fi && test_path_is_file letters/file && @@ -103,13 +103,13 @@ test_expect_success 'modify/delete + directory/file conflict; other way' ' test_must_fail git merge delete && - test 5 -eq $(git ls-files -s | wc -l) && - test 4 -eq $(git ls-files -u | wc -l) && + test_line_count_cmd --out = 5 git ls-files -s && + test_line_count_cmd --out = 4 git ls-files -u && if test "$GIT_TEST_MERGE_ALGORITHM" = ort then - test 0 -eq $(git ls-files -o | wc -l) + test_line_count_cmd --out = 2 git ls-files -o else - test 1 -eq $(git ls-files -o | wc -l) + test_line_count_cmd --out = 3 git ls-files -o fi && test_path_is_file letters/file &&
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> --- t/t6400-merge-df.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)