]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/replace.t
update copyrights for 2021
[public-inbox.git] / t / replace.t
index c4dcb89dec1673f02def9001d299e6f71e14dd19..7135c863d3287980f2254c3f762893e4d62376f2 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;
@@ -74,7 +74,7 @@ EOF
        for my $tip (@$cmts) {
                next if !defined $tip;
                $changed_epochs++;
-               like($tip, qr/\A[a-f0-9]{40}\z/,
+               like($tip, qr/\A[a-f0-9]{40,}\z/,
                        'replace returned current commit');
        }
        is($changed_epochs, 1, 'only one epoch changed');
@@ -106,8 +106,8 @@ EOF
 
        if (my $srch = $ibx->search) {
                for my $q ('f:streisand', 's:confidential', 'malibu') {
-                       my $msgs = $srch->query($q);
-                       is_deeply($msgs, [], "no match for $q");
+                       my $mset = $srch->mset($q);
+                       is($mset->size, 0, "no match for $q");
                }
                my @ok = ('f:redactor', 's:redacted', 'nothing to see');
                if ($opt->{pre}) {
@@ -119,8 +119,8 @@ EOF
                                's:message3', 's:message4';
                }
                for my $q (@ok) {
-                       my $msgs = $srch->query($q);
-                       ok($msgs->[0], "got match for $q");
+                       my $mset = $srch->mset($q);
+                       ok($mset->size, "got match for $q");
                }
        }
 
@@ -179,10 +179,10 @@ EOF
        }
 }
 
-my $opt = { pre => *pad_msgs };
+my $opt = { pre => \&pad_msgs };
 test_replace(2, 'basic', {});
 test_replace(2, 'basic', $opt);
-test_replace(2, 'basic', $opt = { %$opt, post => *pad_msgs });
+test_replace(2, 'basic', $opt = { %$opt, post => \&pad_msgs });
 test_replace(2, 'basic', $opt = { %$opt, rotate_bytes => 1 });
 
 SKIP: {
@@ -190,9 +190,9 @@ SKIP: {
        PublicInbox::Search::load_xapian() or skip 'Search::Xapian missing', 8;
        for my $l (qw(medium)) {
                test_replace(2, $l, {});
-               $opt = { pre => *pad_msgs };
+               $opt = { pre => \&pad_msgs };
                test_replace(2, $l, $opt);
-               test_replace(2, $l, $opt = { %$opt, post => *pad_msgs });
+               test_replace(2, $l, $opt = { %$opt, post => \&pad_msgs });
                test_replace(2, $l, $opt = { %$opt, rotate_bytes => 1 });
        }
 };