diff options
author | Eric Wong <e@80x24.org> | 2015-08-25 02:03:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-25 03:52:54 +0000 |
commit | 73214b02e581ef0a037d85a1ae37ff425654d7b3 (patch) | |
tree | fee5c604b688369e877b1294543701bb2c29b4b4 /t/search.t | |
parent | 42359e39a591dcf68ce02a5fc2dd703ba68f0f77 (diff) | |
download | public-inbox-73214b02e581ef0a037d85a1ae37ff425654d7b3.tar.gz |
We ought to summarize subjects to avoid exploding line lengths in the web interface.
Diffstat (limited to 't/search.t')
-rw-r--r-- | t/search.t | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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 { |