@matheusbsbs / matheus-bagliano / commits / fd6852cab2
Fork 0

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>

Denton Liu committed Mar 21, 2020 at 05:21 UTC fd6852cab219149e800d352f3939631377b41575
1 file changed +11 -11
t/t7600-merge.sh
+11 -11
@@ -29,15 +29,15 @@ Testing basic merge operations/option parsing.
29 . ./test-lib.sh
30 . "$TEST_DIRECTORY"/lib-gpg.sh
31
32 -printf '%s\n' 1 2 3 4 5 6 7 8 9 >file
33 -printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >file.1
34 -printf '%s\n' 1 2 3 4 '5 X' 6 7 8 9 >file.5
35 -printf '%s\n' 1 2 3 4 5 6 7 8 '9 X' >file.9
36 -printf '%s\n' 1 2 3 4 5 6 7 8 '9 Y' >file.9y
37 -printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >result.1
38 -printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
39 -printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
40 -printf '%s\n' 1 2 3 4 5 6 7 8 '9 Z' >result.9z
32 +test_write_lines 1 2 3 4 5 6 7 8 9 >file
33 +test_write_lines '1 X' 2 3 4 5 6 7 8 9 >file.1
34 +test_write_lines 1 2 3 4 '5 X' 6 7 8 9 >file.5
35 +test_write_lines 1 2 3 4 5 6 7 8 '9 X' >file.9
36 +test_write_lines 1 2 3 4 5 6 7 8 '9 Y' >file.9y
37 +test_write_lines '1 X' 2 3 4 5 6 7 8 9 >result.1
38 +test_write_lines '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
39 +test_write_lines '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
40 +test_write_lines 1 2 3 4 5 6 7 8 '9 Z' >result.9z
41
42 create_merge_msgs () {
43 echo "Merge tag 'c2'" >msg.1-5 &&
@@ -81,7 +81,7 @@ verify_head () {
81 }
82
83 verify_parents () {
84 - printf '%s\n' "$@" >parents.expected &&
84 + test_write_lines "$@" >parents.expected &&
85 >parents.actual &&
86 i=1 &&
87 while test $i -le $#
@@ -95,7 +95,7 @@ verify_parents () {
95 }
96
97 verify_mergeheads () {
98 - printf '%s\n' "$@" >mergehead.expected &&
98 + test_write_lines "$@" >mergehead.expected &&
99 while read sha1 rest
100 do
101 git rev-parse $sha1