about summary refs log tree commit homepage
path: root/t/imapd.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-16 05:05:39 +0000
committerEric Wong <e@yhbt.net>2020-06-16 21:41:54 +0000
commit95efed60fe2d20ee4382c485e7faf58b3fee25af (patch)
treefc77edcafa3624667b4f74505c3cb903eb73de12 /t/imapd.t
parent10e06d9b723ea1a8648cd759428c99605f2abfa7 (diff)
downloadpublic-inbox-95efed60fe2d20ee4382c485e7faf58b3fee25af.tar.gz
Since we support MSNs properly, now, it seems acceptable
to support regular SEARCH requests in case there are any
clients which still use non-UID SEARCH.
Diffstat (limited to 't/imapd.t')
-rw-r--r--t/imapd.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/imapd.t b/t/imapd.t
index edfc5204..36082d8c 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -367,6 +367,44 @@ is(scalar keys %$ret, 3, 'got all 3 messages with comma-separated sequence');
 $ret = $mic->fetch_hash('1:*', 'RFC822') or BAIL_OUT "FETCH $@";
 is(scalar keys %$ret, 3, 'got all 3 messages');
 
+SKIP: {
+        # do any clients use non-UID IMAP SEARCH?
+        skip 'Xapian missing', 2 if $level eq 'basic';
+        my $x = $mic->search('all');
+        is_deeply($x, [1, 2, 3], 'MSN SEARCH works before rm');
+        $x = $mic->search(qw(header subject embedded));
+        is_deeply($x, [2], 'MSN SEARCH on Subject works before rm');
+}
+
+{
+        my $rdr = { 0 => \($ret->{1}->{RFC822}) };
+        my $env = { HOME => $ENV{HOME} };
+        my @cmd = qw(-learn rm --all);
+        run_script(\@cmd, $env, $rdr) or BAIL_OUT('-learn rm');
+}
+
+SKIP: {
+        # do any clients use non-UID IMAP SEARCH?  We only ensure
+        # MSN "SEARCH" can return a result which can be retrieved
+        # via MSN "FETCH"
+        skip 'Xapian missing', 3 if $level eq 'basic';
+        my $x = $mic->search(qw(header subject embedded));
+        is(scalar(@$x), 1, 'MSN SEARCH on Subject works after rm');
+        $x = $mic->message_string($x->[0]);
+        is($x, $ret->{2}->{RFC822}, 'message 2 unchanged');
+}
+
+# FIXME? no EXPUNGE response, yet
+my $r2 = $mic->fetch_hash('1:*', 'BODY.PEEK[]') or BAIL_OUT "FETCH $@";
+is(scalar keys %$r2, 2, 'did not get all 3 messages');
+is($r2->{2}->{'BODY[]'}, $ret->{2}->{RFC822}, 'message 2 unchanged');
+is($r2->{3}->{'BODY[]'}, $ret->{3}->{RFC822}, 'message 3 unchanged');
+$r2 = $mic->fetch_hash(2, 'BODY.PEEK[HEADER.FIELDS (message-id)]')
+                        or BAIL_OUT "FETCH $@";
+is($r2->{2}->{'BODY[HEADER.FIELDS (MESSAGE-ID)]'},
+        'Message-ID: <20200418222508.GA13918@dcvr>'."\r\n\r\n",
+        'BODY.PEEK[HEADER.FIELDS ...] drops .PEEK');
+
 {
         my @new_list = $mic->list;
         # tag differs in [-1]