mailmap tests: add tests for whitespace syntax

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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jan 12, 2021 at 21:18 UTC 9e2a14a88953da80cba75ddde4488a88402e7c8b
1 file changed +52
t/t4203-mailmap.sh
+52
@@ -786,4 +786,56 @@ test_expect_success 'comment syntax: setup' '
786 test_cmp expect actual
787 '
788
789 +test_expect_success 'whitespace syntax: setup' '
790 + test_create_repo space &&
791 + test_commit -C space --author "A <a@example.com>" A &&
792 + test_commit -C space --author "B <b@example.com>" B &&
793 + test_commit -C space --author " C <c@example.com>" C &&
794 + test_commit -C space --author " D <d@example.com>" D &&
795 + test_commit -C space --author "E E <e@example.com>" E &&
796 + test_commit -C space --author "F F <f@example.com>" F &&
797 + test_commit -C space --author "G G <g@example.com>" G &&
798 + test_commit -C space --author "H H <h@example.com>" H &&
799 +
800 + test_config -C space mailmap.file ../space.map &&
801 + cat >>space.map <<-\EOF &&
802 + Ah <ah@example.com> < a@example.com >
803 + Bee <bee@example.com > < b@example.com >
804 + Cee <cee@example.com> C <c@example.com>
805 + dee <dee@example.com> D <d@example.com>
806 + eee <eee@example.com> E E <e@example.com>
807 + eff <eff@example.com> F F <f@example.com>
808 + gee <gee@example.com> G G <g@example.com>
809 + aitch <aitch@example.com> H H <h@example.com>
810 + EOF
811 +
812 + cat >expect <<-\EOF &&
813 + Author A <a@example.com> maps to A <a@example.com>
814 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
815 +
816 + Author B <b@example.com> maps to B <b@example.com>
817 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
818 +
819 + Author C <c@example.com> maps to Cee <cee@example.com>
820 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
821 +
822 + Author D <d@example.com> maps to dee <dee@example.com>
823 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
824 +
825 + Author E E <e@example.com> maps to eee <eee@example.com>
826 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
827 +
828 + Author F F <f@example.com> maps to eff <eff@example.com>
829 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
830 +
831 + Author G G <g@example.com> maps to gee <gee@example.com>
832 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
833 +
834 + Author H H <h@example.com> maps to H H <h@example.com>
835 + Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
836 + EOF
837 + git -C space log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
838 + test_cmp expect actual
839 +'
840 +
841 test_done