]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/watch_filter_rubylang.t
search: replace ->query with ->mset
[public-inbox.git] / t / watch_filter_rubylang.t
index db48cb2ffde3d60742ed208a305a8cda702a57f0..6513f30b0441c42d0fa63366d79b4973e98e9260 100644 (file)
@@ -7,7 +7,7 @@ use Test::More;
 use PublicInbox::Eml;
 use PublicInbox::Config;
 require_mods(qw(DBD::SQLite Search::Xapian));
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{PI_CONFIG} = "$tmpdir/pi_config";
@@ -76,20 +76,19 @@ EOF
        my $ibx = $config->lookup_name($v);
        ok($ibx, 'found inbox by name');
 
-       my $w = PublicInbox::WatchMaildir->new($config);
+       my $w = PublicInbox::Watch->new($config);
        for my $i (1..2) {
                $w->scan('full');
        }
 
        # make sure all serials are searchable:
-       my ($tot, $msgs);
        for my $i (1..15) {
-               ($tot, $msgs) = $ibx->search->query("alerts:$i");
-               is($tot, 1, "got one result for alerts:$i");
+               my $mset = $ibx->search->mset("alerts:$i");
+               is($mset->size, 1, "got one result for alerts:$i");
+               my $msgs = $ibx->search->mset_to_smsg($ibx, $mset);
                is($msgs->[0]->{mid}, "a.$i\@b.com", "got expected MID for $i");
        }
-       ($tot, undef) = $ibx->search->query('b:spam');
-       is($tot, 1, 'got spam message');
+       is($ibx->search->mset('b:spam')->size, 1, 'got spam message');
 
        my $nr = unlink <$maildir/new/*>;
        is(16, $nr);
@@ -104,8 +103,7 @@ EOF
 
        $config = PublicInbox::Config->new(\$orig);
        $ibx = $config->lookup_name($v);
-       ($tot, undef) = $ibx->search->reopen->query('b:spam');
-       is($tot, 0, 'spam removed');
+       is($ibx->search->reopen->mset('b:spam')->size, 0, 'spam removed');
 
        is_deeply([], \@warn, 'no warnings');
 }