-# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
+#!perl -w
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use v5.10.1;
use strict;
-use warnings;
use Test::More;
use Fcntl qw(SEEK_SET);
use Cwd;
ok(run_script(['-mda'], undef, $rdr), 'mda delivered a message');
$ibx = PublicInbox::Inbox->new($ibx);
-
-if ($V == 1) {
- ok(run_script([ '-index', "$tmpdir/inbox" ]), 'v1 indexed');
-}
my $msgs = $ibx->over->recent;
is(scalar(@$msgs), 1, 'only got one message');
my $eml = $ibx->smsg_eml($msgs->[0]);
open my $fh, '<', $patch or die "failed to open $patch: $!\n";
$rdr->{0} = \(do { local $/; <$fh> });
ok(run_script(['-mda'], undef, $rdr), 'mda delivered a patch');
- my $post = $ibx->search->reopen->query('dfpost:6e006fd7');
- is(scalar(@$post), 1, 'got one result for dfpost');
- my $pre = $ibx->search->query('dfpre:090d998');
- is(scalar(@$pre), 1, 'got one result for dfpre');
+ my $post = $ibx->search->reopen->mset('dfpost:6e006fd7');
+ is($post->size, 1, 'got one result for dfpost');
+ my $pre = $ibx->search->mset('dfpre:090d998');
+ is($pre->size, 1, 'got one result for dfpre');
+ $pre = $ibx->search->mset_to_smsg($ibx, $pre);
+ $post = $ibx->search->mset_to_smsg($ibx, $post);
is($post->[0]->{blob}, $pre->[0]->{blob}, 'same message in both cases');
+
+ # git patch-id --stable <t/data/0001.patch | awk '{print $1}'
+ my $patchid = '91ee6b761fc7f47cad9f2b09b10489f313eb5b71';
+ my $mset = $ibx->search->mset("patchid:$patchid");
+ is($mset->size, 1, 'patchid search works');
}
done_testing();