dovecot-2.2-pigeonhole: lib-sieve: mime/foreverypart: Implemente...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Nov 29 11:17:36 UTC 2015


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/8fe5ffd62a84
changeset: 2142:8fe5ffd62a84
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Nov 29 12:16:25 2015 +0100
description:
lib-sieve: mime/foreverypart: Implemented basic execution tests.

diffstat:

 Makefile.am                                      |   1 +
 tests/extensions/mime/execute.svtest             |  67 +++++++++++++++++++++-
 tests/extensions/mime/execute/foreverypart.sieve |  15 +++-
 tests/extensions/mime/execute/mime.sieve         |  69 ++++++++++++++++++++++++
 4 files changed, 144 insertions(+), 8 deletions(-)

diffs (189 lines):

diff -r 90de55c880e5 -r 8fe5ffd62a84 Makefile.am
--- a/Makefile.am	Sun Nov 29 11:53:24 2015 +0100
+++ b/Makefile.am	Sun Nov 29 12:16:25 2015 +0100
@@ -167,6 +167,7 @@
 	tests/extensions/metadata/execute.svtest \
 	tests/extensions/metadata/errors.svtest \
 	tests/extensions/mime/errors.svtest \
+	tests/extensions/mime/execute.svtest \
 	tests/extensions/mime/content-header.svtest \
 	tests/extensions/vnd.dovecot/debug/execute.svtest \
 	tests/extensions/vnd.dovecot/environment/basic.svtest \
diff -r 90de55c880e5 -r 8fe5ffd62a84 tests/extensions/mime/execute.svtest
--- a/tests/extensions/mime/execute.svtest	Sun Nov 29 11:53:24 2015 +0100
+++ b/tests/extensions/mime/execute.svtest	Sun Nov 29 12:16:25 2015 +0100
@@ -4,8 +4,51 @@
  * Execution testing (currently just meant to trigger any segfaults)
  */
 
-test "Basic" {
-	if not test_script_compile "execute/ihave.sieve" {
+test_set "message" text:
+From: Whomever <whoever at example.com>
+To: Someone <someone at example.com>
+Date: Sat, 10 Oct 2009 00:30:04 +0200
+Subject: whatever
+Content-Type: multipart/mixed; boundary=outer
+
+This is a multi-part message in MIME format.
+
+--outer
+Content-Type: multipart/alternative; boundary=inner
+
+This is a nested multi-part message in MIME format.
+
+--inner
+Content-Type: text/plain; charset="us-ascii"
+
+Hello
+
+--inner
+Content-Type: text/html; charset="us-ascii"
+
+<html><body>Hello</body></html>
+
+--inner--
+
+This is the end of the inner MIME multipart.
+
+--outer
+Content-Type: message/rfc822
+
+From: Someone Else
+Subject: Hello, this is an elaborate request for you to finally say hello
+ already!
+
+Please say Hello
+
+--outer--
+
+This is the end of the outer MIME multipart.
+.
+;
+
+test "Basic - foreverypart" {
+	if not test_script_compile "execute/foreverypart.sieve" {
 		test_fail "script compile failed";
 	}
 
@@ -17,7 +60,23 @@
 		test_fail "result execute failed";
 	}
 
-        test_binary_save "ihave-basic";
-        test_binary_load "ihave-basic";
+	test_binary_save "ihave-basic";
+	test_binary_load "ihave-basic";
 }
 
+test "Basic - mime" {
+	if not test_script_compile "execute/mime.sieve" {
+		test_fail "script compile failed";
+	}
+
+	if not test_script_run {
+		test_fail "script run failed";
+	}
+
+	if not test_result_execute {
+		test_fail "result execute failed";
+	}
+
+	test_binary_save "ihave-basic";
+	test_binary_load "ihave-basic";
+}
diff -r 90de55c880e5 -r 8fe5ffd62a84 tests/extensions/mime/execute/foreverypart.sieve
--- a/tests/extensions/mime/execute/foreverypart.sieve	Sun Nov 29 11:53:24 2015 +0100
+++ b/tests/extensions/mime/execute/foreverypart.sieve	Sun Nov 29 12:16:25 2015 +0100
@@ -1,7 +1,14 @@
-require "ihave";
+require "foreverypart";
+require "variables";
 
-if ihave "nonsense-extension" {
-	nonsense_command "Frop!";
+foreverypart {
+	foreverypart {
+		foreverypart {
+			foreverypart {
+				set "a" "a${a}";
+			}
+		}
+	}
 }
 
-redirect "frop at example.com";
+
diff -r 90de55c880e5 -r 8fe5ffd62a84 tests/extensions/mime/execute/mime.sieve
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/extensions/mime/execute/mime.sieve	Sun Nov 29 12:16:25 2015 +0100
@@ -0,0 +1,69 @@
+require "mime";
+require "foreverypart";
+require "variables";
+
+if header :contains :mime "Content-Type" "text/plain" {
+	discard;
+}
+if header :mime :type "Content-Type" "text" {
+	discard;
+}
+if header :mime :subtype "Content-Type" "plain" {
+	discard;
+}
+if header :mime :contenttype "Content-Type" "text/plain" {
+	discard;
+}
+if header :mime :param ["frop", "friep"] "Content-Type" "frml" {
+	discard;
+}
+if header :anychild :contains :mime "Content-Type" "text/plain" {
+	discard;
+}
+if header :mime :anychild :type "Content-Type" "text" {
+	discard;
+}
+if header :mime :subtype :anychild "Content-Type" "plain" {
+	discard;
+}
+if header :anychild :mime :contenttype "Content-Type" "text/plain" {
+	discard;
+}
+if header :mime :param ["frop", "friep"] :anychild "Content-Type" "frml" {
+	discard;
+}
+
+foreverypart {
+	foreverypart {
+		if header :contains :mime "Content-Type" "text/plain" {
+			discard;
+		}
+		if header :mime :type "Content-Type" "text" {
+			discard;
+		}
+		if header :mime :subtype "Content-Type" "plain" {
+			discard;
+		}
+		if header :mime :contenttype "Content-Type" "text/plain" {
+			discard;
+		}
+		if header :mime :param ["frop", "friep"] "Content-Type" "frml" {
+			discard;
+		}
+		if header :anychild :contains :mime "Content-Type" "text/plain" {
+			discard;
+		}
+		if header :mime :anychild :type "Content-Type" "text" {
+			discard;
+		}
+		if header :mime :subtype :anychild "Content-Type" "plain" {
+			discard;
+		}
+		if header :anychild :mime :contenttype "Content-Type" "text/plain" {
+			discard;
+		}
+		if header :mime :param ["frop", "friep"] :anychild "Content-Type" "frml" {
+			discard;
+		}
+	}
+}


More information about the dovecot-cvs mailing list