+{
+ my $no_blank_eom = <<'EOM';
+From x@y Fri Oct 2 00:00:00 1993
+a: b
+
+body1
+From x@y Fri Oct 2 00:00:00 1993
+c: d
+
+body2
+EOM
+ # chop($no_blank_eom) eq "\n" or BAIL_OUT 'broken LF';
+ for my $variant (qw(mboxrd mboxo)) {
+ my @x;
+ open my $fh, '<', \$no_blank_eom or BAIL_OUT 'PerlIO::scalar';
+ $reader->$variant($fh, sub { push @x, shift });
+ is_deeply($x[0]->{bdy}, \"body1\n", 'LF preserved in 1st');
+ is_deeply($x[1]->{bdy}, \"body2\n", 'no LF added in 2nd');
+ }
+}
+
+SKIP: {
+ use PublicInbox::Spawn qw(popen_rd);
+ my $fh = popen_rd([ $^X, '-E', <<'' ]);
+say "From x@y Fri Oct 2 00:00:00 1993";
+print "a: b\n\n", "x" x 70000, "\n\n";
+say "From x@y Fri Oct 2 00:00:00 2010";
+print "Final: bit\n\n", "Incomplete\n\n";
+exit 1
+
+ my @x;
+ eval { $reader->mboxrd($fh, sub { push @x, shift->as_string }) };
+ like($@, qr/error closing mbox/, 'detects error reading from pipe');
+ is(scalar(@x), 1, 'only saw one message');
+ is(scalar(grep(/Final/, @x)), 0, 'no incomplete bit');
+}
+
+{
+ my $html = <<EOM;
+<html><head><title>hi,</title></head><body>how are you</body></html>
+EOM
+ for my $m (qw(mboxrd mboxcl mboxcl2 mboxo)) {
+ my (@w, @x);
+ local $SIG{__WARN__} = sub { push @w, @_ };
+ open my $fh, '<', \$html or xbail 'PerlIO::scalar';
+ PublicInbox::MboxReader->$m($fh, sub {
+ push @x, $_[0]->as_string
+ });
+ is_deeply(\@x, [], "messages in invalid $m");
+ is_deeply([grep(!/^W: leftover/, @w)], [],
+ "no extra warnings besides leftover ($m)");
+ }
+}
+