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

[RFC/PATCH 2/4] t4203: test check-mailmap command invocation

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 10, 2013, 19:03 UTC
Message-ID
<1373483041-27901-3-git-send-email-sunshine@sunshineco.com>
In-Reply-To
<1373483041-27901-1-git-send-email-sunshine@sunshineco.com>

Test the command-line interface of check-mailmap. (Actual .mailmap functionality is already covered by existing tests.)

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/t4203-mailmap.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 842b754..8645492 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -13,6 +13,11 @@ fuzz_blame () {
 }
 
 test_expect_success setup '
+	cat >contacts <<-\EOF &&
+	A U Thor <author@example.com>
+	nick1 <bugs@company.xx>
+	EOF
+
 	echo one >one &&
 	git add one &&
 	test_tick &&
@@ -23,6 +28,51 @@ test_expect_success setup '
 	git commit --author "nick1 <bugs@company.xx>" -m second
 '
 
+test_expect_success 'check-mailmap no arguments' '
+	test_must_fail git check-mailmap
+'
+
+test_expect_success 'check-mailmap arguments' '
+	cat >expect <<-\EOF &&
+	A U Thor <author@example.com>
+	nick1 <bugs@company.xx>
+	EOF
+	git check-mailmap \
+		"A U Thor <author@example.com>" \
+		"nick1 <bugs@company.xx>" >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap --stdin' '
+	cat >expect <<-\EOF &&
+	A U Thor <author@example.com>
+	nick1 <bugs@company.xx>
+	EOF
+	git check-mailmap --stdin <contacts >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap --stdin arguments' '
+	cat >expect <<-\EOF &&
+	Internal Guy <bugs@company.xy>
+	EOF
+	cat <contacts >>expect &&
+	git check-mailmap --stdin "Internal Guy <bugs@company.xy>" \
+		<contacts >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap -z' '
+	printf "A U Thor <author@example.com>\0" >expect &&
+	printf "nick1 <bugs@company.xx>\0" >>expect &&
+	git check-mailmap -z --stdin <contacts >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap bogus contact' '
+	test_must_fail git check-mailmap bogus
+'
+
 cat >expect <<\EOF
 A U Thor (1):
       initial
-- 
1.8.3.2
Previous: Eric SunshineNext: Eric Sunshine
Message 8 of 10 in “add git-check-mailmap command”
  1. 0/4 add git-check-mailmap commandEric Sunshine, Jul 10, 2013
  2. 1/4 builtin: add git-check-mailmap commandEric Sunshine, Jul 10, 2013
  3. Duy NguyenJul 11, 2013
  4. Eric SunshineJul 11, 2013
  5. Duy NguyenJul 11, 2013
  6. Antoine PelisseJul 11, 2013
  7. Eric SunshineJul 11, 2013
  8. 2/4 t4203: test check-mailmap command invocationEric Sunshine, Jul 10, 2013
  9. 3/4 t4203: test mailmap functionality directly rather than indirectlyEric Sunshine, Jul 10, 2013
  10. 4/4 t4203: consolidate test-repository setupEric Sunshine, Jul 10, 2013

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.