X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Ffilter_rubylang.t;h=6d639c004d818bd39b94e12a1e0233356ccaa0db;hb=e3b57fe9f68e80fc85cff46ccec9246b670f1312;hp=337539254fd841b166cff1be73d6ef71c108c39c;hpb=ad6f26f3b9f0e428020d05667987556f8fcbec2f;p=public-inbox.git diff --git a/t/filter_rubylang.t b/t/filter_rubylang.t index 33753925..6d639c00 100644 --- a/t/filter_rubylang.t +++ b/t/filter_rubylang.t @@ -1,10 +1,10 @@ -# Copyright (C) 2017-2019 all contributors +# Copyright (C) 2017-2020 all contributors # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; -require './t/common.perl'; +use PublicInbox::Eml; +use PublicInbox::TestCommon; use_ok 'PublicInbox::Filter::RubyLang'; my $f = PublicInbox::Filter::RubyLang->new; @@ -17,27 +17,31 @@ keep this Unsubscribe: EOF -my $mime = Email::MIME->new($msg); +my $mime = PublicInbox::Eml->new($msg); my $ret = $f->delivery($mime); is($ret, $mime, "delivery successful"); is($mime->body, "keep this\n", 'normal message filtered OK'); SKIP: { - eval 'require DBD::SQLite'; - skip 'DBD::SQLite missing for altid mapping', 4 if $@; + require_mods('DBD::SQLite', 4); use_ok 'PublicInbox::Inbox'; my ($git_dir, $for_destroy) = tmpdir(); is(mkdir("$git_dir/public-inbox"), 1, "created public-inbox dir"); - my $altid = [ "serial:ruby-core:file=msgmap.sqlite3" ]; + my $altid = [ + # 'serial:ruby-core:file=msgmap.sqlite3' can be used here + # for documentation purposes, but Xapian ignores everything + # up to and including the '-' + 'serial:core:file=msgmap.sqlite3' + ]; my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir, altid => $altid }); - $f = PublicInbox::Filter::RubyLang->new(-inbox => $ibx); + $f = PublicInbox::Filter::RubyLang->new(ibx => $ibx); $msg = <<'EOF'; X-Mail-Count: 12 Message-ID: EOF - $mime = Email::MIME->new($msg); + $mime = PublicInbox::Eml->new($msg); $ret = $f->delivery($mime); is($ret, $mime, "delivery successful"); my $mm = PublicInbox::Msgmap->new($git_dir); @@ -49,7 +53,7 @@ Message-ID: EOF - $mime = Email::MIME->new($msg); + $mime = PublicInbox::Eml->new($msg); $ret = $f->delivery($mime); is($ret, 100, "delivery rejected without X-Mail-Count"); }