From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 913921FD6F for ; Mon, 15 Mar 2021 11:58:30 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 18/35] t/psgi_multipart_not: use create_inbox Date: Mon, 15 Mar 2021 12:58:09 +0100 Message-Id: <20210315115826.17591-19-e@80x24.org> In-Reply-To: <20210315115826.17591-1-e@80x24.org> References: <20210315115826.17591-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Over 100ms saved. --- t/psgi_multipart_not.t | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t index 8edbe088..5f4c06b7 100644 --- a/t/psgi_multipart_not.t +++ b/t/psgi_multipart_not.t @@ -1,29 +1,20 @@ +#!perl -w # Copyright (C) 2018-2021 all contributors # License: AGPL-3.0+ use strict; -use warnings; -use Test::More; +use v5.10.1; +use PublicInbox::TestCommon; use PublicInbox::Eml; use PublicInbox::Config; -use PublicInbox::TestCommon; require_git 2.6; my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common Plack::Test URI::Escape Plack::Builder Plack::Test); require_mods(@mods); use_ok($_) for (qw(HTTP::Request::Common Plack::Test)); use_ok 'PublicInbox::WWW'; -use_ok 'PublicInbox::V2Writable'; -my ($repo, $for_destroy) = tmpdir(); -my $ibx = PublicInbox::Inbox->new({ - inboxdir => $repo, - name => 'multipart-not', - version => 2, - -primary_address => 'test@example.com', -}); -my $im = PublicInbox::V2Writable->new($ibx, 1); -$im->{parallel} = 0; - -my $mime = PublicInbox::Eml->new(<<'EOF'); +my $ibx = create_inbox 'v2', version => 2, sub { + my ($im) = @_; + $im->add(PublicInbox::Eml->new(<<'EOF')) or BAIL_OUT; Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org> To: linux-kernel@vger.kernel.org Subject: [OSDL] linux-2.6.0-test3 reaim results @@ -36,17 +27,13 @@ From: exmh user Freed^Wmultipart ain't what it used to be EOF -ok($im->add($mime), 'added broken multipart message'); -$im->done; - +}; my $cfgpfx = "publicinbox.v2test"; my $cfg = <{-primary_address} -$cfgpfx.inboxdir=$repo +$cfgpfx.inboxdir=$ibx->{inboxdir} EOF -my $config = PublicInbox::Config->new(\$cfg); -my $www = PublicInbox::WWW->new($config); - +my $www = PublicInbox::WWW->new(PublicInbox::Config->new(\$cfg)); my ($res, $raw); test_psgi(sub { $www->call(@_) }, sub { my ($cb) = @_; @@ -58,6 +45,4 @@ test_psgi(sub { $www->call(@_) }, sub { ok(index($raw, 'Warning: decoded text') >= 0, $u.' warns'); } }); - -done_testing(); -1; +done_testing;