]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/search.t
msgtime: parse 3-digit years properly
[public-inbox.git] / t / search.t
index c9c4e3464ce1a1a83ca8d4af1518b0dbb57faeb5..ccf0f7463588eb6a68870c5cd67b049588a695b7 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (C) 2015 all contributors <meta@public-inbox.org>
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+# Copyright (C) 2015-2018 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;
@@ -89,21 +89,14 @@ sub filter_mids {
 {
        $rw_commit->();
        $ro->reopen;
-       my $found = $ro->lookup_message('<root@s>');
+       my $found = $ro->first_smsg_by_mid('root@s');
        ok($found, "message found");
        is($root_id, $found->{doc_id}, 'doc_id set correctly');
        is($found->mid, 'root@s', 'mid set correctly');
        ok(int($found->thread_id) > 0, 'thread_id is an integer');
 
+       my ($res, @res);
        my @exp = sort qw(root@s last@s);
-       my $res = $ro->query("path:hello_world");
-       my @res = filter_mids($res);
-       is_deeply(\@res, \@exp, 'got expected results for path: match');
-
-       foreach my $p (qw(hello hello_ hello_world2 hello_world_)) {
-               $res = $ro->query("path:$p");
-               is($res->{total}, 0, "path variant `$p' does not match");
-       }
 
        $res = $ro->query('s:(Hello world)');
        @res = filter_mids($res);
@@ -271,7 +264,7 @@ sub filter_mids {
                ],
                body => "LOOP!\n"));
        ok($doc_id > 0, "doc_id defined with circular reference");
-       my $smsg = $rw->lookup_message('circle@a');
+       my $smsg = $rw->first_smsg_by_mid('circle@a');
        is($smsg->references, '', "no references created");
        my $msg = PublicInbox::SearchMsg->load_doc($smsg->{doc});
        is($s, $msg->subject, 'long subject not rewritten');
@@ -288,7 +281,7 @@ sub filter_mids {
        my $mime = Email::MIME->new($str);
        my $doc_id = $rw->add_message($mime);
        ok($doc_id > 0, 'message indexed doc_id with UTF-8');
-       my $smsg = $rw->lookup_message('testmessage@example.com');
+       my $smsg = $rw->first_smsg_by_mid('testmessage@example.com');
        my $msg = PublicInbox::SearchMsg->load_doc($smsg->{doc});
 
        is($mime->header('Subject'), $msg->subject, 'UTF-8 subject preserved');