1 # Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
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 $html_body = "<html><body>hi</body></html>";
28 content_type => 'text/xhtml; charset=UTF-8',
35 content_type => 'text/plain',
36 encoding => 'quoted-printable',
41 my $email = Email::MIME->create(
43 From => 'a@example.com',
45 'Content-Type' => 'multipart/alternative'
49 is($f->delivery($email), 100, "xhtml rejected");
53 my $f = PublicInbox::Filter::Base->new;
57 content_type => 'application/vnd.ms-excel',
64 content_type => 'text/plain',
65 encoding => 'quoted-printable',
70 my $email = Email::MIME->create(
72 From => 'a@example.com',
74 'Content-Type' => 'multipart/mixed'
78 is($f->delivery($email), 100, 'proprietary format rejected on glob');