about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-08-31 04:41:32 +0000
committerEric Wong <e@80x24.org>2020-09-01 00:19:03 +0000
commitcee907599bb7eda0695ae91cf8d633670a88d6c7 (patch)
treee7e4a0b0f8ce6f0b13d81bda3dde7b887ece7933 /t
parent47b7047874ed7d6f39b9758134f112cdc46489cf (diff)
downloadpublic-inbox-cee907599bb7eda0695ae91cf8d633670a88d6c7.tar.gz
rename WatchMaildir => Watch
This is no longer limited to Maildirs now that IMAP and NNTP
support exist; so give it a shorter name.
Diffstat (limited to 't')
-rw-r--r--t/imapd.t2
-rw-r--r--t/nntpd.t2
-rw-r--r--t/watch_filter_rubylang.t4
-rw-r--r--t/watch_imap.t4
-rw-r--r--t/watch_maildir.t18
-rw-r--r--t/watch_maildir_v2.t22
-rw-r--r--t/watch_multiple_headers.t4
-rw-r--r--t/watch_nntp.t4
8 files changed, 30 insertions, 30 deletions
diff --git a/t/imapd.t b/t/imapd.t
index 8db72bd7..f743bf06 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -449,7 +449,7 @@ ok($mic->logout, 'logged out');
 }
 
 SKIP: {
-        use_ok 'PublicInbox::WatchMaildir';
+        use_ok 'PublicInbox::Watch';
         use_ok 'PublicInbox::InboxIdle';
         require_git('1.8.5', 1) or
                 skip('git 1.8.5+ needed for --urlmatch', 4);
diff --git a/t/nntpd.t b/t/nntpd.t
index 74e21a41..d8a44334 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -396,7 +396,7 @@ sub read_til_dot {
 
 sub test_watch {
         my ($tmpdir, $sock, $group) = @_;
-        use_ok 'PublicInbox::WatchMaildir';
+        use_ok 'PublicInbox::Watch';
         use_ok 'PublicInbox::InboxIdle';
         use_ok 'PublicInbox::Config';
         require_git('1.8.5', 1) or skip('git 1.8.5+ needed for --urlmatch', 4);
diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index db48cb2f..4b72dbae 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -7,7 +7,7 @@ use Test::More;
 use PublicInbox::Eml;
 use PublicInbox::Config;
 require_mods(qw(DBD::SQLite Search::Xapian));
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{PI_CONFIG} = "$tmpdir/pi_config";
@@ -76,7 +76,7 @@ EOF
         my $ibx = $config->lookup_name($v);
         ok($ibx, 'found inbox by name');
 
-        my $w = PublicInbox::WatchMaildir->new($config);
+        my $w = PublicInbox::Watch->new($config);
         for my $i (1..2) {
                 $w->scan('full');
         }
diff --git a/t/watch_imap.t b/t/watch_imap.t
index 9433bb6f..fb71d3df 100644
--- a/t/watch_imap.t
+++ b/t/watch_imap.t
@@ -5,14 +5,14 @@ use Test::More;
 use PublicInbox::Config;
 # see t/imapd*.t for tests against a live IMAP server
 
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 my $cfg = PublicInbox::Config->new(\<<EOF);
 publicinbox.i.address=i\@example.com
 publicinbox.i.inboxdir=/nonexistent
 publicinbox.i.watch=imap://example.com/INBOX.a
 publicinboxlearn.watchspam=imap://example.com/INBOX.spam
 EOF
-my $watch = PublicInbox::WatchMaildir->new($cfg);
+my $watch = PublicInbox::Watch->new($cfg);
 is($watch->{imap}->{'imap://example.com/INBOX.a'}->[0]->{name}, 'i',
         'watched an inbox');
 is($watch->{imap}->{'imap://example.com/INBOX.spam'}, 'watchspam',
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');
diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t
index 59ec247e..ca1cf965 100644
--- a/t/watch_maildir_v2.t
+++ b/t/watch_maildir_v2.t
@@ -14,7 +14,7 @@ my ($tmpdir, $for_destroy) = tmpdir();
 my $inboxdir = "$tmpdir/v2";
 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';
@@ -49,7 +49,7 @@ my $ibx = $config->lookup_name('test');
 ok($ibx, 'found inbox by name');
 my $srch = $ibx->search;
 
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 my $total = scalar @{$srch->reopen->query('')};
 is($total, 1, 'got one revision');
 
@@ -69,7 +69,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');
 is_deeply($srch->reopen->query(''), [], 'deleted file');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
@@ -80,7 +80,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');
         my $msgs = $srch->reopen->query('');
         is(scalar(@$msgs), 1, 'got one file back');
         my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -88,7 +88,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');
         $msgs = $srch->reopen->query('');
         is(scalar(@$msgs), 0, 'inbox is empty again');
         is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
@@ -103,7 +103,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');
         }
         my $msgs = $srch->reopen->query('');
         is(scalar(@$msgs), 0, 'inbox is still empty');
@@ -117,7 +117,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         local $ENV{PATH} = $main_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
         $config->{'publicinboxwatch.spamcheck'} = 'spamc';
-        PublicInbox::WatchMaildir->new($config)->scan('full');
+        PublicInbox::Watch->new($config)->scan('full');
         my $msgs = $srch->reopen->query('');
         is(scalar(@$msgs), 1, 'inbox has one mail after spamc OK-ed a message');
         my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -130,7 +130,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         open my $fh, '<', $patch or die "failed to open $patch: $!\n";
         $msg = do { local $/; <$fh> };
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::WatchMaildir->new($config)->scan('full');
+        PublicInbox::Watch->new($config)->scan('full');
         my $msgs = $srch->reopen->query('dfpost:6e006fd7');
         is(scalar(@$msgs), 1, 'diff postimage found');
         my $post = $msgs->[0];
@@ -161,7 +161,7 @@ Date: Sat, 18 Jun 2016 00:00:00 +0000
 both
 EOF
         PublicInbox::Emergency->new($maildir)->prepare(\$both);
-        PublicInbox::WatchMaildir->new($config)->scan('full');
+        PublicInbox::Watch->new($config)->scan('full');
         my $msgs = $srch->reopen->query('m:both@b.com');
         my $v1 = $config->lookup_name('v1');
         my $msg = $v1->git->cat_file($msgs->[0]->{blob});
@@ -186,7 +186,7 @@ EOF
         PublicInbox::Emergency->new($maildir)->prepare(\$want);
         PublicInbox::Emergency->new($maildir)->prepare(\$do_not_want);
         my $config = PublicInbox::Config->new(\$cfg);
-        PublicInbox::WatchMaildir->new($config)->scan('full');
+        PublicInbox::Watch->new($config)->scan('full');
         $ibx = $config->lookup_name('test');
         my $num = $ibx->mm->num_for('do.want@example.com');
         ok(defined $num, 'List-ID matched for watch');
@@ -195,7 +195,7 @@ EOF
 
         $cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
         $config = PublicInbox::Config->new(\$cfg);
-        PublicInbox::WatchMaildir->new($config)->scan('full');
+        PublicInbox::Watch->new($config)->scan('full');
         $ibx = $config->lookup_name('test');
         $num = $ibx->mm->num_for('do.not.want@example.com');
         ok(defined $num, 'X-Mailing-List matched');
diff --git a/t/watch_multiple_headers.t b/t/watch_multiple_headers.t
index 0ee96d5f..a0813532 100644
--- a/t/watch_multiple_headers.t
+++ b/t/watch_multiple_headers.t
@@ -9,7 +9,7 @@ require_mods(qw(Search::Xapian DBD::SQLite));
 my ($tmpdir, $for_destroy) = tmpdir();
 my $inboxdir = "$tmpdir/v2";
 my $maildir = "$tmpdir/md";
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
@@ -62,7 +62,7 @@ $cfgpfx.watchheader=To:$addr
 $cfgpfx.watchheader=Cc:$addr
 EOF
 my $config = PublicInbox::Config->new(\$cfg);
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 my $ibx = $config->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
diff --git a/t/watch_nntp.t b/t/watch_nntp.t
index 98fb1161..ce1a3153 100644
--- a/t/watch_nntp.t
+++ b/t/watch_nntp.t
@@ -5,8 +5,8 @@ use Test::More;
 use PublicInbox::Config;
 # see t/nntpd*.t for tests against a live NNTP server
 
-use_ok 'PublicInbox::WatchMaildir';
-my $nntp_url = \&PublicInbox::WatchMaildir::nntp_url;
+use_ok 'PublicInbox::Watch';
+my $nntp_url = \&PublicInbox::Watch::nntp_url;
 is('news://example.com/inbox.foo',
         $nntp_url->('NEWS://examplE.com/inbox.foo'), 'lowercased');
 is('nntps://example.com/inbox.foo',