1 # Copyright (C) 2013-2015 all contributors <meta@public-inbox.org>
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
13 my $body = PublicInbox::View::msg_html(undef, $mime);
14 while (defined(my $buf = $body->getline)) {
29 > Long and wordy reply goes here and it is split across multiple lines.
30 > We generate links to a separate full page where quoted-text is inline.
34 > See MAX_INLINE_QUOTED
35 > See MAX_INLINE_QUOTED
36 > See MAX_INLINE_QUOTED
37 > See MAX_INLINE_QUOTED
38 > See MAX_INLINE_QUOTED
39 > See MAX_INLINE_QUOTED
40 > See MAX_INLINE_QUOTED
41 > See MAX_INLINE_QUOTED
45 my $s = Email::Simple->create(
47 From => 'a@example.com',
48 To => 'b@example.com',
49 'Content-Type' => 'text/plain',
50 'Message-ID' => '<hello@example.com>',
51 Subject => 'this is a subject',
55 my $mime = Email::MIME->new($s);
56 my $html = msg_html($mime);
59 like($html, qr!<a\nhref="raw"!s, "raw link present");
60 like($html, qr/hello world\b/, "body present");
61 like($html, qr/> keep this inline/, "short quoted text is inline");
68 attributes => { content_type => 'text/plain', },
72 attributes => { content_type => 'text/plain', },
76 my $mime = Email::MIME->create(
78 From => 'a@example.com',
80 'Message-ID' => '<blah@example.com>',
81 'In-Reply-To' => '<irp@example.com>',
86 my $html = msg_html($mime);
87 like($html, qr/hi\n.*-- Attachment #2.*\nbye\n/s, "multipart split");
90 # multipart email with attached patch
94 attributes => { content_type => 'text/plain', },
95 body => 'hi, see attached patch',
99 content_type => 'text/plain',
100 filename => "foo.patch",
102 body => "--- a/file\n+++ b/file\n" .
103 "@@ -49, 7 +49,34 @@\n",
106 my $mime = Email::MIME->create(
108 From => 'a@example.com',
109 Subject => '[PATCH] asdf',
110 'Message-ID' => '<patch@example.com>',
115 my $html = msg_html($mime);
116 like($html, qr!.*Attachment #2: foo\.patch --!,
117 "parts split with filename");
120 # multipart collapsed to single quoted-printable text/plain
125 content_type => 'text/plain',
126 encoding => 'quoted-printable',
131 my $mime = Email::MIME->create(
133 From => 'qp@example.com',
135 'Message-ID' => '<qp@example.com>',
140 my $orig = $mime->body_raw;
141 my $html = msg_html($mime);
142 like($orig, qr/hi =3D bye=/, "our test used QP correctly");
143 like($html, qr/\bhi = bye\b/, "HTML output decoded QP");
147 use PublicInbox::MID qw/id_compress/;
149 # n.b: this is probably invalid since we dropped CGI for PSGI:
150 like(id_compress('foo%bar@wtf'), qr/\A[a-f0-9]{40}\z/,
151 "percent always converted to sha1 to workaround buggy httpds");
153 is(id_compress('foobar-wtf'), 'foobar-wtf',
154 'regular ID not compressed');