Subject: [PATCH 19/22] mailmap tests: add tests for whitespace syntax

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Tue, 12 Jan 2021 21:18:03 +0100

Add tests for mailmap's handling of whitespace, i.e. how it trims
space within "<>" and around author names.

Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
---
 t/t4203-mailmap.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 10e672e006..4f61655c04 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -786,4 +786,56 @@ test_expect_success 'comment syntax: setup' '
 	test_cmp expect actual
 '
 
+test_expect_success 'whitespace syntax: setup' '
+	test_create_repo space &&
+	test_commit -C space --author "A <[email-masked]>" A &&
+	test_commit -C space --author "B <[email-masked]>" B &&
+	test_commit -C space --author " C <[email-masked]>" C &&
+	test_commit -C space --author " D  <[email-masked]>" D &&
+	test_commit -C space --author "E E <[email-masked]>" E &&
+	test_commit -C space --author "F  F <[email-masked]>" F &&
+	test_commit -C space --author "G   G <[email-masked]>" G &&
+	test_commit -C space --author "H   H <[email-masked]>" H &&
+
+	test_config -C space mailmap.file ../space.map &&
+	cat >>space.map <<-\EOF &&
+	Ah <[email-masked]> < [email-masked] >
+	Bee <[email-masked]  > <  [email-masked]  >
+	Cee <[email-masked]> C <[email-masked]>
+	dee <[email-masked]>  D  <[email-masked]>
+	eee <[email-masked]> E E <[email-masked]>
+	eff <[email-masked]> F  F <[email-masked]>
+	gee <[email-masked]> G   G <[email-masked]>
+	aitch <[email-masked]> H  H <[email-masked]>
+	EOF
+
+	cat >expect <<-\EOF &&
+	Author A <[email-masked]> maps to A <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author B <[email-masked]> maps to B <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author C <[email-masked]> maps to Cee <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author D <[email-masked]> maps to dee <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author E E <[email-masked]> maps to eee <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author F  F <[email-masked]> maps to eff <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author G   G <[email-masked]> maps to gee <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+
+	Author H   H <[email-masked]> maps to H   H <[email-masked]>
+	Committer C O Mitter <[email-masked]> maps to C O Mitter <[email-masked]>
+	EOF
+	git -C space log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
2.29.2.222.g5d2a92d10f8