dovecot-2.1-pigeonhole: testsuite: editheader extension: added e...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Sat Nov 26 12:11:50 EET 2011
details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/258108f6eea5
changeset: 1553:258108f6eea5
user: Stephan Bosch <stephan at rename-it.nl>
date: Sat Nov 26 11:11:43 2011 +0100
description:
testsuite: editheader extension: added error tests for header field name verification.
diffstat:
Makefile.am | 1 +
tests/extensions/editheader/errors.svtest | 49 ++++++++++++++++
tests/extensions/editheader/errors/field-name-runtime.sieve | 6 ++
tests/extensions/editheader/errors/field-name.sieve | 19 ++++++
4 files changed, 75 insertions(+), 0 deletions(-)
diffs (97 lines):
diff -r a691c5c035f2 -r 258108f6eea5 Makefile.am
--- a/Makefile.am Sat Nov 26 11:11:02 2011 +0100
+++ b/Makefile.am Sat Nov 26 11:11:43 2011 +0100
@@ -130,6 +130,7 @@
tests/extensions/editheader/deleteheader.svtest \
tests/extensions/editheader/alternating.svtest \
tests/extensions/editheader/utf8.svtest \
+ tests/extensions/editheader/errors.svtest \
tests/extensions/vnd.dovecot/debug/execute.svtest \
tests/deprecated/notify/basic.svtest \
tests/deprecated/notify/mailto.svtest \
diff -r a691c5c035f2 -r 258108f6eea5 tests/extensions/editheader/errors.svtest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/editheader/errors.svtest Sat Nov 26 11:11:43 2011 +0100
@@ -0,0 +1,49 @@
+require "vnd.dovecot.testsuite";
+require "comparator-i;ascii-numeric";
+require "relational";
+
+require "editheader";
+
+test "Invalid field-name" {
+ if test_script_compile "errors/field-name.sieve" {
+ test_fail "compile should have failed";
+ }
+
+ if not test_error :count "eq" :comparator "i;ascii-numeric" "5" {
+ test_fail "wrong number of errors reported";
+ }
+
+ if not test_error :index 1 :matches "*field name*X-field:*invalid" {
+ test_fail "wrong error reported";
+ }
+
+ if not test_error :index 2 :matches "*field name*X field*invalid" {
+ test_fail "wrong error reported";
+ }
+
+ if not test_error :index 3 :matches "*field name*X-field:*invalid" {
+ test_fail "wrong error reported";
+ }
+
+ if not test_error :index 4 :matches "*field name*X field*invalid" {
+ test_fail "wrong error reported";
+ }
+}
+
+test "Invalid field-name at runtime " {
+ if not test_script_compile "errors/field-name-runtime.sieve" {
+ test_fail "compile failed";
+ }
+
+ if test_script_run {
+ test_fail "run should have failed";
+ }
+
+ if not test_error :count "eq" :comparator "i;ascii-numeric" "1" {
+ test_fail "wrong number of errors reported";
+ }
+
+ if not test_error :matches "*field name*X-field:*invalid" {
+ test_fail "wrong error reported";
+ }
+}
diff -r a691c5c035f2 -r 258108f6eea5 tests/extensions/editheader/errors/field-name-runtime.sieve
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/editheader/errors/field-name-runtime.sieve Sat Nov 26 11:11:43 2011 +0100
@@ -0,0 +1,6 @@
+require "editheader";
+require "variables";
+
+set "header" "X-field:";
+
+addheader "${header}" "Frop";
diff -r a691c5c035f2 -r 258108f6eea5 tests/extensions/editheader/errors/field-name.sieve
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/editheader/errors/field-name.sieve Sat Nov 26 11:11:43 2011 +0100
@@ -0,0 +1,19 @@
+require "editheader";
+
+# Ok
+addheader "X-field" "Frop";
+
+# Invalid ':'
+addheader "X-field:" "Frop";
+
+# Invalid ' '
+addheader "X field" "Frop";
+
+# Ok
+deleteheader "X-field";
+
+# Invalid ':'
+deleteheader "X-field:";
+
+# Invalid ' '
+deleteheader "X field";
More information about the dovecot-cvs
mailing list