X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fview.t;h=6c0859915e89c9ae2d1384d69c2bd35a5c8d5ed0;hb=31afda256c813443062e0504213d41732e50ee45;hp=a70c52d8d0549e49cb50f86f7efb22484e986eb1;hpb=21a5cfeb30afef90ca888d425b62651466eed9e3;p=public-inbox.git diff --git a/t/view.t b/t/view.t index a70c52d8..6c085991 100644 --- a/t/view.t +++ b/t/view.t @@ -6,6 +6,18 @@ use Test::More; use Email::MIME; use PublicInbox::View; +sub msg_html ($) { + my ($mime) = @_; + + my $s = ''; + my $body = PublicInbox::View::msg_html(undef, $mime); + while (defined(my $buf = $body->getline)) { + $s .= $buf; + } + $body->close; + $s; +} + # plain text { my $body = < $body, )->as_string; my $mime = Email::MIME->new($s); - my $html = PublicInbox::View::msg_html(undef, $mime); + my $html = msg_html($mime); # ghetto tests like($html, qr! $parts, ); - my $html = PublicInbox::View::msg_html(undef, $mime); + my $html = msg_html($mime); like($html, qr/hi\n.*-- Attachment #2.*\nbye\n/s, "multipart split"); } @@ -100,7 +112,7 @@ EOF parts => $parts, ); - my $html = PublicInbox::View::msg_html(undef, $mime); + my $html = msg_html($mime); like($html, qr!.*Attachment #2: foo\.patch --!, "parts split with filename"); } @@ -126,7 +138,7 @@ EOF ); my $orig = $mime->body_raw; - my $html = PublicInbox::View::msg_html(undef, $mime); + my $html = msg_html($mime); like($orig, qr/hi =3D bye=/, "our test used QP correctly"); like($html, qr/\bhi = bye\b/, "HTML output decoded QP"); }