All of lore.kernel.org
 help / color / mirror / Atom feed
From: "lilinchao@oschina.cn" <lilinchao@oschina.cn>
To: "Junio C Hamano" <gitster@pobox.com>,
	"Li Linchao via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git <git@vger.kernel.org>, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: Re: [PATCH v3] ls-files: update test style
Date: Wed, 29 Jun 2022 15:12:13 +0800	[thread overview]
Message-ID: <2022062915111229306214@oschina.cn> (raw)
In-Reply-To: xmqqzghwim3m.fsf@gitster.g


>"Li Linchao via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> diff --git a/t/README b/t/README
>> index 309a31133c6..5e0539412b4 100644
>> --- a/t/README
>> +++ b/t/README
>> @@ -547,6 +547,52 @@ This test harness library does the following things:
>>     consistently when command line arguments --verbose (or -v),
>>     --debug (or -d), and --immediate (or -i) is given.
>> 
>> +Recommended style
>> +-----------------
>> +Here are some recommented styles when writing test case.
>> +
>> + - Keep test title the same line with test helper function itself.
>> +
>> +   Take test_expect_success helper for example, write it like:
>> +
>> +  test_expect_success 'test title' '
>> +  ... test body ...
>> +  '
>
>Indent the body further to the right?
>
>> + - Indent the body of here-document, and use "<< -" instead of "<<" to strip prefix TAB:
>
>Overly long line.
>
>Did you mean to have a space between "<<" and "-"? 
Ops, I'll fix it. This came from an extension in VS code which is to preview AsciiDoc,
it mistakenly render "<<-" into "<←", so I put a space between "<<" and "-".
>
>"prefix TAB" -> "leading TABs used for indentation" (plural is the
>important part)?  
>
>Mention end of here-document marker should by default be quoted,
>unless the body needs $variable_interpolation? 
Sorry, I don't get it. I don't see many of ending "EOF" are quoted in our tests.
>
>> +  test_expect_success 'test something' '
>> +      cat >expect <<-\EOF &&
>> +      one
>> +      two
>> +      three
>> +      EOF
>> +      test_something > actual &&
>> +      test_cmp expect actual
>> +  '
>> +
>> +   Instead of:
>> +
>> +  test_expect_success 'test something' '
>> +      cat >expect <<\EOF &&
>> +  one
>> +  two
>> +  three
>> +  EOF
>> +      test_something > actual &&
>> +      test_cmp expect actual
>> +  '
>
>
>Thanks.

  reply	other threads:[~2022-06-29  7:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23  8:46 [PATCH] ls-files: update test style Li Linchao via GitGitGadget
2022-06-23 10:50 ` Ævar Arnfjörð Bjarmason
2022-06-24  4:57   ` lilinchao
2022-06-23 17:09 ` Junio C Hamano
2022-06-24  5:05   ` lilinchao
2022-06-28  9:14 ` [PATCH v2] " Li Linchao via GitGitGadget
2022-06-28  9:51   ` [PATCH v3] " Li Linchao via GitGitGadget
2022-06-28 20:12     ` Junio C Hamano
2022-06-29  7:12       ` lilinchao [this message]
2022-06-30 15:54         ` Junio C Hamano
2022-06-30  5:59     ` [PATCH v4] " Li Linchao via GitGitGadget
2022-07-01 11:03       ` [PATCH v5] " Li Linchao via GitGitGadget
2022-07-01 21:46         ` Junio C Hamano
2022-07-03 15:49         ` [PATCH v6] " Li Linchao via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2022062915111229306214@oschina.cn \
    --to=lilinchao@oschina.cn \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.