]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/watch_filter_rubylang.t
update copyrights for 2021
[public-inbox.git] / t / watch_filter_rubylang.t
index 4b72dbae97f763c2a88df4a4220266c636fe74c1..29a9f793858c564d75f7f8b058b71b2f278e5777 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -72,24 +72,23 @@ $cfgpfx.filter=PublicInbox::Filter::RubyLang
 $cfgpfx.altid=serial:alerts:file=msgmap.sqlite3
 publicinboxwatch.watchspam=maildir:$spamdir
 EOF
-       my $config = PublicInbox::Config->new(\$orig);
-       my $ibx = $config->lookup_name($v);
+       my $cfg = PublicInbox::Config->new(\$orig);
+       my $ibx = $cfg->lookup_name($v);
        ok($ibx, 'found inbox by name');
 
-       my $w = PublicInbox::Watch->new($config);
+       my $w = PublicInbox::Watch->new($cfg);
        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);
@@ -102,10 +101,9 @@ EOF
        }
        $w->scan('full');
 
-       $config = PublicInbox::Config->new(\$orig);
-       $ibx = $config->lookup_name($v);
-       ($tot, undef) = $ibx->search->reopen->query('b:spam');
-       is($tot, 0, 'spam removed');
+       $cfg = PublicInbox::Config->new(\$orig);
+       $ibx = $cfg->lookup_name($v);
+       is($ibx->search->reopen->mset('b:spam')->size, 0, 'spam removed');
 
        is_deeply([], \@warn, 'no warnings');
 }