about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-27 10:03:32 +0000
committerEric Wong <e@yhbt.net>2020-06-28 22:27:11 +0000
commitf115168f63c05832d69756723fe9197b03303048 (patch)
treec9356ec072da9ef1f9b96bdf87f1c556ffa4add7 /t
parente06c008ec1d456d97eb8c52fab8e9a8f924bbdd7 (diff)
downloadpublic-inbox-f115168f63c05832d69756723fe9197b03303048.tar.gz
The old check was ineffective since we process the spam folder
config before ham inboxes; and would only fail when attempting
to treat the scalar "watchspam" string as an array ref.
Diffstat (limited to 't')
-rw-r--r--t/watch_maildir.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
index 66955072..33a3458b 100644
--- a/t/watch_maildir.t
+++ b/t/watch_maildir.t
@@ -32,6 +32,21 @@ ok(POSIX::mkfifo("$maildir/cur/fifo", 0777),
         'create FIFO to ensure we do not get stuck on it :P');
 my $sem = PublicInbox::Emergency->new($spamdir); # create dirs
 
+{
+        my @w;
+        local $SIG{__WARN__} = sub { push @w, @_ };
+        my $config = PublicInbox::Config->new(\<<EOF);
+$cfgpfx.address=$addr
+$cfgpfx.inboxdir=$git_dir
+$cfgpfx.watch=maildir:$spamdir
+publicinboxlearn.watchspam=maildir:$spamdir
+EOF
+        my $wm = PublicInbox::WatchMaildir->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');
+}
+
 my $config = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$git_dir