]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/imapd.t
search: index byte size of a message for IMAP search
[public-inbox.git] / t / imapd.t
index 5d9a7d1181c78e907d6b46ffe787893b098e90bb..2546ab51ac6cb390da2573b52a1d337321a7c31c 100644 (file)
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -17,7 +17,7 @@ if ($can_compress) { # hope this gets fixed upstream, soon
 }
 
 require_ok 'PublicInbox::IMAP';
-my $first_range = '1-'.PublicInbox::IMAP::UID_BLOCK();
+my $first_range = '0';
 
 my $level = '-Lbasic';
 SKIP: {
@@ -326,6 +326,12 @@ Content-Type: message/rfc822\r
 Content-Disposition: attachment; filename="embed2x\.eml"\r
 \r
 EOF
+
+       my @hits = $mic->search('SENTON' => '18-Apr-2020');
+       is_deeply(\@hits, [ $uidnext ], 'search with date condition works');
+       ok($mic->examine($ng), 'EXAMINE on dummy');
+       @hits = $mic->search('SENTSINCE' => '18-Apr-2020');
+       is_deeply(\@hits, [], 'search on dummy with condition works');
 }); # each_inbox
 
 # message sequence numbers :<
@@ -367,11 +373,22 @@ ok($mic->close, 'CLOSE works');
 ok(!$mic->close, 'CLOSE not idempotent');
 ok($mic->logout, 'logged out');
 
+{
+       my $c = tcp_connect($sock);
+       $c->autoflush(1);
+       like(<$c>, qr/\* OK/, 'got a greeting');
+       print $c "\r\n";
+       like(<$c>, qr/\A\* BAD Error in IMAP command/, 'empty line');
+       print $c "tagonly\r\n";
+       like(<$c>, qr/\Atagonly BAD Error in IMAP command/, 'tag-only line');
+}
+
 $td->kill;
 $td->join;
 is($?, 0, 'no error in exited process');
 open my $fh, '<', $err or BAIL_OUT("open $err failed: $!");
 my $eout = do { local $/; <$fh> };
 unlike($eout, qr/wide/i, 'no Wide character warnings');
+unlike($eout, qr/uninitialized/i, 'no uninitialized warnings');
 
 done_testing;