API and implementation as suggested by Junio.

Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
---
 t/README                | 22 ++++++++++++++++++++++
 t/test-lib-functions.sh |  5 +++++
 2 files changed, 27 insertions(+)

diff --git a/t/README b/t/README
index caeeb9d..2d6232f 100644
--- a/t/README
+++ b/t/README
@@ -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
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 158e10a..f581535 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -717,6 +717,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" "$@"
 }
-- 
MST

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to