summaryrefslogtreecommitdiff
path: root/plugins/managesieve/tests/tokenize.phpt
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-03-31 12:25:48 +0000
committerthomascube <thomas@roundcube.net>2012-03-31 12:25:48 +0000
commit48e9c14ebded89d858c8be0333f77f77a81b0877 (patch)
treee97fd2ea338eea2dbe5f3fb7431e73f44cb8bf18 /plugins/managesieve/tests/tokenize.phpt
parent13db9ee199b0a452a6efaf09e6f7c5a76f739ef5 (diff)
Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore
Diffstat (limited to 'plugins/managesieve/tests/tokenize.phpt')
-rw-r--r--plugins/managesieve/tests/tokenize.phpt66
1 files changed, 66 insertions, 0 deletions
diff --git a/plugins/managesieve/tests/tokenize.phpt b/plugins/managesieve/tests/tokenize.phpt
new file mode 100644
index 000000000..f988653ee
--- /dev/null
+++ b/plugins/managesieve/tests/tokenize.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Script parsing: tokenizer
+--SKIPIF--
+--FILE--
+<?php
+include '../lib/rcube_sieve_script.php';
+
+$txt[1] = array(1, 'text: #test
+This is test ; message;
+Multi line
+.
+;
+');
+$txt[2] = array(0, '["test1","test2"]');
+$txt[3] = array(1, '["test"]');
+$txt[4] = array(1, '"te\\"st"');
+$txt[5] = array(0, 'test #comment');
+$txt[6] = array(0, 'text:
+test
+.
+text:
+test
+.
+');
+$txt[7] = array(1, '"\\a\\\\\\"a"');
+
+foreach ($txt as $idx => $t) {
+ echo "[$idx]---------------\n";
+ var_dump(rcube_sieve_script::tokenize($t[1], $t[0]));
+}
+?>
+--EXPECT--
+[1]---------------
+string(34) "This is test ; message;
+Multi line"
+[2]---------------
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "test1"
+ [1]=>
+ string(5) "test2"
+ }
+}
+[3]---------------
+array(1) {
+ [0]=>
+ string(4) "test"
+}
+[4]---------------
+string(5) "te"st"
+[5]---------------
+array(1) {
+ [0]=>
+ string(4) "test"
+}
+[6]---------------
+array(2) {
+ [0]=>
+ string(4) "test"
+ [1]=>
+ string(4) "test"
+}
+[7]---------------
+string(4) "a\"a"