is($str, "hi\n", '->new modified body like Email::Simple');
is($eml->body, "hi\n", '->body works');
is($eml->as_string, "a: b\n\nhi\n", '->as_string');
+ my $empty = PublicInbox::Eml->new("\n\n");
+ is($empty->as_string, "\n\n", 'empty message');
}
for my $cls (@classes) {
is($eml->body, "");
}
+if ('body only') {
+ my $str = <<EOM;
+--- a/lib/PublicInbox/Eml.pm
++++ b/lib/PublicInbox/Eml.pm
+@@ -122,9 +122,10 @@ sub new {
+\x20
+EOM
+ my $eml = PublicInbox::Eml->new($str);
+ is($eml->body, $str, 'body-only accepted');
+}
+
for my $cls (@classes) { # XXX: matching E::M, but not sure about this
my $s = <<EOF;
Content-Type: multipart/mixed; boundary="b"
Content-Disposition: attachment; filename="=?utf-8?q?vtpm-makefile.patch?="
EOF
- is($cls->new($s)->filename, 'vtpm-makefile.patch', 'filename decoded');
+ is($cls->new($s)->filename, 'vtpm-makefile.patch',
+ "filename decoded ($cls)") if $cls ne 'PublicInbox::MIME';
$s =~ s/^Content-Disposition:.*$//sm;
is($cls->new($s)->filename, 'vtpm-fakefile.patch',
"filename fallback ($cls)") if $cls ne 'PublicInbox::MIME';
is($cls->new($s)->content_type,
'text/x-patch; name="vtpm-fakefile.patch"',
- 'matches Email::MIME output, "correct" or not');
+ qq[matches Email::MIME output, "correct" or not ($cls)]);
$s = <<'EOF';
Content-Type: multipart/foo; boundary=b