X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=t%2Fmda.t;h=fad96e5bf44eb733600f5369c4dfed7130559a3b;hp=3357718cd08b67c92f734f22fbd117b3decf944f;hb=e022d3377fd2c50fd9931bf96394728958a90bf3;hpb=89f34da9a510bf87293721942d688b1425bb9cf7 diff --git a/t/mda.t b/t/mda.t index 3357718c..fad96e5b 100644 --- a/t/mda.t +++ b/t/mda.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; use Email::MIME; +use Email::Filter; use File::Temp qw/tempdir/; use Cwd; use IPC::Run qw(run); @@ -43,6 +44,26 @@ my $failbox = "$home/fail.mbox"; } } +local $ENV{GIT_COMMITTER_NAME} = eval { + use PublicInbox::MDA; + use Encode qw/encode/; + my $mbox = 't/utf8.mbox'; + open(my $fh, '<', $mbox) or die "failed to open mbox: $mbox\n"; + my $str = eval { local $/; <$fh> }; + close $fh; + my $msg = Email::Filter->new(data => $str); + $msg = Email::MIME->new($msg->simple->as_string); + my ($author, $email, $date) = PublicInbox::MDA->author_info($msg); + is('Eléanor', + encode('us-ascii', my $tmp = $author, Encode::HTMLCREF), + 'HTML conversion is correct'); + is($email, 'e@example.com', 'email parsed correctly'); + is($date, 'Thu, 01 Jan 1970 00:00:00 +0000', + 'message date parsed correctly'); + $author; +}; +die $@ if $@; + { my $good_rev; local $ENV{PI_EMERGENCY} = $failbox;