git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test doc: test_write_lines does not split its arguments

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 5, 2014, 23:51 UTC
Message-ID
<20140505235143.GU9218@google.com>
In-Reply-To
<1398622524-26207-2-git-send-email-mst@redhat.com>
test_write_lines carefully quotes its arguments as "$@", so
	test_write_lines "a b" c
writes two lines as requested, not three.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Hi,
Michael S. Tsirkin wrote:
Show 8 quoted lines
> +++ b/t/README
> @@ -596,6 +596,28 @@ library for your script to use.
> +	test_write_lines "a b c d e f g" >foo
> +
> +   Is a more compact equivalent of:
> +	cat >foo <<-EOF
> +	a
> +	b
[...]
Show 9 quoted lines
> +++ 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" "$@"
> +}
How about this patch?

Thanks, Jonathan

 t/README | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/t/README b/t/README
index 2d6232f..8a9d499 100644
--- a/t/README
+++ b/t/README
@@ -596,15 +596,14 @@ library for your script to use.
 		...
 	'
 
- - test_write_lines <text>
+ - test_write_lines <lines>
 
-   Split <text> to white-space separated words and write it out on standard
-   output, one word per line.
+   Write <lines> on standard output, one line per argument.
    Useful to prepare multi-line files in a compact form.
 
    Example:
 
-	test_write_lines "a b c d e f g" >foo
+	test_write_lines a b c d e f g >foo
 
    Is a more compact equivalent of:
 	cat >foo <<-EOF
-- 
1.9.1.423.g4596e3a
Previous: Michael S. TsirkinNext: Michael S. Tsirkin
Message 3 of 8 in “patch-id: make it stable against hunk reordering”
  1. 1/5 patch-id: make it stable against hunk reorderingMichael S. Tsirkin, Apr 27, 2014
  2. 2/5 test: add test_write_lines helperMichael S. Tsirkin, Apr 27, 2014
  3. test doc: test_write_lines does not split its argumentsJonathan Nieder, May 5, 2014
  4. Michael S. TsirkinMay 6, 2014
  5. 3/5 patch-id-test: test stable and unstable behaviourMichael S. Tsirkin, Apr 27, 2014
  6. 4/5 patch-id: change default to stableMichael S. Tsirkin, Apr 27, 2014
  7. 5/5 t4204-patch-id.sh: default is now stableMichael S. Tsirkin, Apr 27, 2014
  8. Junio C HamanoApr 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.