Re: [PATCH 09/19] tests: use test_write_lines() to generate line-oriented output
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 11, 2021, 06:59 UTC
- Message-ID
- <CAPig+cQVcv5m_9n8F1d1jo4fbLiFvDYTcBCCUcwrXdT3FJvowA@mail.gmail.com>
- In-Reply-To
- <YbMcYwj/Mvf/PoFF@coredump.intra.peff.net>
On Fri, Dec 10, 2021 at 4:22 AM Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
> On Thu, Dec 09, 2021 at 12:11:05AM -0500, Eric Sunshine wrote:
> > test_expect_success 'color new trailing blank lines' '
> > - { echo a; echo b; echo; echo; } >x &&
> > + test_write_lines a b "" "" >x &&
> > git add x &&
> > - { echo a; echo; echo; echo; echo c; echo; echo; echo; echo; } >x &&
> > + test_write_lines a "" "" "" c "" "" "" "" >x &&
>
> Some of these I think might be more readable as here-docs. But I think
> keeping to the minimal change here makes sense (and I admit I do not
> overly care much either way; it was just on my mind from the last
> patch).Indeed, it's a judgment call, but I recall that it was all the embedded and trailing blank lines in these particular cases which pushed me toward test_write_lines() rather than here-docs since test_write_lines() makes it way more compact, which perhaps makes it a bit easier to get the number and placement of the blank lines correct. The corresponding here-doc would have been:
cat <<-\EOF >x &&
ac
EOF