public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob 83a4c9ee30ba47536bf2bde059bb600a5809fa9c 1193 bytes (raw)
name: t/filter_vger.t 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
# Copyright (C) 2016 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
use Test::More;
use Email::MIME;
use_ok 'PublicInbox::Filter::Vger';

my $f = PublicInbox::Filter::Vger->new;
ok($f, 'created PublicInbox::Filter::Vger object');
{
	my $lkml = <<'EOF';
From: foo@example.com
Subject: test

keep this
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
EOF

	my $mime = Email::MIME->new($lkml);
	$mime = $f->delivery($mime);
	is("keep this\n", $mime->body, 'normal message filtered OK');
}

{
	my $no_nl = <<'EOF';
From: foo@example.com
Subject: test

OSX users :P--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
EOF

	my $mime = Email::MIME->new($no_nl);
	$mime = $f->delivery($mime);
	is('OSX users :P', $mime->body, 'missing trailing LF in original OK');
}


done_testing();

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git