diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /pigeonhole/tests/multiscript | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pigeonhole/tests/multiscript')
-rw-r--r-- | pigeonhole/tests/multiscript/basic.svtest | 91 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/conflicts.svtest | 100 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/fileinto-frop.sieve | 3 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/fileinto-inbox.sieve | 4 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/keep.sieve | 1 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/notify.sieve | 3 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/reject-1.sieve | 3 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/reject-2.sieve | 3 | ||||
-rw-r--r-- | pigeonhole/tests/multiscript/vacation.sieve | 3 |
9 files changed, 211 insertions, 0 deletions
diff --git a/pigeonhole/tests/multiscript/basic.svtest b/pigeonhole/tests/multiscript/basic.svtest new file mode 100644 index 0000000..ce9bb66 --- /dev/null +++ b/pigeonhole/tests/multiscript/basic.svtest @@ -0,0 +1,91 @@ +require "vnd.dovecot.testsuite"; + +test_set "message" text: +From: stephan@example.org +Message-ID: <frop33333333333333333@frutsens.example.nl> +To: nico@frop.example.org +Subject: Frop. + +Friep. +. +; + +test "Append" { + if not allof ( + test_script_compile "fileinto-inbox.sieve", + test_script_run ){ + test_fail "failed to compile and run first script"; + } + + if not allof ( + test_script_compile "vacation.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run second script"; + } + + if not allof ( + test_script_compile "notify.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run third script"; + } + + if not test_result_action :index 1 "store" { + test_fail "first action is not 'store'"; + } + + if not test_result_action :index 2 "vacation" { + test_fail "second action is not 'vacation'"; + } + + if not test_result_action :index 3 "notify" { + test_fail "third action is not 'notify'"; + } + + if not test_result_execute { + test_fail "result execute failed"; + } +} + +test "Sequential Execute" { + if not allof ( + test_script_compile "fileinto-inbox.sieve", + test_script_run ) { + test_fail "failed to compile and run first script"; + } + + if not test_result_execute { + test_fail "result execute failed after first script"; + } + + if not allof ( + test_script_compile "vacation.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run second script"; + } + + if not test_result_execute { + test_fail "result execute failed after second script"; + } + + if not allof ( + test_script_compile "notify.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run third script"; + } + + if not test_result_execute { + test_fail "result execute failed after third script"; + } + + if not test_result_action :index 1 "store" { + test_fail "first action is not 'store'"; + } + + if not test_result_action :index 2 "vacation" { + test_fail "second action is not 'vacation'"; + } + + if not test_result_action :index 3 "notify" { + test_fail "third action is not 'notify'"; + } +} diff --git a/pigeonhole/tests/multiscript/conflicts.svtest b/pigeonhole/tests/multiscript/conflicts.svtest new file mode 100644 index 0000000..a2b8fab --- /dev/null +++ b/pigeonhole/tests/multiscript/conflicts.svtest @@ -0,0 +1,100 @@ +require "vnd.dovecot.testsuite"; + +test_set "message" text: +From: stephan@example.org +Message-ID: <frop33333333333333333@nl.example.com> +To: nico@frop.example.org +Subject: Frop. + +Friep. +. +; + +test "Graceful Conflicts" { + if not allof ( + test_script_compile "fileinto-inbox.sieve", + test_script_run ){ + test_fail "failed to compile and run first script"; + } + + if not test_result_execute { + test_fail "result execute failed after first script"; + } + + if not allof ( + test_script_compile "reject-1.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run second script"; + } + + if not test_result_execute { + test_fail "result execute failed after second script"; + } + + if not allof ( + test_script_compile "reject-2.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run third script"; + } + + if not test_result_execute { + test_fail "result execute failed after third script"; + } + + if not test_result_action :index 1 "store" { + test_result_print; + test_fail "first action is not 'store'"; + } + + if not test_result_action :index 2 "reject" { + test_result_print; + test_fail "first reject action not retained"; + } + + if test_result_action :index 3 "reject" { + test_result_print; + test_fail "second reject action not discarded"; + } + +} + +test "Duplicates" { + if not allof ( + test_script_compile "fileinto-inbox.sieve", + test_script_run ){ + test_fail "failed to compile and run first script"; + } + + if not test_result_execute { + test_fail "result execute failed after first script"; + } + + if not allof ( + test_script_compile "fileinto-inbox.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run second script"; + } + + if not test_result_execute { + test_fail "result execute failed after second script"; + } + + if not allof ( + test_script_compile "keep.sieve", + test_script_run :append_result ) { + test_fail "failed to compile and run third script"; + } + + if not test_result_execute { + test_fail "result execute failed after third script"; + } + + if not test_result_action :index 1 "keep" { + test_fail "first action is not 'keep'"; + } + + if test_result_action :index 2 "store" { + test_fail "fileinto action not discarded"; + } +} + diff --git a/pigeonhole/tests/multiscript/fileinto-frop.sieve b/pigeonhole/tests/multiscript/fileinto-frop.sieve new file mode 100644 index 0000000..9aafb95 --- /dev/null +++ b/pigeonhole/tests/multiscript/fileinto-frop.sieve @@ -0,0 +1,3 @@ +require "fileinto"; + +fileinto "frop"; diff --git a/pigeonhole/tests/multiscript/fileinto-inbox.sieve b/pigeonhole/tests/multiscript/fileinto-inbox.sieve new file mode 100644 index 0000000..b5da850 --- /dev/null +++ b/pigeonhole/tests/multiscript/fileinto-inbox.sieve @@ -0,0 +1,4 @@ +require "fileinto"; + +fileinto "INBOX"; + diff --git a/pigeonhole/tests/multiscript/keep.sieve b/pigeonhole/tests/multiscript/keep.sieve new file mode 100644 index 0000000..6203a21 --- /dev/null +++ b/pigeonhole/tests/multiscript/keep.sieve @@ -0,0 +1 @@ +keep; diff --git a/pigeonhole/tests/multiscript/notify.sieve b/pigeonhole/tests/multiscript/notify.sieve new file mode 100644 index 0000000..af47ad9 --- /dev/null +++ b/pigeonhole/tests/multiscript/notify.sieve @@ -0,0 +1,3 @@ +require "enotify"; + +notify "mailto:stephan@example.org"; diff --git a/pigeonhole/tests/multiscript/reject-1.sieve b/pigeonhole/tests/multiscript/reject-1.sieve new file mode 100644 index 0000000..06744f6 --- /dev/null +++ b/pigeonhole/tests/multiscript/reject-1.sieve @@ -0,0 +1,3 @@ +require "reject"; + +reject "Message is not wanted."; diff --git a/pigeonhole/tests/multiscript/reject-2.sieve b/pigeonhole/tests/multiscript/reject-2.sieve new file mode 100644 index 0000000..96b7564 --- /dev/null +++ b/pigeonhole/tests/multiscript/reject-2.sieve @@ -0,0 +1,3 @@ +require "reject"; + +reject "Will not accept this nonsense."; diff --git a/pigeonhole/tests/multiscript/vacation.sieve b/pigeonhole/tests/multiscript/vacation.sieve new file mode 100644 index 0000000..d735da5 --- /dev/null +++ b/pigeonhole/tests/multiscript/vacation.sieve @@ -0,0 +1,3 @@ +require "vacation"; + +vacation "I am not home"; |