From 40782735e74e427997b5b900d60cc07597e330c3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Jun 2016 01:15:16 +0000 Subject: watch_maildir: implement optional spam checking Mailing lists I watch and mirror may not have the best spam filtering, and an extra layer should not hurt. --- t/import.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 't/import.t') diff --git a/t/import.t b/t/import.t index 09c00362..73f92adb 100644 --- a/t/import.t +++ b/t/import.t @@ -30,7 +30,7 @@ is(scalar @revs, 1, 'one revision created'); $mime->header_set('Message-ID', ''); $mime->header_set('Subject', 'msg2'); -like($im->add($mime), qr/\A:\d+\z/, 'added 2nd message'); +like($im->add($mime, sub { $mime }), qr/\A:\d+\z/, 'added 2nd message'); $im->done; @revs = $git->qx(qw(rev-list HEAD)); is(scalar @revs, 2, '2 revisions exist'); @@ -61,5 +61,9 @@ is($mark, 'MISMATCH', 'mark == MISMATCH on mismatch'); is($msg->header('Message-ID'), '', 'Message-ID matches'); isnt($msg->header('Subject'), $mime->header('Subject'), 'subject mismatch'); +$mime->header_set('Message-Id', ''); +is($im->add($mime, sub { undef }), undef, 'check callback fails'); +is($im->remove($mime), undef, 'message not added, so not removed'); + $im->done; done_testing(); -- cgit v1.2.3-24-ge0c7