about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-14 17:01:55 +0000
committerEric Wong <e@80x24.org>2019-06-14 17:27:06 +0000
commit585314673236d664729fe3ab2d4fb229d1c0f2d5 (patch)
tree8e5c0c5b56a662a85dbc0022b20c3272c1a2c34b /t
parentf70abe08b768bb0d5537ef2c3f9091069046d9a2 (diff)
downloadpublic-inbox-585314673236d664729fe3ab2d4fb229d1c0f2d5.tar.gz
PublicInbox::Inbox objects have minimal dependencies, so
drop code to support old tests which existed before the
PublicInbox::Inbox object came into existence.
Diffstat (limited to 't')
-rw-r--r--t/nntpd.t4
-rw-r--r--t/psgi_search.t4
-rw-r--r--t/search-thr-index.t4
-rw-r--r--t/search.t7
4 files changed, 12 insertions, 7 deletions
diff --git a/t/nntpd.t b/t/nntpd.t
index a95fb6fc..c37880bf 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -91,7 +91,7 @@ EOF
                 $im->add($mime);
                 $im->done;
                 if ($version == 1) {
-                        my $s = PublicInbox::SearchIdx->new($mainrepo, 1);
+                        my $s = PublicInbox::SearchIdx->new($ibx, 1);
                         $s->index_sync;
                 }
         }
@@ -243,7 +243,7 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000
                 $im->add($for_leafnode);
                 $im->done;
                 if ($version == 1) {
-                        my $s = PublicInbox::SearchIdx->new($mainrepo, 1);
+                        my $s = PublicInbox::SearchIdx->new($ibx, 1);
                         $s->index_sync;
                 }
                 my $hdr = $n->head("<$long_hdr>");
diff --git a/t/psgi_search.t b/t/psgi_search.t
index a6507676..bbf5a96a 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -6,6 +6,7 @@ use Test::More;
 use File::Temp qw/tempdir/;
 use Email::MIME;
 use PublicInbox::Config;
+use PublicInbox::Inbox;
 use PublicInbox::WWW;
 use bytes (); # only for bytes::length
 my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common Plack::Test
@@ -19,7 +20,8 @@ my $tmpdir = tempdir('pi-psgi-search.XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $git_dir = "$tmpdir/a.git";
 
 is(0, system(qw(git init -q --bare), $git_dir), "git init (main)");
-my $rw = PublicInbox::SearchIdx->new($git_dir, 1);
+my $ibx = PublicInbox::Inbox->new({mainrepo => $git_dir});
+my $rw = PublicInbox::SearchIdx->new($ibx, 1);
 ok($rw, "search indexer created");
 my $digits = '10010260936330';
 my $ua = 'Pine.LNX.4.10';
diff --git a/t/search-thr-index.t b/t/search-thr-index.t
index 1872af84..0f593c2a 100644
--- a/t/search-thr-index.t
+++ b/t/search-thr-index.t
@@ -13,11 +13,13 @@ foreach my $mod (@mods) {
         plan skip_all => "missing $mod for $0" if $@;
 }
 require PublicInbox::SearchIdx;
+require PublicInbox::Inbox;
 my $tmpdir = tempdir('pi-search-thr-index.XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $git_dir = "$tmpdir/a.git";
 
 is(0, system(qw(git init -q --bare), $git_dir), "git init (main)");
-my $rw = PublicInbox::SearchIdx->new($git_dir, 1);
+my $ibx = PublicInbox::Inbox->new({mainrepo => $git_dir});
+my $rw = PublicInbox::SearchIdx->new($ibx, 1);
 ok($rw, "search indexer created");
 my $data = <<'EOF';
 Subject: [RFC 00/14]
diff --git a/t/search.t b/t/search.t
index 538baeff..d4c1e150 100644
--- a/t/search.t
+++ b/t/search.t
@@ -9,18 +9,19 @@ foreach my $mod (@mods) {
         plan skip_all => "missing $mod for $0" if $@;
 };
 require PublicInbox::SearchIdx;
+require PublicInbox::Inbox;
 use File::Temp qw/tempdir/;
 use Email::MIME;
 my $tmpdir = tempdir('pi-search-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $git_dir = "$tmpdir/a.git";
+my $ibx = PublicInbox::Inbox->new({ mainrepo => $git_dir });
 my ($root_id, $last_id);
 
 is(0, system(qw(git init --shared -q --bare), $git_dir), "git init (main)");
 eval { PublicInbox::Search->new($git_dir)->xdb };
 ok($@, "exception raised on non-existent DB");
 
-my $rw = PublicInbox::SearchIdx->new($git_dir, 1);
-my $ibx = $rw->{-inbox};
+my $rw = PublicInbox::SearchIdx->new($ibx, 1);
 $ibx->with_umask(sub {
         $rw->_xdb_acquire;
         $rw->_xdb_release;
@@ -29,7 +30,7 @@ $rw = undef;
 my $ro = PublicInbox::Search->new($git_dir);
 my $rw_commit = sub {
         $rw->commit_txn_lazy if $rw;
-        $rw = PublicInbox::SearchIdx->new($git_dir, 1);
+        $rw = PublicInbox::SearchIdx->new($ibx, 1);
         $rw->{qp_flags} = 0; # quiet a warning
         $rw->begin_txn_lazy;
 };