]> Sergey Matveev's repositories - public-inbox.git/blob - t/filter_vger.t
No ext_urls
[public-inbox.git] / t / filter_vger.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::Eml;
7 use_ok 'PublicInbox::Filter::Vger';
8
9 my $f = PublicInbox::Filter::Vger->new;
10 ok($f, 'created PublicInbox::Filter::Vger object');
11 {
12         my $lkml = <<'EOF';
13 From: foo@example.com
14 Subject: test
15
16 keep this
17 --
18 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
19 the body of a message to majordomo@vger.kernel.org
20 More majordomo info at  http://vger.kernel.org/majordomo-info.html
21 Please read the FAQ at  http://www.tux.org/lkml/
22 EOF
23
24         my $mime = PublicInbox::Eml->new($lkml);
25         $mime = $f->delivery($mime);
26         is("keep this\n", $mime->body, 'normal message filtered OK');
27 }
28
29 {
30         my $no_nl = <<'EOF';
31 From: foo@example.com
32 Subject: test
33
34 OSX users :P--
35 To unsubscribe from this list: send the line "unsubscribe git" in
36 the body of a message to majordomo@vger.kernel.org
37 More majordomo info at  http://vger.kernel.org/majordomo-info.html
38 EOF
39
40         my $mime = PublicInbox::Eml->new($no_nl);
41         $mime = $f->delivery($mime);
42         is('OSX users :P', $mime->body, 'missing trailing LF in original OK');
43 }
44
45
46 done_testing();