builtin-am: invoke pre-applypatch hook
[git.git] / t / t9000 / test.pl
blob2d05d3eeab3f801fcf74a93c9305d067ac628937
1 #!/usr/bin/perl
2 use lib (split(/:/, $ENV{GITPERLLIB}));
4 use 5.008;
5 use warnings;
6 use strict;
8 use Test::More qw(no_plan);
9 use Mail::Address;
11 BEGIN { use_ok('Git') }
13 my @success_list = (q[Jane],
14 q[jdoe@example.com],
15 q[<jdoe@example.com>],
16 q[Jane <jdoe@example.com>],
17 q[Jane Doe <jdoe@example.com>],
18 q["Jane" <jdoe@example.com>],
19 q["Doe, Jane" <jdoe@example.com>],
20 q["Jane@:;\>.,()<Doe" <jdoe@example.com>],
21 q[Jane!#$%&'*+-/=?^_{|}~Doe' <jdoe@example.com>],
22 q["<jdoe@example.com>"],
23 q["Jane jdoe@example.com"],
24 q[Jane Doe <jdoe @ example.com >],
25 q[Jane Doe < jdoe@example.com >],
26 q[Jane @ Doe @ Jane @ Doe],
27 q["Jane, 'Doe'" <jdoe@example.com>],
28 q['Doe, "Jane' <jdoe@example.com>],
29 q["Jane" "Do"e <jdoe@example.com>],
30 q["Jane' Doe" <jdoe@example.com>],
31 q["Jane Doe <jdoe@example.com>" <jdoe@example.com>],
32 q["Jane\" Doe" <jdoe@example.com>],
33 q[Doe, jane <jdoe@example.com>],
34 q["Jane Doe <jdoe@example.com>],
35 q['Jane 'Doe' <jdoe@example.com>]);
37 my @known_failure_list = (q[Jane\ Doe <jdoe@example.com>],
38 q["Doe, Ja"ne <jdoe@example.com>],
39 q["Doe, Katarina" Jane <jdoe@example.com>],
40 q[Jane@:;\.,()<>Doe <jdoe@example.com>],
41 q[Jane jdoe@example.com],
42 q[<jdoe@example.com> Jane Doe],
43 q[Jane <jdoe@example.com> Doe],
44 q["Jane "Kat"a" ri"na" ",Doe" <jdoe@example.com>],
45 q[Jane Doe],
46 q[Jane "Doe <jdoe@example.com>"],
47 q[\"Jane Doe <jdoe@example.com>],
48 q[Jane\"\" Doe <jdoe@example.com>],
49 q['Jane "Katarina\" \' Doe' <jdoe@example.com>]);
51 foreach my $str (@success_list) {
52 my @expected = map { $_->format } Mail::Address->parse("$str");
53 my @actual = Git::parse_mailboxes("$str");
54 is_deeply(\@expected, \@actual, qq[same output : $str]);
57 TODO: {
58 local $TODO = "known breakage";
59 foreach my $str (@known_failure_list) {
60 my @expected = map { $_->format } Mail::Address->parse("$str");
61 my @actual = Git::parse_mailboxes("$str");
62 is_deeply(\@expected, \@actual, qq[same output : $str]);
66 my $is_passing = eval { Test::More->is_passing };
67 exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/;