diff options
author | Eric Wong <e@80x24.org> | 2021-03-15 12:58:05 +0100 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-15 16:54:30 -0400 |
commit | c06df0827367ac607983582ba4ce6241c79989a6 (patch) | |
tree | b90f11057f5523ae60efea71f1ddf2f2d83b46c2 /t/altid.t | |
parent | a82c3ceb838e8bb478440263790c28ebae6ec9cd (diff) | |
download | public-inbox-c06df0827367ac607983582ba4ce6241c79989a6.tar.gz |
Another few dozen milliseconds saved.
Diffstat (limited to 't/altid.t')
-rw-r--r-- | t/altid.t | 26 |
1 files changed, 8 insertions, 18 deletions
@@ -1,15 +1,13 @@ +#!perl -w # Copyright (C) 2016-2021 all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> use strict; -use warnings; -use Test::More; +use v5.10.1; use PublicInbox::TestCommon; use PublicInbox::Eml; require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::Msgmap'; use_ok 'PublicInbox::SearchIdx'; -use_ok 'PublicInbox::Import'; -use_ok 'PublicInbox::Inbox'; my ($tmpdir, $for_destroy) = tmpdir(); my $git_dir = "$tmpdir/a.git"; my $alt_file = "$tmpdir/another-nntp.sqlite3"; @@ -24,10 +22,9 @@ my $ibx; } { - my $git = PublicInbox::Git->new($git_dir); - my $im = PublicInbox::Import->new($git, 'testbox', 'test@example'); - $im->init_bare; - $im->add(PublicInbox::Eml->new(<<'EOF')); + $ibx = create_inbox 'testbox', tmpdir => $git_dir, sub { + my ($im) = @_; + $im->add(PublicInbox::Eml->new(<<'EOF')); From: a@example.com To: b@example.com Subject: boo! @@ -35,13 +32,9 @@ Message-ID: <a@example.com> hello world gmane:666 EOF - $im->done; -} -{ - $ibx = PublicInbox::Inbox->new({inboxdir => $git_dir}); + }; $ibx->{altid} = $altid; - my $rw = PublicInbox::SearchIdx->new($ibx, 1); - $rw->index_sync; + PublicInbox::SearchIdx->new($ibx, 1)->index_sync; } { @@ -60,7 +53,4 @@ EOF my $num = $mm->mid_insert('b@example.com'); ok($num > $max, 'auto-increment goes beyond mid_set'); } - -done_testing(); - -1; +done_testing; |