about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-08-25 02:03:16 +0000
committerEric Wong <e@80x24.org>2015-08-25 03:52:54 +0000
commit73214b02e581ef0a037d85a1ae37ff425654d7b3 (patch)
treefee5c604b688369e877b1294543701bb2c29b4b4 /t
parent42359e39a591dcf68ce02a5fc2dd703ba68f0f77 (diff)
downloadpublic-inbox-73214b02e581ef0a037d85a1ae37ff425654d7b3.tar.gz
We ought to summarize subjects to avoid exploding
line lengths in the web interface.
Diffstat (limited to 't')
-rw-r--r--t/search.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/search.t b/t/search.t
index 17e9eaf4..65539f14 100644
--- a/t/search.t
+++ b/t/search.t
@@ -16,6 +16,23 @@ is(0, system(qw(git init -q --bare), $git_dir), "git init (main)");
 eval { PublicInbox::Search->new($git_dir) };
 ok($@, "exception raised on non-existent DB");
 
+{
+        my $orig = "FOO " x 30;
+        my $summ = PublicInbox::Search::subject_summary($orig);
+
+        $summ = length($summ);
+        $orig = length($orig);
+        ok($summ < $orig && $summ > 0, "summary shortened ($orig => $summ)");
+
+        $orig = "FOO" x 30;
+        $summ = PublicInbox::Search::subject_summary($orig);
+
+        $summ = length($summ);
+        $orig = length($orig);
+        ok($summ < $orig && $summ > 0,
+           "summary shortened but not empty: $summ");
+}
+
 my $rw = PublicInbox::SearchIdx->new($git_dir, 1);
 my $ro = PublicInbox::Search->new($git_dir);
 my $rw_commit = sub {