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>

Eric Sunshine committed Jul 12, 2013 at 20:53 UTC cb5c9521f1e41aa536c2cf64d689e647d035bb90
1 file changed +43
t/t4203-mailmap.sh
+43
@@ -13,6 +13,11 @@ fuzz_blame () {
13 }
14
15 test_expect_success setup '
16 + cat >contacts <<-\EOF &&
17 + A U Thor <author@example.com>
18 + nick1 <bugs@company.xx>
19 + EOF
20 +
21 echo one >one &&
22 git add one &&
23 test_tick &&
@@ -23,6 +28,44 @@ test_expect_success setup '
28 git commit --author "nick1 <bugs@company.xx>" -m second
29 '
30
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 +
69 cat >expect <<\EOF
70 A U Thor (1):
71 initial