test: add test_write_lines helper

API and implementation as suggested by Junio.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Michael S. Tsirkin 2014-04-27 21:15:47 +03:00 committed by Junio C Hamano
parent 5f95c9f850
commit ac9afcc31c
2 changed files with 27 additions and 0 deletions

View File

@ -596,6 +596,28 @@ library for your script to use.
...
'

- test_write_lines <text>

Split <text> to white-space separated words and write it out on standard
output, one word per line.
Useful to prepare multi-line files in a compact form.

Example:

test_write_lines "a b c d e f g" >foo

Is a more compact equivalent of:
cat >foo <<-EOF
a
b
c
d
e
f
g
EOF


- test_pause

This command is useful for writing and debugging tests and must be

View File

@ -712,6 +712,11 @@ test_ln_s_add () {
fi
}

# This function writes out its parameters, one per line
test_write_lines () {
printf "%s\n" "$@"
}

perl () {
command "$PERL_PATH" "$@"
}