Skip to content

Commit cb5c952

Browse files
sunshinecogitster
authored andcommitted
t4203: test check-mailmap command invocation
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 226ad34 commit cb5c952

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

t/t4203-mailmap.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ fuzz_blame () {
1313
}
1414

1515
test_expect_success setup '
16+
cat >contacts <<-\EOF &&
17+
A U Thor <author@example.com>
18+
nick1 <bugs@company.xx>
19+
EOF
20+
1621
echo one >one &&
1722
git add one &&
1823
test_tick &&
@@ -23,6 +28,44 @@ test_expect_success setup '
2328
git commit --author "nick1 <bugs@company.xx>" -m second
2429
'
2530

31+
test_expect_success 'check-mailmap no arguments' '
32+
test_must_fail git check-mailmap
33+
'
34+
35+
test_expect_success 'check-mailmap arguments' '
36+
cat >expect <<-\EOF &&
37+
A U Thor <author@example.com>
38+
nick1 <bugs@company.xx>
39+
EOF
40+
git check-mailmap \
41+
"A U Thor <author@example.com>" \
42+
"nick1 <bugs@company.xx>" >actual &&
43+
test_cmp expect actual
44+
'
45+
46+
test_expect_success 'check-mailmap --stdin' '
47+
cat >expect <<-\EOF &&
48+
A U Thor <author@example.com>
49+
nick1 <bugs@company.xx>
50+
EOF
51+
git check-mailmap --stdin <contacts >actual &&
52+
test_cmp expect actual
53+
'
54+
55+
test_expect_success 'check-mailmap --stdin arguments' '
56+
cat >expect <<-\EOF &&
57+
Internal Guy <bugs@company.xy>
58+
EOF
59+
cat <contacts >>expect &&
60+
git check-mailmap --stdin "Internal Guy <bugs@company.xy>" \
61+
<contacts >actual &&
62+
test_cmp expect actual
63+
'
64+
65+
test_expect_success 'check-mailmap bogus contact' '
66+
test_must_fail git check-mailmap bogus
67+
'
68+
2669
cat >expect <<\EOF
2770
A U Thor (1):
2871
initial

0 commit comments

Comments
 (0)