X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwatch_maildir.t;h=e65ab9a947a339082e4e15dac4410ef601f5154c;hb=1317fb7b4ace03f6d9dfb1a42ee5f9371a1bf913;hp=7178f29efe029e4815a30d2098790b9a0d07b08a;hpb=82bd094dc2e2da6067fc089e37d538c171732e60;p=public-inbox.git diff --git a/t/watch_maildir.t b/t/watch_maildir.t index 7178f29e..e65ab9a9 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2018 all contributors +# Copyright (C) 2016-2019 all contributors # License: AGPL-3.0+ use Test::More; use File::Temp qw/tempdir/; @@ -35,13 +35,13 @@ 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 $config = PublicInbox::Config->new({ - "$cfgpfx.address" => $addr, - "$cfgpfx.mainrepo" => $git_dir, - "$cfgpfx.watch" => "maildir:$maildir", - "$cfgpfx.filter" => 'PublicInbox::Filter::Vger', - "publicinboxlearn.watchspam" => "maildir:$spamdir", -}); +my $config = PublicInbox::Config->new(\<new($config)->scan('full'); my $git = PublicInbox::Git->new($git_dir); @@ -124,4 +124,13 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); like($$mref, qr/something\n\z/s, 'message scrubbed on import'); } +sub is_maildir { + my ($dir) = @_; + PublicInbox::WatchMaildir::is_maildir($dir); +} + +is(is_maildir('maildir:/hello//world'), '/hello/world', 'extra slash gone'); +is(is_maildir('maildir:/hello/world/'), '/hello/world', 'trailing slash gone'); +is(is_maildir('faildir:/hello/world/'), undef, 'non-maildir rejected'); + done_testing;