git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/5] t6036, t6042: use test_line_count instead of wc -l

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
May 24, 2018, 10:36 UTC
Message-ID
<CAM0VKjmTVTA8JV=_6EVDGi1mD3VJXSJL7GxQJ0G2F5SaH-HWDQ@mail.gmail.com>
In-Reply-To
<20180524100507.32305-1-szeder.dev@gmail.com>
On Thu, May 24, 2018 at 12:05 PM, SZEDER Gábor <szeder.dev@gmail.com> wrote:
Show 31 quoted lines
>
>> Signed-off-by: Elijah Newren <newren@gmail.com>
>> ---
>>  t/t6036-recursive-corner-cases.sh    | 102 ++++++++++++++++++---------
>>  t/t6042-merge-rename-corner-cases.sh |  99 +++++++++++++++++---------
>>  2 files changed, 134 insertions(+), 67 deletions(-)
>>
>> diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
>> index cfe6a99771..3e659cff28 100755
>> --- a/t/t6036-recursive-corner-cases.sh
>> +++ b/t/t6036-recursive-corner-cases.sh
>> @@ -65,9 +65,12 @@ test_expect_success 'merge simple rename+criss-cross with no modifications' '
>>
>>               test_must_fail git merge -s recursive R2^0 &&
>>
>> -             test 2 = $(git ls-files -s | wc -l) &&
>> -             test 2 = $(git ls-files -u | wc -l) &&
>> -             test 2 = $(git ls-files -o | wc -l) &&
>
> Here 'git ls-files -o' should have listed two untracked files ...
>
>> +             git ls-files -s >out &&
>> +             test_line_count = 2 out &&
>> +             git ls-files -u >out &&
>> +             test_line_count = 2 out &&
>> +             git ls-files -o >out &&
>> +             test_line_count = 3 out &&
>
> ... but now you expect it to list three.  I was about to point out the
> typo, but then noticed that you expect it to list one more untracked
> file than before in all subsequent tests...
Hrm, not all, actually, because there is this one exception:
>> @@ -426,10 +444,14 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' '
>>               test_must_fail git merge -s recursive C^0 >out &&
Note that the file 'out' is created here ...
Show 6 quoted lines
>>               test_i18ngrep "CONFLICT (rename/rename)" out &&
>>
>> -             test 2 -eq $(git ls-files -s | wc -l) &&
>> -             test 2 -eq $(git ls-files -u | wc -l) &&
>> -             test 2 -eq $(git ls-files -u c | wc -l) &&
>> -             test 3 -eq $(git ls-files -o | wc -l) &&
... so this  'git ls-files -o' already lists it as well, ...
Show 8 quoted lines
>> +             git ls-files -s >out &&
>> +             test_line_count = 2 out &&
>> +             git ls-files -u >out &&
>> +             test_line_count = 2 out &&
>> +             git ls-files -u c >out &&
>> +             test_line_count = 2 out &&
>> +             git ls-files -o >out &&
>> +             test_line_count = 3 out &&
... therefore the number of untracked files here remains unchanged.
>>
>>               test ! -f a &&
>>               test ! -f b &&
Previous: SZEDER GáborNext: Elijah Newren
Message 5 of 11 in “Modernize some testcases for merge-recursive corner cases”
  1. 0/5 Modernize some testcases for merge-recursive corner casesElijah Newren, May 24, 2018
  2. 1/5 t6036, t6042: use test_create_repo to keep tests independentElijah Newren, May 24, 2018
  3. 2/5 t6036, t6042: use test_line_count instead of wc -lElijah Newren, May 24, 2018
  4. SZEDER GáborMay 24, 2018
  5. SZEDER GáborMay 24, 2018
  6. Elijah NewrenMay 24, 2018
  7. Junio C HamanoMay 25, 2018
  8. Elijah NewrenMay 26, 2018
  9. 4/5 t6036, t6042: prefer test_cmp to sequences of testElijah Newren, May 24, 2018
  10. 3/5 t6036, t6042: prefer test_path_is_file, test_path_is_missingElijah Newren, May 24, 2018
  11. 5/5 t6036: prefer test_when_finished to manual cleanup in following testElijah Newren, May 24, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.