dovecot-2.0-pigeonhole: Spamtest and virustest extensions: disca...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Mar 28 19:41:12 EEST 2010


details:   http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/86bc7ff124c0
changeset: 1242:86bc7ff124c0
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Mar 14 12:19:51 2010 +0100
description:
Spamtest and virustest extensions: discarded whitespace at beginning of regexp and added syntax testsuite tests.

diffstat:

 Makefile.am                                                    |   1 +
 src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c |   1 +
 tests/extensions/spamvirustest/errors.svtest                   |  15 +++++++
 tests/extensions/spamvirustest/errors/syntax-errors.sieve      |  19 +++++++++
 tests/extensions/spamvirustest/spamtest.svtest                 |   2 +-
 5 files changed, 37 insertions(+), 1 deletions(-)

diffs (76 lines):

diff -r fc7bdc3daa36 -r 86bc7ff124c0 Makefile.am
--- a/Makefile.am	Sat Mar 27 19:11:09 2010 +0100
+++ b/Makefile.am	Sun Mar 14 12:19:51 2010 +0100
@@ -118,6 +118,7 @@
 	tests/extensions/spamvirustest/spamtest.svtest \
 	tests/extensions/spamvirustest/virustest.svtest \
 	tests/extensions/spamvirustest/spamtestplus.svtest \
+	tests/extensions/spamvirustest/errors.svtest \
 	$(test_unfinished)
 
 $(test_cases):
diff -r fc7bdc3daa36 -r 86bc7ff124c0 src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c
--- a/src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c	Sat Mar 27 19:11:09 2010 +0100
+++ b/src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c	Sun Mar 14 12:19:51 2010 +0100
@@ -133,6 +133,7 @@
 		return FALSE;
 	}
 	p++;
+	while ( *p == ' ' || *p == '\t' ) p++;
 
 	spec->regexp_match = TRUE;
 	if ( !_regexp_compile(&spec->regexp, p, &regexp_error) ) {
diff -r fc7bdc3daa36 -r 86bc7ff124c0 tests/extensions/spamvirustest/errors.svtest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/spamvirustest/errors.svtest	Sun Mar 14 12:19:51 2010 +0100
@@ -0,0 +1,15 @@
+require "vnd.dovecot.testsuite";
+
+require "comparator-i;ascii-numeric";
+require "relational";
+
+test "Syntax errors" {
+	if test_script_compile "errors/syntax-errors.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";
+	}
+}
+
diff -r fc7bdc3daa36 -r 86bc7ff124c0 tests/extensions/spamvirustest/errors/syntax-errors.sieve
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/spamvirustest/errors/syntax-errors.sieve	Sun Mar 14 12:19:51 2010 +0100
@@ -0,0 +1,19 @@
+require "spamtest";
+require "virustest";
+
+# Value not a string
+if spamtest 3 {
+}
+
+# Value not a string
+if virustest 3 {
+}
+
+# Missing value argument
+if spamtest :matches :comparator "i;ascii-casemap" {
+}
+
+# Inappropriate :percent argument
+if spamtest :percent "3" {
+}
+
diff -r fc7bdc3daa36 -r 86bc7ff124c0 tests/extensions/spamvirustest/spamtest.svtest
--- a/tests/extensions/spamvirustest/spamtest.svtest	Sat Mar 27 19:11:09 2010 +0100
+++ b/tests/extensions/spamvirustest/spamtest.svtest	Sun Mar 14 12:19:51 2010 +0100
@@ -84,7 +84,7 @@
 }
 
 test_config :set "sieve_spamtest_status_header"
-	"X-SpamCheck3:[ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)";
+	"X-SpamCheck3: [ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)";
 test_config :reload "spamtest";
 
 test "Value: high" {


More information about the dovecot-cvs mailing list