git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: git@vger.kernel.org
Cc: sunshine@sunshineco.com, jrnieder@gmail.com, peff@peff.net,
	gitster@pobox.com
Subject: [PATCH v6 2/5] test: add test_write_lines helper
Date: Sun, 27 Apr 2014 21:15:47 +0300	[thread overview]
Message-ID: <1398622524-26207-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1398622524-26207-1-git-send-email-mst@redhat.com>

API and implementation as suggested by Junio.

Signed-off-by: Michael S. Tsirkin <mst@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

  reply	other threads:[~2014-04-27 18:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-27 18:15 [PATCH v6 1/5] patch-id: make it stable against hunk reordering Michael S. Tsirkin
2014-04-27 18:15 ` Michael S. Tsirkin [this message]
2014-05-05 23:51   ` [PATCH] test doc: test_write_lines does not split its arguments Jonathan Nieder
2014-05-06 18:20     ` Michael S. Tsirkin
2014-04-27 18:15 ` [PATCH v6 3/5] patch-id-test: test stable and unstable behaviour Michael S. Tsirkin
2014-04-27 18:15 ` [PATCH v6 4/5] patch-id: change default to stable Michael S. Tsirkin
2014-04-27 18:15 ` [PATCH v6 5/5] t4204-patch-id.sh: default is now stable Michael S. Tsirkin
2014-04-29 21:45 ` [PATCH v6 1/5] patch-id: make it stable against hunk reordering Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398622524-26207-2-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).