From 584721cf9c98beabce9b779faafa1eabb5c24de6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 26 Oct 2021 10:35:51 +0000 Subject: eml: keep body if no headers are found This easily allows us to treat "git diff" output as header-less "messages" for commands such as "lei p2q". --- t/eml.t | 11 +++++++++++ t/mbox_reader.t | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/eml.t b/t/eml.t index 0cf48f22..2d8993a5 100644 --- a/t/eml.t +++ b/t/eml.t @@ -216,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 = <$m($fh, sub { push @x, $_[0]->as_string }); - is_deeply(\@x, [], "messages in invalid $m"); + if ($m =~ /\Amboxcl/) { + is_deeply(\@x, [], "messages in invalid $m"); + } else { + is_deeply(\@x, [ "\n$html" ], "body-only $m"); + } is_deeply([grep(!/^W: leftover/, @w)], [], "no extra warnings besides leftover ($m)"); } -- cgit v1.2.3-24-ge0c7