]> Sergey Matveev's repositories - public-inbox.git/commitdiff
search: remove lookup_article
authorEric Wong <e@80x24.org>
Sat, 4 Jan 2020 22:14:22 +0000 (22:14 +0000)
committerEric Wong <e@80x24.org>
Sun, 5 Jan 2020 00:05:50 +0000 (00:05 +0000)
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
t/search.t

index f897b833bc9b3ad03d82fa99f8cf533c37efd599..aff3d48b694170a08741042afdc4e8afbf2df590 100644 (file)
@@ -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
index b9aa995b51623e6a59680525a4aa386852157b78..240139b08f7a205f12ccdf87cba29f68ec803e45 100644 (file)
@@ -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;