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

@@ -667,10 +667,7 @@ test_expect_success 'amend can copy notes' '
test_expect_success 'commit a file whose name is a dash' '
git reset --hard &&
for i in 1 2 3 4 5
do
echo $i
done >./- &&
test_write_lines 1 2 3 4 5 >./- &&
git add ./- &&
test_tick &&
git commit -m "add dash" >output </dev/null &&