tests: use test_write_lines() to generate line-oriented output

Take advantage of test_write_lines() to generate line-oriented output
rather than using for-loops or a series of `echo` commands. Not only is
test_write_lines() a natural fit for such a task, but there is less
opportunity for a broken &&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Sunshine
2021-12-09 00:11:05 -05:00
committed by Junio C Hamano
parent 020b813f40
commit 0849541268
26 changed files with 106 additions and 170 deletions

View File

@ -9,10 +9,7 @@ test_expect_success setup '
git add empty &&
test_tick &&
git commit -m initial &&
for i in a b c d e
do
echo $i
done >empty &&
test_write_lines a b c d e >empty &&
cat empty >expect &&
git diff |
sed -e "/^diff --git/d" \