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

Re: [PATCH v5] ls-files: update test style

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2022, 21:46 UTC
Message-ID
<xmqqbku87bgo.fsf@gitster.g>
In-Reply-To
<pull.1269.v5.git.1656673435357.gitgitgadget@gmail.com>
"Li Linchao via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 44 quoted lines
> From: Li Linchao <lilinchao@oschina.cn>
>
> Update test style in t/t30[*].sh for uniformity, that's to
> keep test title the same line with helper function itself,
> and fix some indentions.
>
> Add a new section "recommended style" in t/README to
> encourage people to use more modern style in test.
>
> Signed-off-by: Li Linchao <lilinchao@oschina.cn>
> ---
>     ls-files: update test style
>     
>     Update test style in t/t30[*].sh for uniformity, that's to keep test
>     title the same line with helper function itself.
>     
>     And update t/README to describe this test style.
>     
>     Signed-off-by: Li Linchao lilinchao@oschina.cn
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1269%2FCactusinhand%2Fllc%2Ffix-test-title-style-v5
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1269/Cactusinhand/llc/fix-test-title-style-v5
> Pull-Request: https://github.com/gitgitgadget/git/pull/1269
>
> Range-diff vs v4:
>
>  1:  d0ee9836f23 ! 1:  6cbb4e5fd49 ls-files: update test style
>      @@ t/README: This test harness library does the following things:
>       +      test_cmp expect actual
>       +  '
>       +
>      ++ - Quote or escape the EOF at the head of a here document when
>      ++   there is no variable interpolation in it:
>      ++
>      ++  cmd <<-"EOF"
>      ++  literal here-doc text
>      ++  EOF
>      ++
>      ++  Or:
>      ++
>      ++  cmd <<-\EOF
>      ++  literal here-doc text
>      ++  EOF
>      ++

I do not htink we need to describe two ways to quote at all. If we absolutely need to have two examples, then:

+  cmd <<-\EOF
+  literal here-doc text
+  EOF
+
+  but not:
+
+  cmd <<-EOF
+  literal here-doc text
+  EOF

but I'd say the lines are better spent to explain what we have this particular style guide item for.

        - Quote or escape the EOF delimiter that begins a here-document if
          there is no parameter and other expansion in it, to signal readers
          that they can skim it more casually:
          cmd <<-\EOF
          literal here-document text without any expansion
          EOF
or something.
Other than that, this looks really good.
Thanks.
Previous: Li Linchao via GitGitGadgetNext: Li Linchao via GitGitGadget
Message 13 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.