X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Flei_to_mail.t;h=e8958c64c46c73b6ae38feeef8718c2b7bd9e2f3;hb=refs%2Fheads%2Fmaster;hp=35904706ddfe6864f78782bbbf20e87d018d8186;hpb=2d4ac1c886908bb1d79592913a2a2037a1a024e7;p=public-inbox.git diff --git a/t/lei_to_mail.t b/t/lei_to_mail.t index 35904706..d692751c 100644 --- a/t/lei_to_mail.t +++ b/t/lei_to_mail.t @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ use strict; use v5.10.1; @@ -75,7 +75,7 @@ for my $mbox (@MBOX) { my ($tmpdir, $for_destroy) = tmpdir(); local $ENV{TMPDIR} = $tmpdir; open my $err, '>>', "$tmpdir/lei.err" or BAIL_OUT $!; -my $lei = bless { 2 => $err }, 'PublicInbox::LEI'; +my $lei = bless { 2 => $err, cmd => 'test' }, 'PublicInbox::LEI'; my $commit = sub { $_[0] = undef; # wcb delete $lei->{1}; @@ -260,7 +260,7 @@ SKIP: { # FIFO support my @f; $mdr->maildir_each_file($md, sub { push @f, shift }); - open my $fh, $f[0] or BAIL_OUT $!; + open my $fh, '<', $f[0] or BAIL_OUT $!; is(do { local $/; <$fh> }, $buf, 'wrote to Maildir'); $wcb = $wcb_get->('maildir', $md); @@ -271,7 +271,7 @@ SKIP: { # FIFO support $mdr->maildir_each_file($md, sub { push @x, shift }); is(scalar(@x), 1, 'wrote one new file'); ok(!-f $f[0], 'old file clobbered'); - open $fh, $x[0] or BAIL_OUT $!; + open $fh, '<', $x[0] or BAIL_OUT $!; is(do { local $/; <$fh> }, $buf."\nx\n", 'wrote new file to Maildir'); local $lei->{opt}->{augment} = 1; @@ -283,9 +283,9 @@ SKIP: { # FIFO support is(scalar grep(/\A\Q$x[0]\E\z/, @f), 1, 'old file still there'); my @new = grep(!/\A\Q$x[0]\E\z/, @f); is(scalar @new, 1, '1 new file written (b4dc0ffee skipped)'); - open $fh, $x[0] or BAIL_OUT $!; + open $fh, '<', $x[0] or BAIL_OUT $!; is(do { local $/; <$fh> }, $buf."\nx\n", 'old file untouched'); - open $fh, $new[0] or BAIL_OUT $!; + open $fh, '<', $new[0] or BAIL_OUT $!; is(do { local $/; <$fh> }, $buf."\ny\n", 'new file written'); }