From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 095D01F9FD; Wed, 17 Feb 2021 10:53:34 +0000 (UTC) Date: Wed, 17 Feb 2021 10:53:33 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: [PATCH 08/11] lei convert: mail format conversion sub-command Message-ID: <20210217105333.GA22613@dcvr> References: <20210217100707.6796-1-e@80x24.org> <20210217100707.6796-9-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210217100707.6796-9-e@80x24.org> List-Id: Eric Wong wrote: > +++ b/t/lei-convert.t > +test_lei({ tmpdir => $tmpdir }, sub { > + my $dig = Digest::SHA->new(256); > + lei_ok('convert', '-o', "mboxrd:$tmpdir/foo.mboxrd", > + "imap://$host_port/t.v2.0"); > + ok(-f "$tmpdir/foo.mboxrd", 'mboxrd created'); > + $dig->addfile("$tmpdir/foo.mboxrd"); > + my $foo = $dig->digest; > + lei_ok('convert', '-o', "$tmpdir/md", "mboxrd:$tmpdir/foo.mboxrd"); > + ok(-d "$tmpdir/md", 'Maildir created'); > + lei_ok('convert', '-o', "mboxrd:$tmpdir/bar.mboxrd", "$tmpdir/md"); > + $dig->addfile("$tmpdir/bar.mboxrd"); > + my $bar = $dig->digest; > + is($foo, $bar, 'mboxrd round-tripped through Maildir'); Oh dear, I've truly lost my mind :< readdir order is totally random and by some dumb luck this worked when I tested it. > + open my $in, '<', "$tmpdir/bar.mboxrd" or BAIL_OUT; > + my $rdr = { 0 => $in, 1 => \(my $out), 2 => \$lei_err }; > + lei_ok([qw(convert --stdin -F mboxrd -o mboxrd:/dev/stdout)], > + undef, $rdr); > + $dig->add($out); > + is($foo, $dig->digest, 'mboxrd round-tripped --stdin => stdout');