diff options
Diffstat (limited to 't/v2mda.t')
-rw-r--r-- | t/v2mda.t | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -3,15 +3,15 @@ # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> use v5.10.1; use strict; -use Test::More; use Fcntl qw(SEEK_SET); use Cwd; use PublicInbox::TestCommon; use PublicInbox::Eml; +use File::Path qw(remove_tree); require_git(2.6); my $V = 2; -require_mods(qw(DBD::SQLite Search::Xapian)); +require_mods(qw(DBD::SQLite Xapian)); use_ok 'PublicInbox::V2Writable'; my ($tmpdir, $for_destroy) = tmpdir(); my $ibx = { @@ -96,4 +96,29 @@ is($eml->as_string, $mime->as_string, 'injected message'); is($mset->size, 1, 'patchid search works'); } +{ + my @shards = grep(m!/[0-9]+\z!, glob("$ibx->{inboxdir}/xap*/*")); + ok(remove_tree(@shards), 'rm shards to convert to indexlevel=basic'); + $ibx->do_cleanup; + $rdr->{2} = \(my $err = ''); + $rdr->{0} = \<<'EOM'; +From: a@example.com +To: test@example.com +Subject: this is a ham message for learn +Date: Fri, 02 Oct 1993 00:00:00 +0000 +Message-ID: <ham@example> + +yum +EOM + my ($id, $prev); + is($ibx->over->next_by_mid('ham@example', \$id, \$prev), undef, + 'no ham@example, yet'); + ok(run_script([qw(-learn ham)], undef, $rdr), '-learn runs on basic') + or diag $err; + my $smsg = $ibx->over->next_by_mid('ham@example', \$id, \$prev); + ok($smsg, 'ham message learned w/ indexlevel=basic'); + @shards = grep(m!/[0-9]+\z!, glob("$ibx->{inboxdir}/xap*/*")); + is_deeply(\@shards, [], 'not converted to medium/full after learn'); +} + done_testing(); |