diff options
author | Eric Wong <e@yhbt.net> | 2020-06-10 07:04:55 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-13 07:55:45 +0000 |
commit | a7d1920f149bd1ee99297883ff0781f362b66680 (patch) | |
tree | f788fbb9f82562aaef85162415e3d3b6132187c3 /t | |
parent | b1a86566fa4ffc45a2900f1de43c48c5be76905a (diff) | |
download | public-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.t | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; |