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

Re: [PATCH v4 8/8] [Newcomer] t7004: Use single quotes instead of double quotes

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 6, 2024, 17:21 UTC
Message-ID
<CAPig+cQPXh-wmNYGSEX_3-C3ydF-O7k22tAx8hB_N55ZYo-aDQ@mail.gmail.com>
In-Reply-To
<207c4f3c-c444-4405-bed7-34186efa1144@gmail.com>
On Tue, Aug 6, 2024 at 6:10 AM AbdAlRahman Gad <abdobngad@gmail.com> wrote:
Show 24 quoted lines
> On 8/6/24 06:02, Eric Sunshine wrote:
> > We need to exercise a bit of caution when making this sort of change
> > because a "..." string differs from a '...' string in shell. [...]
> > [...]
> > Having said all that, in this case, you seem to have lucked out and
> > nothing broke by changing the double-quotes to single-quotes around
> > the test bodies.
> >
> > However...
> > ... changing the double-quotes to single-quotes for the test _titles_
> > in these instances is actively wrong. In this case, we _want_
> > interpolation of `$option` to happen in the title string so that the
> > output looks like this:
> >      ok 167 - mixing incompatible modes with --contains is forbidden
> >
> > By changing the title to use single-quotes, you suppress interpolation
> > of `$option`, with the result that the displayed titles become rather
> > useless:
> >      ok 167 - mixing incompatible modes with $option is forbidden
>
> Thanks for the through explanation! Should I not include this patch in
> v5 as the test body is error-prune or should I revert changing the
> double-quotes to single-quotes for test description and keep the changes
> to the test body and send the patch with v5?

Overall, the changes made by this patch are valuable since it brings the script more in line with modern practice and because single-quotes around the test body make it easier for readers to reason about test behavior. Coupled with the fact that none of the tests broke by changing the bodies from double- to single-quote, it's a good idea to keep this patch in v5 but omit the parts which break the test descriptions.

Previous: AbdAlRahman GadNext: Junio C Hamano
Message 17 of 21 in “t7004: Modernize the style”
  1. 0/8 t7004: Modernize the styleAbdAlRahman Gad, Aug 5, 2024
  2. 1/8 [Newcomer] t7004: Remove space after redirect operatorsAbdAlRahman Gad, Aug 5, 2024
  3. 2/8 [Newcomer] t7004: Do not lose exit status to pipeAbdAlRahman Gad, Aug 5, 2024
  4. Eric SunshineAug 6, 2024
  5. AbdAlRahman GadAug 6, 2024
  6. Eric SunshineAug 6, 2024
  7. 3/8 [Newcomer] t7004: One command per lineAbdAlRahman Gad, Aug 5, 2024
  8. 4/8 [Newcomer] t7004: Do not prepare things outside test_expect_successAbdAlRahman Gad, Aug 5, 2024
  9. Eric SunshineAug 6, 2024
  10. AbdAlRahman GadAug 6, 2024
  11. 5/8 [Newcomer] t7004: Use indented here-docAbdAlRahman Gad, Aug 5, 2024
  12. 6/8 [Newcomer] t7004: Description on the same line as test_expect_successAbdAlRahman Gad, Aug 5, 2024
  13. 7/8 [Newcomer] t7004: test Description and test body seperated with backslashAbdAlRahman Gad, Aug 5, 2024
  14. 8/8 [Newcomer] t7004: Use single quotes instead of double quotesAbdAlRahman Gad, Aug 5, 2024
  15. Eric SunshineAug 6, 2024
  16. AbdAlRahman GadAug 6, 2024
  17. Eric SunshineAug 6, 2024
  18. Junio C HamanoAug 6, 2024
  19. Eric SunshineAug 6, 2024
  20. Junio C HamanoAug 6, 2024
  21. AbdAlRahman GadAug 6, 2024

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.