X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwatch_maildir_v2.t;h=b2514c16ad4827bba720532070e9ee8fdc721b1e;hb=d7fda3f4b9d4c9e6d01c818f09905d6827fa693f;hp=7fe235211a98f46602e72ea6b4be4e64889e2cb3;hpb=4a24d9537f5c73ea8b1b93a4b131926db38435d8;p=public-inbox.git
diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t
index 7fe23521..b2514c16 100644
--- a/t/watch_maildir_v2.t
+++ b/t/watch_maildir_v2.t
@@ -1,19 +1,15 @@
-# Copyright (C) 2018-2019 all contributors
+# Copyright (C) 2018-2020 all contributors
# License: AGPL-3.0+
+use strict;
use Test::More;
-use File::Temp qw/tempdir/;
use PublicInbox::MIME;
use Cwd;
use PublicInbox::Config;
-require './t/common.perl';
+use PublicInbox::TestCommon;
require_git(2.6);
-my @mods = qw(Search::Xapian DBD::SQLite Filesys::Notify::Simple);
-foreach my $mod (@mods) {
- eval "require $mod";
- plan skip_all => "$mod missing for watch_maildir_v2.t" if $@;
-}
+require_mods(qw(Search::Xapian DBD::SQLite Filesys::Notify::Simple));
require PublicInbox::V2Writable;
-my $tmpdir = tempdir('watch_maildir-v2-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($tmpdir, $for_destroy) = tmpdir();
my $inboxdir = "$tmpdir/v2";
my $maildir = "$tmpdir/md";
my $spamdir = "$tmpdir/spam";
@@ -106,7 +102,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n);
local $SIG{__WARN__} = sub {}; # quiet spam check warning
PublicInbox::WatchMaildir->new($config)->scan('full');
}
- ($nr, $msgs) = $srch->reopen->query('');
+ my ($nr, $msgs) = $srch->reopen->query('');
is($nr, 0, 'inbox is still empty');
is(unlink(glob("$maildir/new/*")), 1);
}
@@ -119,7 +115,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n);
PublicInbox::Emergency->new($maildir)->prepare(\$msg);
$config->{'publicinboxwatch.spamcheck'} = 'spamc';
PublicInbox::WatchMaildir->new($config)->scan('full');
- ($nr, $msgs) = $srch->reopen->query('');
+ my ($nr, $msgs) = $srch->reopen->query('');
is($nr, 1, 'inbox has one mail after spamc OK-ed a message');
my $mref = $ibx->msg_by_smsg($msgs->[0]);
like($$mref, qr/something\n\z/s, 'message scrubbed on import');
@@ -132,7 +128,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n);
$msg = eval { local $/; <$fh> };
PublicInbox::Emergency->new($maildir)->prepare(\$msg);
PublicInbox::WatchMaildir->new($config)->scan('full');
- ($nr, $msgs) = $srch->reopen->query('dfpost:6e006fd7');
+ my ($nr, $msgs) = $srch->reopen->query('dfpost:6e006fd7');
is($nr, 1, 'diff postimage found');
my $post = $msgs->[0];
($nr, $msgs) = $srch->query('dfpre:090d998b6c2c');