about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-10 07:04:55 +0000
committerEric Wong <e@yhbt.net>2020-06-13 07:55:45 +0000
commita7d1920f149bd1ee99297883ff0781f362b66680 (patch)
treef788fbb9f82562aaef85162415e3d3b6132187c3 /t
parentb1a86566fa4ffc45a2900f1de43c48c5be76905a (diff)
downloadpublic-inbox-a7d1920f149bd1ee99297883ff0781f362b66680.tar.gz
This is just a hair faster and cacheable in the future, if we
need it.  Most notably, this avoids doing PublicInbox::Eml->new
for simple "RFC822", "BODY[]", and "RFC822.SIZE" requests.
Diffstat (limited to 't')
-rw-r--r--t/imap.t16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/imap.t b/t/imap.t
index 47e86ef4..2401237c 100644
--- a/t/imap.t
+++ b/t/imap.t
@@ -107,4 +107,20 @@ EOF
         }, 'structure matches expected');
 }
 
+{
+        my $fetch_compile = \&PublicInbox::IMAP::fetch_compile;
+        my ($cb, $ops, $partial) = $fetch_compile->(['BODY[]']);
+        is($partial, undef, 'no partial fetch data');
+        is_deeply($ops,
+                [ 'BODY[]', \&PublicInbox::IMAP::emit_rfc822 ],
+                'proper key and op compiled for BODY[]');
+
+        ($cb, $ops, $partial) = $fetch_compile->(['BODY', 'BODY[]']);
+        is_deeply($ops, [
+                'BODY[]', \&PublicInbox::IMAP::emit_rfc822,
+                undef, \&PublicInbox::IMAP::op_eml_new,
+                'BODY', \&PublicInbox::IMAP::emit_body,
+        ], 'placed op_eml_new before emit_body');
+}
+
 done_testing;