X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwatch_maildir.t;h=e6cd599cafb949a7b155f5b26bb424bb00a2bae3;hb=3c39f9c942a6975245fda878e9b957d8d3367662;hp=7178f29efe029e4815a30d2098790b9a0d07b08a;hpb=82bd094dc2e2da6067fc089e37d538c171732e60;p=public-inbox.git diff --git a/t/watch_maildir.t b/t/watch_maildir.t index 7178f29e..e6cd599c 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;