git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Dragan Simic <dsimic@manjaro.org>,
	 git@vger.kernel.org, rsbecker@nexbridge.com,
	 github@seichter.de
Subject: Re: [PATCH v2 4/5] t1300: add more tests for whitespace and inline comments
Date: Sun, 17 Mar 2024 21:38:38 -0700	[thread overview]
Message-ID: <xmqqttl4kvch.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cTLrsUpvKVjkFUgs1b1gvj54rm6FBa=5v3uoQtJnB4rZQ@mail.gmail.com> (Eric Sunshine's message of "Sun, 17 Mar 2024 22:48:14 -0400")

Eric Sunshine <sunshine@sunshineco.com> writes:

>> >> +       x_to_tab >.git/config <<-\EOF
>> >> +       [section]
>> >> +               Xsolid = rock
>> >> +               Xsparse = big XX blue
>> >> +               ...
>> >> +       EOF
>> >> +'

Just this part.

> 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.


  reply	other threads:[~2024-03-18  4:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17  3:48 [PATCH v2 0/5] Fix a bug in configuration parsing, and improve tests and documentation Dragan Simic
2024-03-17  3:48 ` [PATCH v2 1/5] config: minor addition of whitespace Dragan Simic
2024-03-17  3:48 ` [PATCH v2 2/5] config: really keep value-internal whitespace verbatim Dragan Simic
2024-03-17  3:48 ` [PATCH v2 3/5] test: introduce new x_to_tab() helper function Dragan Simic
2024-03-17  4:03   ` Eric Sunshine
2024-03-17  4:16     ` Dragan Simic
2024-03-17  3:48 ` [PATCH v2 4/5] t1300: add more tests for whitespace and inline comments Dragan Simic
2024-03-17  4:21   ` Eric Sunshine
2024-03-17  4:27     ` Eric Sunshine
2024-03-17  4:50     ` Dragan Simic
2024-03-18  2:48       ` Eric Sunshine
2024-03-18  4:38         ` Junio C Hamano [this message]
2024-03-18  8:37           ` Dragan Simic
2024-03-18 19:21             ` Eric Sunshine
2024-03-18 21:57               ` Dragan Simic
2024-03-18  8:17         ` Dragan Simic
2024-03-18 19:17           ` Eric Sunshine
2024-03-18 20:28             ` Junio C Hamano
2024-03-18 21:54             ` Dragan Simic
2024-03-17  3:48 ` [PATCH v2 5/5] config.txt: describe handling of whitespace further Dragan Simic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqttl4kvch.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=dsimic@manjaro.org \
    --cc=git@vger.kernel.org \
    --cc=github@seichter.de \
    --cc=rsbecker@nexbridge.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).