summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/compile/errors/address.sieve
diff options
context:
space:
mode:
Diffstat (limited to 'pigeonhole/tests/compile/errors/address.sieve')
-rw-r--r--pigeonhole/tests/compile/errors/address.sieve71
1 files changed, 71 insertions, 0 deletions
diff --git a/pigeonhole/tests/compile/errors/address.sieve b/pigeonhole/tests/compile/errors/address.sieve
new file mode 100644
index 0000000..f7d3b26
--- /dev/null
+++ b/pigeonhole/tests/compile/errors/address.sieve
@@ -0,0 +1,71 @@
+require "comparator-i;ascii-numeric";
+
+/*
+ * Address test errors
+ *
+ * Total count: 8 (+1 = 9)
+ */
+
+/*
+ * Command structure
+ */
+
+# Invalid tag
+if address :nonsense :comparator "i;ascii-casemap" :localpart "From" "nico" {
+ discard;
+}
+
+# Invalid first argument
+if address :is :comparator "i;ascii-numeric" :localpart 45 "nico" {
+ discard;
+}
+
+# Invalid second argument
+if address :is :comparator "i;ascii-numeric" :localpart "From" 45 {
+ discard;
+}
+
+# Invalid second argument
+if address :comparator "i;ascii-numeric" :localpart "From" :is {
+ discard;
+}
+
+# Missing second argument
+if address :is :comparator "i;ascii-numeric" :localpart "From" {
+ discard;
+}
+
+# Missing arguments
+if address :is :comparator "i;ascii-numeric" :localpart {
+ discard;
+}
+
+# Not an error
+if address :localpart :is :comparator "i;ascii-casemap" "from" ["frop", "frop"] {
+ discard;
+}
+
+/*
+ * Specified headers must contain addresses
+ */
+
+# Invalid header
+if address :is "frop" "frml" {
+ keep;
+}
+
+# Not an error
+if address :is "reply-to" "frml" {
+ keep;
+}
+
+# Invalid header (#2)
+if address :is ["to", "frop"] "frml" {
+ keep;
+}
+
+# Not an error
+if address :is ["to", "reply-to"] "frml" {
+ keep;
+}
+