about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-16 07:04:26 +0000
committerEric Wong <e@yhbt.net>2020-06-16 21:41:58 +0000
commitbdee1f6bfaa0017877e5d5284c2d5e41f67e847a (patch)
tree14233ad3a517acb774418b80afa36a861561da37 /t
parent07caa8528db2ac22d81a0763e1cefd59acd827f1 (diff)
downloadpublic-inbox-bdee1f6bfaa0017877e5d5284c2d5e41f67e847a.tar.gz
We no longer pass an arrayref to search_common() or
parse_query(), so handle the CHARSET directive in
the Parse::RecDescent-generated parser directly.
Diffstat (limited to 't')
-rw-r--r--t/imap_searchqp.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/imap_searchqp.t b/t/imap_searchqp.t
index 3e4dde6f..d73600b3 100644
--- a/t/imap_searchqp.t
+++ b/t/imap_searchqp.t
@@ -21,6 +21,18 @@ is($q->{xap}, '(t:"brian" OR (f:"ryan" OR (t:"joe" OR c:"scott")))',
 $q = $parse->(qq{HEADER CC b SENTSINCE 2-Oct-1993});
 is($q->{xap}, 'c:"b" d:19931002..', 'compound query');
 
+$q = $parse->(qq{CHARSET UTF-8 From b});
+is($q->{xap}, 'f:"b"', 'charset handled');
+$q = $parse->(qq{CHARSET WTF-8 From b});
+like($q, qr/\ANO \[/, 'bad charset rejected');
+{
+        # TODO: squelch errors by default? clients could flood logs
+        open my $fh, '>:scalar', \(my $buf) or die;
+        local *STDERR = $fh;
+        $q = $parse->(qq{CHARSET});
+}
+like($q, qr/\ABAD /, 'bad charset rejected');
+
 $q = $parse->(qq{HEADER CC B (SENTBEFORE 2-Oct-1993)});
 is($q->{xap}, 'c:"b" d:..19931002', 'compound query w/ parens');