]> Sergey Matveev's repositories - public-inbox.git/blob - t/html_index.t
treewide: run update-copyrights from gnulib for 2019
[public-inbox.git] / t / html_index.t
1 # Copyright (C) 2014-2020 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 Email::MIME;
7 use PublicInbox::Feed;
8 use PublicInbox::Git;
9 use PublicInbox::Import;
10 use PublicInbox::Inbox;
11 use PublicInbox::TestCommon;
12 my ($tmpdir, $for_destroy) = tmpdir();
13 my $git_dir = "$tmpdir/gittest";
14 my $ibx = PublicInbox::Inbox->new({
15         address => 'test@example',
16         name => 'tester',
17         inboxdir => $git_dir,
18         url => 'http://example.com/test',
19 });
20 my $git = $ibx->git;
21 my $im = PublicInbox::Import->new($git, 'tester', 'test@example');
22
23 # setup
24 {
25         is(0, system(qw(git init -q --bare), $git_dir), "git init");
26         my $prev = "";
27
28         foreach my $i (1..6) {
29                 my $mid = "<$i\@example.com>";
30                 my $mid_line = "Message-ID: $mid";
31                 if ($prev) {
32                         $mid_line .= "In-Reply-To: $prev";
33                 }
34                 $prev = $mid;
35                 my $mime = Email::MIME->new(<<EOF);
36 From: ME <me\@example.com>
37 To: U <u\@example.com>
38 $mid_line
39 Subject: zzz #$i
40 Date: Thu, 01 Jan 1970 00:00:00 +0000
41
42 > This is a long multi line quote so it should not be allowed to
43 > show up in its entirty in the Atom feed.  drop me
44
45 msg $i
46
47 > inline me here, short quote
48
49 keep me
50 EOF
51                 like($im->add($mime), qr/\A:\d+\z/, 'inserted message');
52         }
53         $im->done;
54 }
55
56 done_testing();