]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/search.t
terminology: replies => followups
[public-inbox.git] / t / search.t
index 9de6d2866652f13527b7987fd8a48f308f0ee1e4..2bb6b6cf02eaaa3017b07b86e0d12200d0d2a135 100644 (file)
@@ -3,8 +3,9 @@
 use strict;
 use warnings;
 use Test::More;
+eval { require PublicInbox::Search; };
+plan skip_all => "Xapian missing for search" if $@;
 use File::Temp qw/tempdir/;
-use PublicInbox::Search;
 use Email::MIME;
 use Data::Dumper;
 my $tmpdir = tempdir(CLEANUP => 1);
@@ -22,7 +23,7 @@ my $ro = PublicInbox::Search->new($git_dir);
        my $root = Email::MIME->create(
                header_str => [
                        Date => 'Fri, 02 Oct 1993 00:00:00 +0000',
-                       Subject => 'hello world',
+                       Subject => 'Hello world',
                        'Message-ID' => '<root@s>',
                        From => 'John Smith <js@example.com>',
                        To => 'list@example.com',
@@ -31,7 +32,7 @@ my $ro = PublicInbox::Search->new($git_dir);
        my $last = Email::MIME->create(
                header_str => [
                        Date => 'Sat, 02 Oct 2010 00:00:00 +0000',
-                       Subject => 'Re: hello world',
+                       Subject => 'Re: Hello world',
                        'In-Reply-To' => '<root@s>',
                        'Message-ID' => '<last@s>',
                        From => 'John Smith <js@example.com>',
@@ -70,19 +71,19 @@ sub filter_mids {
                is($res->{count}, 0, "path variant `$p' does not match");
        }
 
-       $res = $ro->query('subject:(hello world)');
+       $res = $ro->query('subject:(Hello world)');
        @res = filter_mids($res);
        is_deeply(\@res, \@exp, 'got expected results for subject:() match');
 
-       $res = $ro->query('subject:"hello world"');
+       $res = $ro->query('subject:"Hello world"');
        @res = filter_mids($res);
        is_deeply(\@res, \@exp, 'got expected results for subject:"" match');
 
-       $res = $ro->query('subject:"hello world"', {limit => 1});
+       $res = $ro->query('subject:"Hello world"', {limit => 1});
        is(scalar @{$res->{msgs}}, 1, "limit works");
        my $first = $res->{msgs}->[0];
 
-       $res = $ro->query('subject:"hello world"', {offset => 1});
+       $res = $ro->query('subject:"Hello world"', {offset => 1});
        is(scalar @{$res->{msgs}}, 1, "offset works");
        my $second = $res->{msgs}->[0];
 
@@ -174,9 +175,9 @@ sub filter_mids {
        is_deeply(\@res, [ sort('last@s', $long_midc) ],
                  "got expected results for references: match");
 
-       my $replies = $ro->get_replies('root@s');
-       $replies = [ filter_mids($replies) ];
-       is_deeply($replies, [ filter_mids($res) ], "get_replies matches");
+       my $followups = $ro->get_followups('root@s');
+       $followups = [ filter_mids($followups) ];
+       is_deeply($followups, [ filter_mids($res) ], "get_followups matches");
 
        my $long_reply_mid = 'reply-to-long@1';
        my $long_reply = Email::MIME->create(
@@ -207,7 +208,7 @@ sub filter_mids {
        $rw->add_message(Email::MIME->create(
                header_str => [
                        Date => 'Sat, 02 Oct 2010 00:00:01 +0000',
-                       Subject => 'hello',
+                       Subject => 'Hello',
                        'Message-ID' => '<quote@a>',
                        From => 'Quoter <quoter@example.com>',
                        To => 'list@example.com',
@@ -217,7 +218,7 @@ sub filter_mids {
        $rw->add_message(Email::MIME->create(
                header_str => [
                        Date => 'Sat, 02 Oct 2010 00:00:02 +0000',
-                       Subject => 'hello',
+                       Subject => 'Hello',
                        'Message-ID' => '<nquote@a>',
                        From => 'Non-Quoter<non-quoter@example.com>',
                        To => 'list@example.com',