about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-01-30 09:19:05 +0000
committerEric Wong <e@yhbt.net>2020-01-31 23:00:06 +0000
commit3dff4a5399f10cbcb3d902da094680705c50193a (patch)
treecaa863e507cadb1dd93e7387d1b3cb563a2ad24c
parent8122bd3803b7520ab5421df264406e670e3f902b (diff)
downloadpublic-inbox-3dff4a5399f10cbcb3d902da094680705c50193a.tar.gz
Apparently I fixed this bug a while back in commit
f94c3a195a25a31d0215cd175938008fca473378 but did
not write tests.
-rw-r--r--t/psgi_search.t33
1 files changed, 31 insertions, 2 deletions
diff --git a/t/psgi_search.t b/t/psgi_search.t
index 5310e5ab..56b42118 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -27,16 +27,32 @@ my $im = $ibx->importer(0);
 my $digits = '10010260936330';
 my $ua = 'Pine.LNX.4.10';
 my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com";
-my $data = <<"EOF";
+my $mime = PublicInbox::MIME->new(<<EOF);
 Subject: test
 Message-ID: <$mid>
 From: Ævar Arnfjörð Bjarmason <avarab\@example>
 To: git\@vger.kernel.org
 
 EOF
+$im->add($mime);
+
+$mime = PublicInbox::MIME->new(<<'EOF');
+Subject:
+Message-ID: <blank-subject@example.com>
+From: blank subject <blank-subject@example.com>
+To: git@vger.kernel.org
+
+EOF
+$im->add($mime);
 
-my $mime = Email::MIME->new(\$data);
+$mime = PublicInbox::MIME->new(<<'EOF');
+Message-ID: <no-subject-at-all@example.com>
+From: no subject at all <no-subject-at-all@example.com>
+To: git@vger.kernel.org
+
+EOF
 $im->add($mime);
+
 $im->done;
 PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
 
@@ -78,6 +94,19 @@ test_psgi(sub { $www->call(@_) }, sub {
                 like($res->content, $mid_re, 'found mid in response');
                 chop($digits);
         }
+
+        $res = $cb->(GET('/test/'));
+        $html = $res->content;
+        like($html, qr/\bhref="no-subject-at-all[^>]+>\(no subject\)</,
+                'subject-less message linked from "/$INBOX/"');
+        like($html, qr/\bhref="blank-subject[^>]+>\(no subject\)</,
+                'blank subject message linked from "/$INBOX/"');
+
+        $res = $cb->(GET('/test/?q=tc:git'));
+        like($html, qr/\bhref="no-subject-at-all[^>]+>\(no subject\)</,
+                'subject-less message linked from "/$INBOX/?q=..."');
+        like($html, qr/\bhref="blank-subject[^>]+>\(no subject\)</,
+                'blank subject message linked from "/$INBOX/?q=..."');
 });
 
 done_testing();