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

Re: [PATCH v2 4/5] t1300: add more tests for whitespace and inline comments

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 18, 2024, 04:38 UTC
Message-ID
<xmqqttl4kvch.fsf@gitster.g>
In-Reply-To
<CAPig+cTLrsUpvKVjkFUgs1b1gvj54rm6FBa=5v3uoQtJnB4rZQ@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 7 quoted lines
>> >> +       x_to_tab >.git/config <<-\EOF
>> >> +       [section]
>> >> +               Xsolid = rock
>> >> +               Xsparse = big XX blue
>> >> +               ...
>> >> +       EOF
>> >> +'
Just this part.
Show 9 quoted lines
> My assumption, perhaps incorrectly, was that existing tests already
> verified correct behavior of leading whitespace and that the tests
> added by this patch were about internal whitespace. If that's not the
> case (and perhaps I didn't fully digest the commit message) then my
> question about the leading "X" is off the mark.
>
> If these new tests are also checking leading whitespace behavior, then
> to improve coverage, would it make sense to have the leading "X" on
> some lines but not others?

If "<<-" (I have here-doc but please strip the leading tabs because I am aligning the here-doc with them) gets in the way for testing material with leading tabs, the way to write and preprocess such a here-doc is:

	sed -e 's/^|//' -e 's/Q/   /g' >.git/config <<-\EOF
	|[section]
	|	solid = rock
	|	sparse = big QQ blue
	|	...
	EOF

It will make it clear where the left-edge of the "sheet of paper" is, removal of leading '|' does not get in the way of using '|' in the middle of the line if needed, and Q being the least used letter makes them stand out more in the middle of the line. As it is obvious that what is before solid and sparse is a tab (otherwise you would not be using that '|' trick), you do not have to write Xsolid or Qsolid there and still the result is much easier to read.

Previous: Eric SunshineNext: Dragan Simic
Message 12 of 20 in “Fix a bug in configuration parsing, and improve tests and documentation”
  1. 0/5 Fix a bug in configuration parsing, and improve tests and documentationDragan Simic, Mar 17, 2024
  2. 1/5 config: minor addition of whitespaceDragan Simic, Mar 17, 2024
  3. 2/5 config: really keep value-internal whitespace verbatimDragan Simic, Mar 17, 2024
  4. 3/5 test: introduce new x_to_tab() helper functionDragan Simic, Mar 17, 2024
  5. Eric SunshineMar 17, 2024
  6. Dragan SimicMar 17, 2024
  7. 4/5 t1300: add more tests for whitespace and inline commentsDragan Simic, Mar 17, 2024
  8. Eric SunshineMar 17, 2024
  9. Eric SunshineMar 17, 2024
  10. Dragan SimicMar 17, 2024
  11. Eric SunshineMar 18, 2024
  12. Junio C HamanoMar 18, 2024
  13. Dragan SimicMar 18, 2024
  14. Eric SunshineMar 18, 2024
  15. Dragan SimicMar 18, 2024
  16. Dragan SimicMar 18, 2024
  17. Eric SunshineMar 18, 2024
  18. Junio C HamanoMar 18, 2024
  19. Dragan SimicMar 18, 2024
  20. 5/5 config.txt: describe handling of whitespace furtherDragan Simic, Mar 17, 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.