X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=t%2Fwatch_maildir.t;h=ae53caf92f11ca26f4fd7baa3ed9f29fa07186f0;hp=c44273f051902afe94694832ca4f6a5f3652c3bc;hb=cee907599bb7eda0695ae91cf8d633670a88d6c7;hpb=47b7047874ed7d6f39b9758134f112cdc46489cf diff --git a/t/watch_maildir.t b/t/watch_maildir.t index c44273f0..ae53caf9 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -11,7 +11,7 @@ my ($tmpdir, $for_destroy) = tmpdir(); my $git_dir = "$tmpdir/test.git"; my $maildir = "$tmpdir/md"; my $spamdir = "$tmpdir/spam"; -use_ok 'PublicInbox::WatchMaildir'; +use_ok 'PublicInbox::Watch'; use_ok 'PublicInbox::Emergency'; my $cfgpfx = "publicinbox.test"; my $addr = 'test-public@example.com'; @@ -40,7 +40,7 @@ $cfgpfx.inboxdir=$git_dir $cfgpfx.watch=maildir:$spamdir publicinboxlearn.watchspam=maildir:$spamdir EOF - my $wm = PublicInbox::WatchMaildir->new($config); + my $wm = PublicInbox::Watch->new($config); is(scalar grep(/is a spam folder/, @w), 1, 'got warning about spam'); is_deeply($wm->{mdmap}, { "$spamdir/cur" => 'watchspam' }, 'only got the spam folder to watch'); @@ -62,7 +62,7 @@ EOF } my $config = PublicInbox::Config->new($cfg_path); -PublicInbox::WatchMaildir->new($config)->scan('full'); +PublicInbox::Watch->new($config)->scan('full'); my $git = PublicInbox::Git->new($git_dir); my @list = $git->qx(qw(rev-list refs/heads/master)); is(scalar @list, 1, 'one revision in rev-list'); @@ -79,7 +79,7 @@ my $write_spam = sub { }; $write_spam->(); is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam'); -PublicInbox::WatchMaildir->new($config)->scan('full'); +PublicInbox::Watch->new($config)->scan('full'); @list = $git->qx(qw(rev-list refs/heads/master)); is(scalar @list, 2, 'two revisions in rev-list'); @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); @@ -93,7 +93,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo\@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html\n); PublicInbox::Emergency->new($maildir)->prepare(\$msg); - PublicInbox::WatchMaildir->new($config)->scan('full'); + PublicInbox::Watch->new($config)->scan('full'); @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); is(scalar @list, 1, 'tree has one file'); my $mref = $git->cat_file('HEAD:'.$list[0]); @@ -101,7 +101,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam'); $write_spam->(); - PublicInbox::WatchMaildir->new($config)->scan('full'); + PublicInbox::Watch->new($config)->scan('full'); @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); is(scalar @list, 0, 'tree is empty'); @list = $git->qx(qw(rev-list refs/heads/master)); @@ -118,7 +118,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); $config->{'publicinboxwatch.spamcheck'} = 'spamc'; { local $SIG{__WARN__} = sub {}; # quiet spam check warning - PublicInbox::WatchMaildir->new($config)->scan('full'); + PublicInbox::Watch->new($config)->scan('full'); } @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); is(scalar @list, 0, 'tree has no files spamc checked'); @@ -133,7 +133,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); PublicInbox::Emergency->new($maildir)->prepare(\$msg); $config->{'publicinboxwatch.spamcheck'} = 'spamc'; @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); - PublicInbox::WatchMaildir->new($config)->scan('full'); + PublicInbox::Watch->new($config)->scan('full'); @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); is(scalar @list, 1, 'tree has one file after spamc checked'); @@ -211,7 +211,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); sub is_maildir { my ($dir) = @_; - PublicInbox::WatchMaildir::is_maildir($dir); + PublicInbox::Watch::is_maildir($dir); } is(is_maildir('maildir:/hello//world'), '/hello/world', 'extra slash gone');