X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fv1reindex.t;h=e473fe7c3942a95f2db6dbca31b10a0d6d733243;hb=e6b7a7f5f70fb89a54ff158bc6c8b564149947e5;hp=c0e21a56b6ce7a8aca36ffbf12e6d9b5eaa7b390;hpb=ad6f26f3b9f0e428020d05667987556f8fcbec2f;p=public-inbox.git diff --git a/t/v1reindex.t b/t/v1reindex.t index c0e21a56..e473fe7c 100644 --- a/t/v1reindex.t +++ b/t/v1reindex.t @@ -1,37 +1,31 @@ -# Copyright (C) 2018-2019 all contributors +# Copyright (C) 2018-2020 all contributors # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; use PublicInbox::ContentId qw(content_digest); use File::Path qw(remove_tree); -require './t/common.perl'; +use PublicInbox::TestCommon; +use PublicInbox::MIME; require_git(2.6); - -foreach my $mod (qw(DBD::SQLite Search::Xapian)) { - eval "require $mod"; - plan skip_all => "$mod missing for v1reindex.t" if $@; -} +require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::SearchIdx'; use_ok 'PublicInbox::Import'; my ($inboxdir, $for_destroy) = tmpdir(); -is(system(qw(git init -q --bare), $inboxdir), 0); my $ibx_config = { inboxdir => $inboxdir, name => 'test-v1reindex', -primary_address => 'test@example.com', indexlevel => 'full', }; -my $mime = PublicInbox::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF my $minmax; my $msgmap; my ($mark1, $mark2, $mark3, $mark4); @@ -39,6 +33,7 @@ my ($mark1, $mark2, $mark3, $mark4); my %config = %$ibx_config; my $ibx = PublicInbox::Inbox->new(\%config); my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx); + $im->init_bare; foreach my $i (1..10) { $mime->header_set('Message-Id', "<$i\@example.com>"); ok($im->add($mime), "message $i added");