diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2021-12-09 00:11:05 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-13 10:29:48 -0800 |
commit | 0849541268a3aca9381591aed87b6864a203709b (patch) | |
tree | 00aa5e565425fd234928d17ad17e91c521d01d38 /t/t4117-apply-reject.sh | |
parent | 020b813f400b55528edca00aff4d8e95080376f6 (diff) | |
download | git-0849541268a3aca9381591aed87b6864a203709b.tar.gz |
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>
Diffstat (limited to 't/t4117-apply-reject.sh')
-rwxr-xr-x | t/t4117-apply-reject.sh | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/t/t4117-apply-reject.sh b/t/t4117-apply-reject.sh index 0ee93fe845..c86d05a96f 100755 --- a/t/t4117-apply-reject.sh +++ b/t/t4117-apply-reject.sh @@ -10,25 +10,16 @@ test_description='git apply with rejects . ./test-lib.sh test_expect_success setup ' - for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 - do - echo $i - done >file1 && + test_write_lines 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >file1 && cat file1 >saved.file1 && git update-index --add file1 && git commit -m initial && - for i in 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21 - do - echo $i - done >file1 && + test_write_lines 1 2 A B 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 D 21 >file1 && git diff >patch.1 && cat file1 >clean && - for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21 - do - echo $i - done >expected && + test_write_lines 1 E 2 3 4 5 6 7 8 9 10 11 12 C 13 14 15 16 17 18 19 20 F 21 >expected && mv file1 file2 && git update-index --add --remove file1 file2 && @@ -38,10 +29,7 @@ test_expect_success setup ' mv saved.file1 file1 && git update-index --add --remove file1 file2 && - for i in 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21 - do - echo $i - done >file1 && + test_write_lines 1 E 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 F 21 >file1 && cat file1 >saved.file1 ' |