Re: [PATCH v4 3/3] t4113: put executable lines to test_expect_success
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 15, 2023, 00:34 UTC
- Message-ID
- <CAPig+cTMBpau+G6bJSbYScOT38CU9BCi8RQ554jZYMUd+TheTQ@mail.gmail.com>
- In-Reply-To
- <230208.865ycc1tqc.gmgdl@evledraar.gmail.com>
On Wed, Feb 8, 2023 at 2:57 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 15 quoted lines
> In this case the syntax you're trying to get working is something we > usually try to avoid in either case, i.e. even if it involves an > external process we usually do: > > cat >out <<-\EOF > a > b > c > EOF > > Rather than: > > echo "a > b > c" >out
The here-doc (<<-\EOF) form is definitely a good idea when the code is part of an indented test body, whereas the multi-line double-quoted string will be problematic since lines "b" and "c" will be indented with TAB, which is undesirable here.
Even better for such a simple case would be:
test_write_lines a b c >out &&
In fact, Junio made this suggestion in the form of a code snipped much earlier in this thread.
Show 14 quoted lines
> If you are using "echo" I saw another change of yours had e.g.:
>
> echo x >f &&
> echo y >>f &&
> echo z >>f
>
> It's better to e.g. (assuming use of "echo", or other built-ins or
> commands):
>
> {
> echo x &&
> echo y &&
> echo z
> } >fThis is also an improvement, though test_write_lines would (again) be even better for such a simple case:
test_write_lines x y z >f &&