]> Sergey Matveev's repositories - public-inbox.git/blob - t/filter_base.t
www: drop --subject from "git send-email" instructions
[public-inbox.git] / t / filter_base.t
1 # Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 use strict;
4 use warnings;
5 use Test::More;
6 use PublicInbox::TestCommon;
7 use_ok 'PublicInbox::Filter::Base';
8
9 {
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');
14 }
15
16 {
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');
20 }
21
22 {
23         my $f = PublicInbox::Filter::Base->new;
24         my $email = eml_load 't/filter_base-xhtml.eml';
25         is($f->delivery($email), 100, "xhtml rejected");
26 }
27
28 {
29         my $f = PublicInbox::Filter::Base->new;
30         my $email = eml_load 't/filter_base-junk.eml';
31         is($f->delivery($email), 100, 'proprietary format rejected on glob');
32 }
33
34 done_testing();