-# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2020 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 Email::MIME;
+use PublicInbox::Eml;
use PublicInbox::TestCommon;
my ($tmpdir, $for_destroy) = tmpdir();
my $maindir = "$tmpdir/main.git";
my $addr = 'test-public@example.com';
my $cfgpfx = "publicinbox.test";
-my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape);
+my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape
+ Plack::Builder Plack::App::URLMap);
require_mods(@mods);
use_ok $_ foreach @mods;
+use_ok 'PublicInbox::WWW';
use PublicInbox::Import;
use PublicInbox::Git;
use PublicInbox::Config;
-use PublicInbox::WWW;
-use Plack::Builder;
-use Plack::App::URLMap;
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=$addr
$cfgpfx.inboxdir=$maindir
EOF
-is(0, system(qw(git init -q --bare), $maindir), "git init (main)");
my $git = PublicInbox::Git->new($maindir);
my $im = PublicInbox::Import->new($git, 'test', $addr);
+$im->init_bare;
{
- my $mime = Email::MIME->new(<<EOF);
+ my $mime = PublicInbox::Eml->new(<<EOF);
From: Me <me\@example.com>
To: You <you\@example.com>
Cc: $addr
}
my $www = PublicInbox::WWW->new($config);
-my $app = builder {
- enable 'Head';
- mount '/a' => builder { sub { $www->call(@_) } };
- mount '/b' => builder { sub { $www->call(@_) } };
-};
+my $app = builder(sub {
+ enable('Head');
+ mount('/a' => builder(sub { sub { $www->call(@_) } }));
+ mount('/b' => builder(sub { sub { $www->call(@_) } }));
+});
test_psgi($app, sub {
my ($cb) = @_;