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

[PATCH 1/2] t3301: test diagnose messages for too few/many paramters

From
Doan Tran Cong Danh <congdanhqx@gmail.com>
Date
Oct 16, 2019, 05:18 UTC
Message-ID
<20191016051841.19896-1-congdanhqx@gmail.com>
In-Reply-To
<20191015163631.21808-1-congdanhqx@gmail.com>

From commit bbb1b8a35a, ("notes: check number of parameters to "git notes copy"", 2010-06-28), we have a test for too many or too few of parameters provided to `git notes copy'.

However, the test is only ensure the command will fail but it doesn't really check if it fails because of number of parameters.

If we accidentally lifted the check inside our code base, the test may still failed because the provided parameter is not a valid ref.

Correct it.
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
---
 t/t3301-notes.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index d3fa298c6a..d7767e4438 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -1167,8 +1167,10 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
 '
 
 test_expect_success 'git notes copy diagnoses too many or too few parameters' '
-	test_must_fail git notes copy &&
-	test_must_fail git notes copy one two three
+	test_must_fail git notes copy 2>error &&
+	test_i18ngrep "too few parameters" error &&
+	test_must_fail git notes copy one two three 2>error &&
+	test_i18ngrep "too many parameters" error
 '
 
 test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '
-- 
2.23.0
Previous: Danh DoanNext: Doan Tran Cong Danh
Message 5 of 8 in “Allow default value for target of git-notes copy”
  1. 0/1 Allow default value for target of git-notes copyDoan Tran Cong Danh, Oct 15, 2019
  2. 1/1 notes: copy notes to HEAD by defaultDoan Tran Cong Danh, Oct 15, 2019
  3. Junio C HamanoOct 16, 2019
  4. Danh DoanOct 16, 2019
  5. 1/2 t3301: test diagnose messages for too few/many paramtersDoan Tran Cong Danh, Oct 16, 2019
  6. 2/2 notes: fix minimum number of parameters to "copy" subcommandDoan Tran Cong Danh, Oct 16, 2019
  7. Junio C HamanoOct 18, 2019
  8. Junio C HamanoOct 18, 2019

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.