user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] search: remove lookup_article
Date: Sun,  5 Jan 2020 02:05:15 +0000
Message-ID: <20200105020515.11935-1-e@80x24.org> (raw)

It was no longer used outside of tests, so don't penalize
regular users with the extra function.  Just inline it for
t/search.t.
---
 lib/PublicInbox/Search.pm |  5 -----
 t/search.t                | 12 ++++++++----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index f897b833..aff3d48b 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -336,11 +336,6 @@ EOF
 	$self->{query_parser} = $qp;
 }
 
-sub lookup_article {
-	my ($self, $num) = @_;
-	$self->{over_ro}->get_art($num);
-}
-
 sub help {
 	my ($self) = @_;
 	$self->qp; # parse altids
diff --git a/t/search.t b/t/search.t
index b9aa995b..240139b0 100644
--- a/t/search.t
+++ b/t/search.t
@@ -319,14 +319,14 @@ $ibx->with_umask(sub {
 	my $mset = $ro->query('t:list@example.com', {mset => 1});
 	is($mset->size, 6, 'searched To: successfully');
 	foreach my $m ($mset->items) {
-		my $smsg = $ro->lookup_article($m->get_docid);
+		my $smsg = $ro->{over_ro}->get_art($m->get_docid);
 		like($smsg->to, qr/\blist\@example\.com\b/, 'to appears');
 	}
 
 	$mset = $ro->query('tc:list@example.com', {mset => 1});
 	is($mset->size, 6, 'searched To+Cc: successfully');
 	foreach my $m ($mset->items) {
-		my $smsg = $ro->lookup_article($m->get_docid);
+		my $smsg = $ro->{over_ro}->get_art($m->get_docid);
 		my $tocc = join("\n", $smsg->to, $smsg->cc);
 		like($tocc, qr/\blist\@example\.com\b/, 'tocc appears');
 	}
@@ -335,7 +335,7 @@ $ibx->with_umask(sub {
 		my $mset = $ro->query($pfx . 'foo@example.com', { mset => 1 });
 		is($mset->items, 1, "searched $pfx successfully for Cc:");
 		foreach my $m ($mset->items) {
-			my $smsg = $ro->lookup_article($m->get_docid);
+			my $smsg = $ro->{over_ro}->get_art($m->get_docid);
 			like($smsg->cc, qr/\bfoo\@example\.com\b/,
 				'cc appears');
 		}
@@ -432,7 +432,11 @@ $ibx->with_umask(sub {
 	}
 	$rw->unindex_blob($amsg);
 	$rw->commit_txn_lazy;
-	is($ro->lookup_article($art->{num}), undef, 'gone from OVER DB') if defined($art);
+	SKIP: {
+		skip('$art not defined', 1) unless defined $art;
+		is($ro->{over_ro}->get_art($art->{num}), undef,
+			'gone from OVER DB');
+	};
 });
 
 my $all_mask = 07777;

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200105020515.11935-1-e@80x24.org \
    --to=e@80x24.org \
    --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