summaryrefslogtreecommitdiff
path: root/plugins/managesieve/tests/src
diff options
context:
space:
mode:
authordefa <defa@so36.net>2012-09-05 14:48:55 +0200
committerdefa <defa@so36.net>2012-09-05 14:48:55 +0200
commit921408eba600a7dc51271c35480e9114cac5ecec (patch)
tree8728fecce574a1a70f623311b315360564708360 /plugins/managesieve/tests/src
parent5c603c4032bf71792e7accd80e2b7d0e78d445f8 (diff)
parente263994adc3f8f331c6167da1665c1920a5142f9 (diff)
Merge https://github.com/roundcube/roundcubemail into crypt_hash_branch
Diffstat (limited to 'plugins/managesieve/tests/src')
-rw-r--r--plugins/managesieve/tests/src/parser52
-rw-r--r--plugins/managesieve/tests/src/parser.out52
-rw-r--r--plugins/managesieve/tests/src/parser_body17
-rw-r--r--plugins/managesieve/tests/src/parser_imapflags7
-rw-r--r--plugins/managesieve/tests/src/parser_include7
-rw-r--r--plugins/managesieve/tests/src/parser_kep142
-rw-r--r--plugins/managesieve/tests/src/parser_kep14.out3
-rw-r--r--plugins/managesieve/tests/src/parser_prefix5
-rw-r--r--plugins/managesieve/tests/src/parser_relational6
-rw-r--r--plugins/managesieve/tests/src/parser_subaddress11
-rw-r--r--plugins/managesieve/tests/src/parser_vacation12
-rw-r--r--plugins/managesieve/tests/src/parser_variables12
12 files changed, 186 insertions, 0 deletions
diff --git a/plugins/managesieve/tests/src/parser b/plugins/managesieve/tests/src/parser
new file mode 100644
index 000000000..9c4717be4
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser
@@ -0,0 +1,52 @@
+require ["fileinto","reject","envelope"];
+# rule:[spam]
+if anyof (header :contains "X-DSPAM-Result" "Spam")
+{
+ fileinto "Spam";
+ stop;
+}
+# rule:[test1]
+if anyof (header :comparator "i;ascii-casemap" :contains ["From","To"] "test@domain.tld")
+{
+ discard;
+ stop;
+}
+# rule:[test2]
+if anyof (not header :comparator "i;octet" :contains ["Subject"] "[test]", header :contains "Subject" "[test2]")
+{
+ fileinto "test";
+ stop;
+}
+# rule:[comments]
+if anyof (true) /* comment
+ * "comment" #comment */ {
+ /* comment */ stop;
+# comment
+}
+# rule:[reject]
+if size :over 5000K {
+ reject "Message over 5MB size limit. Please contact me before sending this.";
+}
+# rule:[false]
+if false # size :over 5000K
+{
+ stop; /* rule disabled */
+}
+# rule:[true]
+if true
+{
+ stop;
+}
+fileinto "Test";
+# rule:[address test]
+if address :all :is "From" "nagios@domain.tld"
+{
+ fileinto "domain.tld";
+ stop;
+}
+# rule:[envelope test]
+if envelope :domain :is "From" "domain.tld"
+{
+ fileinto "domain.tld";
+ stop;
+}
diff --git a/plugins/managesieve/tests/src/parser.out b/plugins/managesieve/tests/src/parser.out
new file mode 100644
index 000000000..385c8890d
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser.out
@@ -0,0 +1,52 @@
+require ["fileinto","reject","envelope"];
+# rule:[spam]
+if header :contains "X-DSPAM-Result" "Spam"
+{
+ fileinto "Spam";
+ stop;
+}
+# rule:[test1]
+if header :contains ["From","To"] "test@domain.tld"
+{
+ discard;
+ stop;
+}
+# rule:[test2]
+if anyof (not header :comparator "i;octet" :contains "Subject" "[test]", header :contains "Subject" "[test2]")
+{
+ fileinto "test";
+ stop;
+}
+# rule:[comments]
+if true
+{
+ stop;
+}
+# rule:[reject]
+if size :over 5000K
+{
+ reject "Message over 5MB size limit. Please contact me before sending this.";
+}
+# rule:[false]
+if false # size :over 5000K
+{
+ stop;
+}
+# rule:[true]
+if true
+{
+ stop;
+}
+fileinto "Test";
+# rule:[address test]
+if address :all :is "From" "nagios@domain.tld"
+{
+ fileinto "domain.tld";
+ stop;
+}
+# rule:[envelope test]
+if envelope :domain :is "From" "domain.tld"
+{
+ fileinto "domain.tld";
+ stop;
+}
diff --git a/plugins/managesieve/tests/src/parser_body b/plugins/managesieve/tests/src/parser_body
new file mode 100644
index 000000000..bd142ed8c
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_body
@@ -0,0 +1,17 @@
+require ["body","fileinto"];
+if body :raw :contains "MAKE MONEY FAST"
+{
+ stop;
+}
+if body :content "text" :contains ["missile","coordinates"]
+{
+ fileinto "secrets";
+}
+if body :content "audio/mp3" :contains ""
+{
+ fileinto "jukebox";
+}
+if body :text :contains "project schedule"
+{
+ fileinto "project/schedule";
+}
diff --git a/plugins/managesieve/tests/src/parser_imapflags b/plugins/managesieve/tests/src/parser_imapflags
new file mode 100644
index 000000000..e67bf7cfc
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_imapflags
@@ -0,0 +1,7 @@
+require ["imap4flags"];
+# rule:[imapflags]
+if header :matches "Subject" "^Test$"
+{
+ setflag "\\Seen";
+ addflag ["\\Answered","\\Deleted"];
+}
diff --git a/plugins/managesieve/tests/src/parser_include b/plugins/managesieve/tests/src/parser_include
new file mode 100644
index 000000000..b5585a4ba
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_include
@@ -0,0 +1,7 @@
+require ["include"];
+include "script.sieve";
+# rule:[two]
+if true
+{
+ include :optional "second.sieve";
+}
diff --git a/plugins/managesieve/tests/src/parser_kep14 b/plugins/managesieve/tests/src/parser_kep14
new file mode 100644
index 000000000..1ded8d8d4
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_kep14
@@ -0,0 +1,2 @@
+# EDITOR Roundcube
+# EDITOR_VERSION 123
diff --git a/plugins/managesieve/tests/src/parser_kep14.out b/plugins/managesieve/tests/src/parser_kep14.out
new file mode 100644
index 000000000..cb7faa7f8
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_kep14.out
@@ -0,0 +1,3 @@
+require ["variables"];
+set "EDITOR" "Roundcube";
+set "EDITOR_VERSION" "123";
diff --git a/plugins/managesieve/tests/src/parser_prefix b/plugins/managesieve/tests/src/parser_prefix
new file mode 100644
index 000000000..9f6a33a1c
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_prefix
@@ -0,0 +1,5 @@
+# this is a comment
+# and the second line
+
+require ["variables"];
+set "b" "c";
diff --git a/plugins/managesieve/tests/src/parser_relational b/plugins/managesieve/tests/src/parser_relational
new file mode 100644
index 000000000..0a92fde54
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_relational
@@ -0,0 +1,6 @@
+require ["relational","comparator-i;ascii-numeric"];
+# rule:[redirect]
+if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "14"
+{
+ redirect "test@test.tld";
+}
diff --git a/plugins/managesieve/tests/src/parser_subaddress b/plugins/managesieve/tests/src/parser_subaddress
new file mode 100644
index 000000000..f106b796e
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_subaddress
@@ -0,0 +1,11 @@
+require ["envelope","subaddress","fileinto"];
+if envelope :user "To" "postmaster"
+{
+ fileinto "postmaster";
+ stop;
+}
+if envelope :detail :is "To" "mta-filters"
+{
+ fileinto "mta-filters";
+ stop;
+}
diff --git a/plugins/managesieve/tests/src/parser_vacation b/plugins/managesieve/tests/src/parser_vacation
new file mode 100644
index 000000000..93026db45
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_vacation
@@ -0,0 +1,12 @@
+require ["vacation"];
+# rule:[test-vacation]
+if header :contains "Subject" "vacation"
+{
+ vacation :days 1 text:
+# test
+test test /* test */
+test
+.
+;
+ stop;
+}
diff --git a/plugins/managesieve/tests/src/parser_variables b/plugins/managesieve/tests/src/parser_variables
new file mode 100644
index 000000000..bd5941c02
--- /dev/null
+++ b/plugins/managesieve/tests/src/parser_variables
@@ -0,0 +1,12 @@
+require ["variables"];
+set "honorific" "Mr";
+set "vacation" text:
+Dear ${HONORIFIC} ${last_name},
+I am out, please leave a message after the meep.
+.
+;
+set :length "b" "${a}";
+set :lower "b" "${a}";
+set :upperfirst "b" "${a}";
+set :upperfirst :lower "b" "${a}";
+set :quotewildcard "b" "Rock*";