about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-04-09 01:59:06 +0000
committerEric Wong <e@80x24.org>2014-04-09 01:59:06 +0000
commit7a42c9451400e20dcc6fbef21f88a68da16aa708 (patch)
tree11295e5802469be3fe277298f232ada21a403c16 /t
parent84030f441bc072d64745d6df49e56e603194fe95 (diff)
downloadpublic-inbox-7a42c9451400e20dcc6fbef21f88a68da16aa708.tar.gz
Using JWZ threading might work decently for this.
Haven't checked in lynx, yet.
Diffstat (limited to 't')
-rw-r--r--t/html_index.t60
1 files changed, 60 insertions, 0 deletions
diff --git a/t/html_index.t b/t/html_index.t
new file mode 100644
index 00000000..80a88997
--- /dev/null
+++ b/t/html_index.t
@@ -0,0 +1,60 @@
+# Copyright (C) 2014, Eric Wong <normalperson@yhbt.net> and all contributors
+# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+use strict;
+use warnings;
+use Test::More;
+use Email::Simple;
+use PublicInbox::Feed;
+use File::Temp qw/tempdir/;
+my $tmpdir = tempdir(CLEANUP => 1);
+my $git_dir = "$tmpdir/gittest";
+
+# setup
+{
+        is(0, system(qw(git init -q --bare), $git_dir), "git init");
+        my $prev = "";
+
+        foreach my $i (1..6) {
+                local $ENV{GIT_DIR} = $git_dir;
+                my $pid = open(my $pipe, "|-");
+                defined $pid or die "fork/pipe failed: $!\n";
+                if ($pid == 0) {
+                        exec("ssoma-mda", $git_dir);
+                }
+                my $mid = "<$i\@example.com>";
+                my $mid_line = "Message-ID: $mid\n";
+                if ($prev) {
+                        $mid_line .= "In-Reply-To: $prev\n";
+                }
+                $prev = $mid;
+                my $simple = Email::Simple->new(<<EOF);
+From: ME <me\@example.com>
+To: U <u\@example.com>
+$mid_line
+Subject: zzz #$i
+Date: Thu, 01 Jan 1970 00:00:00 +0000
+
+> This is a long multi line quote so it should not be allowed to
+> show up in its entirty in the Atom feed.  drop me
+
+msg $i
+
+> inline me here, short quote
+
+keep me
+EOF
+                print $pipe $simple->as_string or die "print failed: $!\n";
+                close $pipe or die "close pipe failed: $!\n";
+        }
+}
+
+# check HTML index
+{
+        my $feed = PublicInbox::Feed->generate_html_index({
+                git_dir => $git_dir,
+                max => 3
+        });
+        like($feed, qr/html/, "feed is valid HTML :)");
+}
+
+done_testing();