user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 1/2] t/psgi_search: test for subject-free messages
Date: Thu, 30 Jan 2020 09:19:05 +0000	[thread overview]
Message-ID: <20200130091906.23882-2-e@yhbt.net> (raw)
In-Reply-To: <20200130091906.23882-1-e@yhbt.net>

Apparently I fixed this bug a while back in commit
f94c3a195a25a31d0215cd175938008fca473378 but did
not write tests.
---
 t/psgi_search.t | 33 +++++++++++++++++++++++++++++++--
 1 file 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();

  reply	other threads:[~2020-01-30  9:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30  9:19 [PATCH 0/2] subject-free tests and updates Eric Wong
2020-01-30  9:19 ` Eric Wong [this message]
2020-01-30  9:19 ` [PATCH 2/2] mboxgz: ensure gzipped mboxes always have filenames Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130091906.23882-2-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).