about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/lei-convert.t20
-rw-r--r--t/lei_to_mail.t4
2 files changed, 20 insertions, 4 deletions
diff --git a/t/lei-convert.t b/t/lei-convert.t
index 7ff628f9..dc53b82c 100644
--- a/t/lei-convert.t
+++ b/t/lei-convert.t
@@ -6,6 +6,7 @@ use PublicInbox::MboxReader;
 use PublicInbox::MdirReader;
 use PublicInbox::NetReader;
 use PublicInbox::Eml;
+use IO::Uncompress::Gunzip;
 require_mods(qw(lei -imapd -nntpd Mail::IMAPClient Net::NNTP));
 my ($tmpdir, $for_destroy) = tmpdir;
 my $sock = tcp_server;
@@ -91,13 +92,28 @@ test_lei({ tmpdir => $tmpdir }, sub {
         @bar = ();
         PublicInbox::MboxReader->mboxcl2($fh, sub {
                 my $eml = shift;
-                for my $h (qw(Status Content-Length Lines)) {
+                for my $h (qw(Content-Length Lines)) {
                         ok(defined($eml->header_raw($h)),
                                 "$h defined for mboxcl2");
                         $eml->header_set($h);
                 }
                 push @bar, $eml;
         });
-        is_deeply(\@bar, [ eml_load('t/plack-qp.eml') ], 'eml => mboxcl2');
+        my $qp_eml = eml_load('t/plack-qp.eml');
+        $qp_eml->header_set('Status', 'O');
+        is_deeply(\@bar, [ $qp_eml ], 'eml => mboxcl2');
+
+        lei_ok qw(convert t/plack-qp.eml -o), "mboxrd:$d/qp.gz";
+        open $fh, '<', "$d/qp.gz" or xbail $!;
+        ok(-s $fh, 'not empty');
+        $fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
+        @bar = ();
+        PublicInbox::MboxReader->mboxrd($fh, sub { push @bar, shift });
+        is_deeply(\@bar, [ $qp_eml ], 'wrote gzipped mboxrd');
+        lei_ok qw(convert -o mboxrd:/dev/stdout), "mboxrd:$d/qp.gz";
+        open $fh, '<', \$lei_out or xbail;
+        @bar = ();
+        PublicInbox::MboxReader->mboxrd($fh, sub { push @bar, shift });
+        is_deeply(\@bar, [ $qp_eml ], 'readed gzipped mboxrd');
 });
 done_testing;
diff --git a/t/lei_to_mail.t b/t/lei_to_mail.t
index 626bdab3..75314add 100644
--- a/t/lei_to_mail.t
+++ b/t/lei_to_mail.t
@@ -149,8 +149,8 @@ test_lei(sub {
         is($res->[1], undef, 'only one result');
 });
 
-for my $zsfx (qw(gz bz2 xz)) { # XXX should we support zst, zz, lzo, lzma?
-        my $zsfx2cmd = PublicInbox::LeiToMail->can('zsfx2cmd');
+my $zsfx2cmd = PublicInbox::MboxReader->can('zsfx2cmd');
+for my $zsfx (qw(gz bz2 xz)) {
         SKIP: {
                 my $cmd = eval { $zsfx2cmd->($zsfx, 0, $lei) };
                 skip $@, 3 if $@;