Re: [PATCH 09/19] tests: use test_write_lines() to generate line-oriented output
From: Eric Sunshine <hidden>
Date: 2021-12-11 06:59:45
On Fri, Dec 10, 2021 at 4:22 AM Jeff King [off-list ref] wrote:
On Thu, Dec 09, 2021 at 12:11:05AM -0500, Eric Sunshine wrote:quoted
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 &&
a
c
EOF