dovecot-2.1-pigeonhole: testsuite: editheader: added command syn...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Tue Nov 29 01:57:32 EET 2011


details:   http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/3fc2c1bfb4ca
changeset: 1565:3fc2c1bfb4ca
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Nov 29 00:57:27 2011 +0100
description:
testsuite: editheader: added command syntax checks.

diffstat:

 TODO                                                    |   1 -
 tests/extensions/editheader/errors.svtest               |  10 +++++
 tests/extensions/editheader/errors/command-syntax.sieve |  42 +++++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletions(-)

diffs (77 lines):

diff -r 9a0b9ca3aca5 -r 3fc2c1bfb4ca TODO
--- a/TODO	Mon Nov 28 23:32:14 2011 +0100
+++ b/TODO	Tue Nov 29 00:57:27 2011 +0100
@@ -2,7 +2,6 @@
 
 * Implement editheader extension
 	- Implement configurable limit on header value length
-	- Add command syntax checks to the test suite.
 
 Parallel plugin-based efforts:
 
diff -r 9a0b9ca3aca5 -r 3fc2c1bfb4ca tests/extensions/editheader/errors.svtest
--- a/tests/extensions/editheader/errors.svtest	Mon Nov 28 23:32:14 2011 +0100
+++ b/tests/extensions/editheader/errors.svtest	Tue Nov 29 00:57:27 2011 +0100
@@ -66,6 +66,16 @@
 	}
 }
 
+test "Invalid field value (FIXME: count only)" {
+	if test_script_compile "errors/command-syntax.sieve" {
+		test_fail "compile should have failed";
+	}
+
+	if not test_error :count "eq" :comparator "i;ascii-numeric" "10" {
+		test_fail "wrong number of errors reported";
+	}
+}
+
 test_set "message" text:
 From: stephan at example.com
 To: tss at example.com
diff -r 9a0b9ca3aca5 -r 3fc2c1bfb4ca tests/extensions/editheader/errors/command-syntax.sieve
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/editheader/errors/command-syntax.sieve	Tue Nov 29 00:57:27 2011 +0100
@@ -0,0 +1,42 @@
+require "editheader";
+
+/* "addheader" [":last"] <field-name: string> <value: string>
+ */
+
+# 1: missing field name and value
+addheader;
+
+# 2: missing value
+addheader "x-frop";
+
+# 3: value not a string; number
+addheader "x-frop" 2;
+
+# 4: value not a string; list
+addheader "x-frop" ["frop"];
+
+# 5: strange tag
+addheader :tag "x-frop" "frop";
+
+/* "deleteheader" [":index" <fieldno: number> [":last"]]
+ *                  [COMPARATOR] [MATCH-TYPE]
+ *                  <field-name: string>
+ *                  [<value-patterns: string-list>]
+ */
+
+# 6: missing field name
+deleteheader;
+
+# 7: :last tag without index
+deleteheader :last "x-frop";
+
+# 8: :index tag with string argument
+deleteheader :index "frop" "x-frop";
+
+# OK: match type without value patterns
+deleteheader :matches "x-frop";
+
+# 9: value patterns not a string(list)
+deleteheader "x-frop" 1;
+
+ 


More information about the dovecot-cvs mailing list