X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Feml.t;h=2e6a441f51dc71b85bbb37fcff318f6f2bb88e47;hb=c1e7a048be9d32cdca943bb3b7f935ed28768d4d;hp=4d1c1216f7c9a611ab0b4b3ebaa0b55aacf90f2f;hpb=5c4874309c4dd7aa8b9acd6bb97bd512360ab08a;p=public-inbox.git
diff --git a/t/eml.t b/t/eml.t
index 4d1c1216..2e6a441f 100644
--- a/t/eml.t
+++ b/t/eml.t
@@ -1,5 +1,5 @@
#!perl -w
-# Copyright (C) 2020 all contributors
+# Copyright (C) 2020-2021 all contributors
# License: AGPL-3.0+
use strict;
use Test::More;
@@ -26,6 +26,8 @@ sub mime_load ($) {
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) {
@@ -214,6 +216,17 @@ if ('one newline before headers') {
is($eml->body, "");
}
+if ('body only') {
+ my $str = <new($str);
+ is($eml->body, $str, 'body-only accepted');
+}
+
for my $cls (@classes) { # XXX: matching E::M, but not sure about this
my $s = <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