]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/imap.t
imap: compile UID FETCH to opcodes
[public-inbox.git] / t / imap.t
index 47e86ef42c79d305a11e4c21eac34a16c8a9eb4f..2401237c8a05b0f91f7d69037c04e519290ad1ee 100644 (file)
--- 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;