From a89d459a1e21181fdf185ee6b3b55a6afcc87b44 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Jan 2019 02:33:05 +0000 Subject: watchmaildir: normalize Maildir pathnames consistently Remove redundant slashes while we're at it. --- t/watch_maildir.t | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/watch_maildir.t b/t/watch_maildir.t index 7178f29e..b85ddc58 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -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; -- cgit v1.2.3-24-ge0c7