Re: [PATCH v3] ls-files: update test style
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 28, 2022, 20:12 UTC
- Message-ID
- <xmqqzghwim3m.fsf@gitster.g>
- In-Reply-To
- <pull.1269.v3.git.1656409884091.gitgitgadget@gmail.com>
"Li Linchao via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 19 quoted lines
> 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?
Show 21 quoted lines
> + 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.