diff --git a/Makefile.am b/Makefile.am index 06b7be87494914419c4777c9d307c4b67760df5f..d024778fb401f344da0ad39864121bbaada7d5a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,7 +50,8 @@ test_cases = \ tests/extensions/subaddress/rfc.svtest \ tests/compile/compile.svtest \ tests/compile/examples.svtest \ - tests/compile/errors.svtest + tests/compile/errors.svtest \ + tests/execute/errors.svtest $(test_cases): @$(TESTSUITE_BIN) $@ diff --git a/tests/execute/errors.svtest b/tests/execute/errors.svtest new file mode 100644 index 0000000000000000000000000000000000000000..196d5fb9792b31511af575c886e239963c4847eb --- /dev/null +++ b/tests/execute/errors.svtest @@ -0,0 +1,46 @@ +require "vnd.dovecot.testsuite"; + +require "relational"; +require "comparator-i;ascii-numeric"; + +test "Action conflicts: reject <-> fileinto" { + if not test_compile "errors/conflict-reject-fileinto.sieve" { + test_fail "compile failed"; + } + + if test_execute { + test_fail "execution should have failed"; + } + + if test_error :count "gt" :comparator "i;ascii-numeric" "1" { + test_fail "too many runtime errors reported"; + } +} + +test "Action conflicts: reject <-> keep" { + if not test_compile "errors/conflict-reject-keep.sieve" { + test_fail "compile failed"; + } + + if test_execute { + test_fail "execution should have failed"; + } + + if test_error :count "gt" :comparator "i;ascii-numeric" "1" { + test_fail "too many runtime errors reported"; + } +} + +test "Action conflicts: reject <-> redirect" { + if not test_compile "errors/conflict-reject-redirect.sieve" { + test_fail "compile failed"; + } + + if test_execute { + 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/tests/execute/errors/action-conflicts.sieve b/tests/execute/errors/conflict-reject-fileinto.sieve similarity index 50% rename from tests/execute/errors/action-conflicts.sieve rename to tests/execute/errors/conflict-reject-fileinto.sieve index 082bdf780f6fad9641ac1d1c5d79059a730832a9..85ef139b0afb9d7cbea383c746e759cc961b138d 100644 --- a/tests/execute/errors/action-conflicts.sieve +++ b/tests/execute/errors/conflict-reject-fileinto.sieve @@ -1,5 +1,5 @@ require "reject"; -require "vacation"; +require "fileinto"; reject "No nonsense in my mailbox."; -vacation "I am gone for a while."; +fileinto "Spam"; diff --git a/tests/execute/errors/conflict-reject-keep.sieve b/tests/execute/errors/conflict-reject-keep.sieve new file mode 100644 index 0000000000000000000000000000000000000000..569a4acf0149af569748ef94e420207d0da29278 --- /dev/null +++ b/tests/execute/errors/conflict-reject-keep.sieve @@ -0,0 +1,4 @@ +require "reject"; + +reject "I am not interested in your nonsense."; +keep; diff --git a/tests/execute/errors/conflict-reject-redirect.sieve b/tests/execute/errors/conflict-reject-redirect.sieve new file mode 100644 index 0000000000000000000000000000000000000000..d0122698268d4678748973727280f56da18a94ac --- /dev/null +++ b/tests/execute/errors/conflict-reject-redirect.sieve @@ -0,0 +1,4 @@ +require "reject"; + +reject "I am not interested in your nonsense."; +redirect "frop@example.com";