t7600: use test_write_lines()

In t7600, we were rewriting `printf '%s\n' ...` to create files from
parameters, one per line. However, we already have a function that wraps
this for us: test_write_lines(). Rewrite these instances to use that
function instead of open coding it.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Denton Liu 2020-03-21 05:21:21 -04:00 committed by Junio C Hamano
parent 805d9eaf5e
commit fd6852cab2

View File

@ -29,15 +29,15 @@ Testing basic merge operations/option parsing.
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
printf '%s\n' 1 2 3 4 5 6 7 8 9 >file
printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >file.1
printf '%s\n' 1 2 3 4 '5 X' 6 7 8 9 >file.5
printf '%s\n' 1 2 3 4 5 6 7 8 '9 X' >file.9
printf '%s\n' 1 2 3 4 5 6 7 8 '9 Y' >file.9y
printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >result.1
printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
printf '%s\n' 1 2 3 4 5 6 7 8 '9 Z' >result.9z
test_write_lines 1 2 3 4 5 6 7 8 9 >file
test_write_lines '1 X' 2 3 4 5 6 7 8 9 >file.1
test_write_lines 1 2 3 4 '5 X' 6 7 8 9 >file.5
test_write_lines 1 2 3 4 5 6 7 8 '9 X' >file.9
test_write_lines 1 2 3 4 5 6 7 8 '9 Y' >file.9y
test_write_lines '1 X' 2 3 4 5 6 7 8 9 >result.1
test_write_lines '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
test_write_lines '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
test_write_lines 1 2 3 4 5 6 7 8 '9 Z' >result.9z
create_merge_msgs () {
echo "Merge tag 'c2'" >msg.1-5 &&
@ -81,7 +81,7 @@ verify_head () {
}
verify_parents () {
printf '%s\n' "$@" >parents.expected &&
test_write_lines "$@" >parents.expected &&
>parents.actual &&
i=1 &&
while test $i -le $#
@ -95,7 +95,7 @@ verify_parents () {
}
verify_mergeheads () {
printf '%s\n' "$@" >mergehead.expected &&
test_write_lines "$@" >mergehead.expected &&
while read sha1 rest
do
git rev-parse $sha1