]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/search.t
treewide: run update-copyrights from gnulib for 2019
[public-inbox.git] / t / search.t
index 586841383c479478d6974564b899116aaa9a40de..3213ac2a9051a8b7c2b6f929ac2db08c78296646 100644 (file)
@@ -1,16 +1,12 @@
-# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
 use Test::More;
-my @mods = qw(DBI DBD::SQLite Search::Xapian);
-foreach my $mod (@mods) {
-       eval "require $mod";
-       plan skip_all => "missing $mod for $0" if $@;
-};
+use PublicInbox::TestCommon;
+require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
 require PublicInbox::Inbox;
-require './t/common.perl';
 use Email::MIME;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/a.git";
@@ -323,14 +319,14 @@ $ibx->with_umask(sub {
        my $mset = $ro->query('t:list@example.com', {mset => 1});
        is($mset->size, 6, 'searched To: successfully');
        foreach my $m ($mset->items) {
-               my $smsg = $ro->lookup_article($m->get_docid);
+               my $smsg = $ro->{over_ro}->get_art($m->get_docid);
                like($smsg->to, qr/\blist\@example\.com\b/, 'to appears');
        }
 
        $mset = $ro->query('tc:list@example.com', {mset => 1});
        is($mset->size, 6, 'searched To+Cc: successfully');
        foreach my $m ($mset->items) {
-               my $smsg = $ro->lookup_article($m->get_docid);
+               my $smsg = $ro->{over_ro}->get_art($m->get_docid);
                my $tocc = join("\n", $smsg->to, $smsg->cc);
                like($tocc, qr/\blist\@example\.com\b/, 'tocc appears');
        }
@@ -339,7 +335,7 @@ $ibx->with_umask(sub {
                my $mset = $ro->query($pfx . 'foo@example.com', { mset => 1 });
                is($mset->items, 1, "searched $pfx successfully for Cc:");
                foreach my $m ($mset->items) {
-                       my $smsg = $ro->lookup_article($m->get_docid);
+                       my $smsg = $ro->{over_ro}->get_art($m->get_docid);
                        like($smsg->cc, qr/\bfoo\@example\.com\b/,
                                'cc appears');
                }
@@ -436,15 +432,19 @@ $ibx->with_umask(sub {
        }
        $rw->unindex_blob($amsg);
        $rw->commit_txn_lazy;
-       is($ro->lookup_article($art->{num}), undef, 'gone from OVER DB') if defined($art);
+       SKIP: {
+               skip('$art not defined', 1) unless defined $art;
+               is($ro->{over_ro}->get_art($art->{num}), undef,
+                       'gone from OVER DB');
+       };
 });
 
 my $all_mask = 07777;
 my $dir_mask = 02770;
 
-# FreeBSD does not allow non-root users to set S_ISGID, so
-# git doesn't set it, either (see DIR_HAS_BSD_GROUP_SEMANTICS in git.git)
-if ($^O =~ /freebsd/i) {
+# FreeBSD and apparently OpenBSD does not allow non-root users to set S_ISGID,
+# so git doesn't set it, either (see DIR_HAS_BSD_GROUP_SEMANTICS in git.git)
+if ($^O =~ /(?:free|open)bsd/i) {
        $all_mask = 0777;
        $dir_mask = 0770;
 }