git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Li Linchao via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Li Linchao" <lilinchao@oschina.cn>
Subject: Re: [PATCH v3] ls-files: update test style
Date: Tue, 28 Jun 2022 13:12:13 -0700	[thread overview]
Message-ID: <xmqqzghwim3m.fsf@gitster.g> (raw)
In-Reply-To: <pull.1269.v3.git.1656409884091.gitgitgadget@gmail.com> (Li Linchao via GitGitGadget's message of "Tue, 28 Jun 2022 09:51:23 +0000")

"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 "-"?

"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?

> +  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-28 20:17 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 [this message]
2022-06-29  7:12       ` lilinchao
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqzghwim3m.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=lilinchao@oschina.cn \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).