Skip to content

Commit

Permalink
test: add test_write_lines helper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael S. Tsirkin authored and Junio C Hamano committed Jun 10, 2014
1 parent 5f95c9f commit ac9afcc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions t/README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions t/test-lib-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" "$@"
}
Expand Down

0 comments on commit ac9afcc

Please sign in to comment.