user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
6b34774d79da7f6158ff177308ed26078ee1d86c blob 1543 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
#!perl -w
# Copyright all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict; use v5.10.1; use PublicInbox::TestCommon;
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
test_lei(sub {
	my ($ro_home, $cfg_path) = setup_public_inboxes;
	my $s = eml_load('t/plack-qp.eml')->as_string;
	lei_ok [qw(import -q -F eml -)], undef, { 0 => \$s, %$lei_opt };
	lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/a.mbox.gz";
	lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/b.mbox.gz";
	lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/a";
	lei_ok qw(q z:0.. -f mboxcl2 -o), "$ENV{HOME}/b";
	lei_ok qw(ls-search);
	$s = eml_load('t/utf8.eml')->as_string;
	lei_ok [qw(import -q -F eml -)], undef, { 0 => \$s, %$lei_opt };
	lei_ok qw(up --all=local);
	open my $fh, "$ENV{HOME}/a.mbox.gz" or xbail "open: $!";
	my $gz = do { local $/; <$fh> };
	my $uc;
	gunzip(\$gz => \$uc, MultiStream => 1) or xbail "gunzip $GunzipError";
	open $fh, "$ENV{HOME}/a" or xbail "open: $!";

	my $exp = do { local $/; <$fh> };
	is($uc, $exp, 'compressed and uncompressed match (a.gz)');
	like($exp, qr/testmessage\@example.com/, '2nd message added');
	open $fh, "$ENV{HOME}/b.mbox.gz" or xbail "open: $!";

	$gz = do { local $/; <$fh> };
	undef $uc;
	gunzip(\$gz => \$uc, MultiStream => 1) or xbail "gunzip $GunzipError";
	is($uc, $exp, 'compressed and uncompressed match (b.gz)');

	open $fh, "$ENV{HOME}/b" or xbail "open: $!";
	$uc = do { local $/; <$fh> };
	is($uc, $exp, 'uncompressed both match');
});

done_testing;
debug log:

solving 6b34774d ...
found 6b34774d in https://80x24.org/public-inbox.git

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).