Another few dozen milliseconds saved.
---
 t/altid.t | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/t/altid.t b/t/altid.t
index 0e9da07e..87635b19 100644
--- a/t/altid.t
+++ b/t/altid.t
@@ -1,15 +1,13 @@
+#!perl -w
 # Copyright (C) 2016-2021 all contributors <[email protected]>
 # 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: [email protected]
 To: [email protected]
 Subject: boo!
@@ -35,13 +32,9 @@ Message-ID: <[email protected]>
 
 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('[email protected]');
        ok($num > $max, 'auto-increment goes beyond mid_set');
 }
-
-done_testing();
-
-1;
+done_testing;
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to