user/dev discussion of public-inbox itself
 help / color / 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
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 index

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: http://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

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git