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

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.

Previous: lilinchao@oschina.cnNext: lilinchao@oschina.cn
Message 4 of 14 in “ls-files: update test style”
  1. ls-files: update test styleLi Linchao via GitGitGadget, Jun 23, 2022
  2. Ævar Arnfjörð BjarmasonJun 23, 2022
  3. lilinchao@oschina.cnJun 24, 2022
  4. Junio C HamanoJun 23, 2022
  5. lilinchao@oschina.cnJun 24, 2022
  6. ls-files: update test styleLi Linchao via GitGitGadget, Jun 28, 2022
  7. ls-files: update test styleLi Linchao via GitGitGadget, Jun 28, 2022
  8. Junio C HamanoJun 28, 2022
  9. lilinchao@oschina.cnJun 29, 2022
  10. Junio C HamanoJun 30, 2022
  11. ls-files: update test styleLi Linchao via GitGitGadget, Jun 30, 2022
  12. ls-files: update test styleLi Linchao via GitGitGadget, Jul 1, 2022
  13. Junio C HamanoJul 1, 2022
  14. ls-files: update test styleLi Linchao via GitGitGadget, Jul 3, 2022

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.