summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/extensions/ihave
diff options
context:
space:
mode:
Diffstat (limited to 'pigeonhole/tests/extensions/ihave')
-rw-r--r--pigeonhole/tests/extensions/ihave/errors.svtest19
-rw-r--r--pigeonhole/tests/extensions/ihave/errors/error.sieve3
-rw-r--r--pigeonhole/tests/extensions/ihave/execute.svtest23
-rw-r--r--pigeonhole/tests/extensions/ihave/execute/ihave.sieve7
-rw-r--r--pigeonhole/tests/extensions/ihave/restrictions.svtest14
5 files changed, 66 insertions, 0 deletions
diff --git a/pigeonhole/tests/extensions/ihave/errors.svtest b/pigeonhole/tests/extensions/ihave/errors.svtest
new file mode 100644
index 0000000..c6b9750
--- /dev/null
+++ b/pigeonhole/tests/extensions/ihave/errors.svtest
@@ -0,0 +1,19 @@
+require "vnd.dovecot.testsuite";
+
+require "relational";
+require "comparator-i;ascii-numeric";
+
+test "Error command" {
+ if not test_script_compile "errors/error.sieve" {
+ test_fail "compile failed";
+ }
+
+ if test_script_run {
+ test_fail "execution should have failed";
+ }
+
+ if test_error :count "gt" :comparator "i;ascii-numeric" "1" {
+ test_fail "too many runtime errors reported";
+ }
+}
+
diff --git a/pigeonhole/tests/extensions/ihave/errors/error.sieve b/pigeonhole/tests/extensions/ihave/errors/error.sieve
new file mode 100644
index 0000000..8da0fe7
--- /dev/null
+++ b/pigeonhole/tests/extensions/ihave/errors/error.sieve
@@ -0,0 +1,3 @@
+require "ihave";
+
+error "Something failed.";
diff --git a/pigeonhole/tests/extensions/ihave/execute.svtest b/pigeonhole/tests/extensions/ihave/execute.svtest
new file mode 100644
index 0000000..701d817
--- /dev/null
+++ b/pigeonhole/tests/extensions/ihave/execute.svtest
@@ -0,0 +1,23 @@
+require "vnd.dovecot.testsuite";
+
+/*
+ * Execution testing (currently just meant to trigger any segfaults)
+ */
+
+test "Basic" {
+ if not test_script_compile "execute/ihave.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 --git a/pigeonhole/tests/extensions/ihave/execute/ihave.sieve b/pigeonhole/tests/extensions/ihave/execute/ihave.sieve
new file mode 100644
index 0000000..0fe84c8
--- /dev/null
+++ b/pigeonhole/tests/extensions/ihave/execute/ihave.sieve
@@ -0,0 +1,7 @@
+require "ihave";
+
+if ihave "nonsense-extension" {
+ nonsense_command "Frop!";
+}
+
+redirect "frop@example.com";
diff --git a/pigeonhole/tests/extensions/ihave/restrictions.svtest b/pigeonhole/tests/extensions/ihave/restrictions.svtest
new file mode 100644
index 0000000..5dba126
--- /dev/null
+++ b/pigeonhole/tests/extensions/ihave/restrictions.svtest
@@ -0,0 +1,14 @@
+require "vnd.dovecot.testsuite";
+require "ihave";
+
+test "Restricted: encoded-character" {
+ if ihave "encoded-character" {
+ test_fail "encoded-character extension is incompatible with ihave";
+ }
+}
+
+test "Restricted: variables" {
+ if ihave "variables" {
+ test_fail "variables extension is incompatible with ihave";
+ }
+}