1 # Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use PublicInbox::TestCommon;
7 use_ok 'PublicInbox::Filter::Base';
10 my $f = PublicInbox::Filter::Base->new;
11 ok($f, 'created stock object');
12 ok(defined $f->{reject_suffix}, 'rejected suffix redefined');
13 is(ref($f->{reject_suffix}), 'Regexp', 'reject_suffix should be a RE');
17 my $f = PublicInbox::Filter::Base->new(reject_suffix => undef);
18 ok($f, 'created base object q/o reject_suffix');
19 ok(!defined $f->{reject_suffix}, 'reject_suffix not defined');
23 my $f = PublicInbox::Filter::Base->new;
24 my $email = mime_load 't/filter_base-xhtml.eml', sub {
25 my $html_body = "<html><body>hi</body></html>";
29 content_type => 'text/xhtml; charset=UTF-8',
36 content_type => 'text/plain',
37 encoding => 'quoted-printable',
44 From => 'a@example.com',
46 'Content-Type' => 'multipart/alternative'
50 is($f->delivery($email), 100, "xhtml rejected");
54 my $f = PublicInbox::Filter::Base->new;
55 my $email = mime_load 't/filter_base-junk.eml', sub {
59 content_type => 'application/vnd.ms-excel',
66 content_type => 'text/plain',
67 encoding => 'quoted-printable',
74 From => 'a@example.com',
76 'Content-Type' => 'multipart/mixed'
80 is($f->delivery($email), 100, 'proprietary format rejected on glob');