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

[PATCH v2 2/6] completion: standardize final space marker in tests

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Nov 11, 2012, 14:35 UTC
Message-ID
<1352644558-9410-3-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1352644558-9410-1-git-send-email-felipe.contreras@gmail.com>

The rest of the code uses ' Z$'. Lets use that for test_completion_long() as well.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/t9902-completion.sh | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 5c06709..aff7e44 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -66,11 +66,10 @@ test_completion ()
 }
 
 # Like test_completion, but reads expectation from stdin,
-# which is convenient when it is multiline. We also process "_" into
-# spaces to make test vectors more readable.
+# which is convenient when it is multiline.
 test_completion_long ()
 {
-	tr _ " " >expected &&
+	sed -e 's/Z$//' > expected &&
 	test_completion "$1"
 }
 
@@ -252,24 +251,24 @@ test_expect_success 'setup for ref completion' '
 
 test_expect_success 'checkout completes ref names' '
 	test_completion_long "git checkout m" <<-\EOF
-	master_
-	mybranch_
-	mytag_
+	master Z
+	mybranch Z
+	mytag Z
 	EOF
 '
 
 test_expect_success 'show completes all refs' '
 	test_completion_long "git show m" <<-\EOF
-	master_
-	mybranch_
-	mytag_
+	master Z
+	mybranch Z
+	mytag Z
 	EOF
 '
 
 test_expect_success '<ref>: completes paths' '
 	test_completion_long "git show mytag:f" <<-\EOF
-	file1_
-	file2_
+	file1 Z
+	file2 Z
 	EOF
 '
 
@@ -278,7 +277,7 @@ test_expect_success 'complete tree filename with spaces' '
 	git add . &&
 	git commit -m spaces &&
 	test_completion_long "git show HEAD:nam" <<-\EOF
-	name with spaces_
+	name with spaces Z
 	EOF
 '
 
@@ -287,8 +286,8 @@ test_expect_failure 'complete tree filename with metacharacters' '
 	git add . &&
 	git commit -m meta &&
 	test_completion_long "git show HEAD:nam" <<-\EOF
-	name with ${meta}_
-	name with spaces_
+	name with ${meta} Z
+	name with spaces Z
 	EOF
 '
 
-- 
1.8.0
Previous: Felipe ContrerasNext: Felipe Contreras
Message 6 of 16 in “completion: test consolidations”
  1. 0/6 completion: test consolidationsFelipe Contreras, Nov 11, 2012
  2. 1/6 completion: add comment for test_completion()Felipe Contreras, Nov 11, 2012
  3. SZEDER GáborNov 16, 2012
  4. Felipe ContrerasNov 16, 2012
  5. Felipe ContrerasNov 16, 2012
  6. 2/6 completion: standardize final space marker in testsFelipe Contreras, Nov 11, 2012
  7. 3/6 completion: simplify tests using test_completion_long()Felipe Contreras, Nov 11, 2012
  8. 4/6 completion: consolidate test_completion*() testsFelipe Contreras, Nov 11, 2012
  9. Junio C HamanoNov 16, 2012
  10. Felipe ContrerasNov 17, 2012
  11. 5/6 completion: refactor __gitcomp related testsFelipe Contreras, Nov 11, 2012
  12. Junio C HamanoNov 16, 2012
  13. Felipe ContrerasNov 16, 2012
  14. SZEDER GáborNov 16, 2012
  15. Junio C HamanoNov 16, 2012
  16. 6/6 completion: simplify __gitcomp() test helperFelipe Contreras, Nov 11, 2012

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.