Re: [PATCH] ls-files: update test style
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 23, 2022, 17:09 UTC
- Message-ID
- <xmqq5ykr1f37.fsf@gitster.g>
- In-Reply-To
- <pull.1269.git.1655974015414.gitgitgadget@gmail.com>
"Li Linchao via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 16 quoted lines
> diff --git a/t/README b/t/README > index 309a31133c6..70205fba41b 100644 > --- a/t/README > +++ b/t/README > @@ -560,6 +560,21 @@ Here are the "do's:" > Even code that isn't a test per se, but merely some setup code > should be inside a test assertion. > > + - Keep test title the same line with test helper function itself, > + and end the line with a single quote. > + > + Take test_expect_success helper for example, write it like: > + > + test_expect_success 'test title to describe this test case' ' > + # test body > + '
If you want to show the pretty layout, then the test body should be shown indented, i.e.
test_expect_success 'title' ' ... test body ... '
But I am not sure if this belongs to the existing "Do's and don'ts" section, which lists tips that matter for correctness.
This new one certainly encouraged as a more modern style, but is not about correctness at all.
A separate "recommended style" section might make sense, but there will be a lot more entries, like when to quote and not to quote EOF marker for here-document, indenting the body of here-document, etc.