diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:36:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:36:47 +0000 |
commit | 0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch) | |
tree | 3f3789daa2f6db22da6e55e92bee0062a7d613fe /pigeonhole/tests/extensions/duplicate | |
parent | Initial commit. (diff) | |
download | dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip |
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pigeonhole/tests/extensions/duplicate')
7 files changed, 196 insertions, 0 deletions
diff --git a/pigeonhole/tests/extensions/duplicate/errors.svtest b/pigeonhole/tests/extensions/duplicate/errors.svtest new file mode 100644 index 0000000..108a0f0 --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/errors.svtest @@ -0,0 +1,54 @@ +require "vnd.dovecot.testsuite"; + +require "relational"; +require "comparator-i;ascii-numeric"; + +/* + * Invalid syntax + */ + +test "Invalid Syntax" { + if test_script_compile "errors/syntax.sieve" { + test_fail "compile should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "17" { + test_fail "wrong number of errors reported"; + } +} + +test "Invalid Syntax (vnd)" { + if test_script_compile "errors/syntax-vnd.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"; + } +} + +/* + * Extension conflict + */ + +test "Extension conflict" { + if test_script_compile "errors/conflict.sieve" { + test_fail "compile should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "2" { + test_fail "wrong number of errors reported"; + } +} + +test "Extension conflict (vnd first)" { + if test_script_compile "errors/conflict-vnd.sieve" { + test_fail "compile should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "2" { + test_fail "wrong number of errors reported"; + } +} + + diff --git a/pigeonhole/tests/extensions/duplicate/errors/conflict-vnd.sieve b/pigeonhole/tests/extensions/duplicate/errors/conflict-vnd.sieve new file mode 100644 index 0000000..1c133df --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/errors/conflict-vnd.sieve @@ -0,0 +1,4 @@ +require "vnd.dovecot.duplicate"; +require "duplicate"; + +if duplicate { keep; } diff --git a/pigeonhole/tests/extensions/duplicate/errors/conflict.sieve b/pigeonhole/tests/extensions/duplicate/errors/conflict.sieve new file mode 100644 index 0000000..aa9b038 --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/errors/conflict.sieve @@ -0,0 +1,4 @@ +require "duplicate"; +require "vnd.dovecot.duplicate"; + +if duplicate { keep; } diff --git a/pigeonhole/tests/extensions/duplicate/errors/syntax-vnd.sieve b/pigeonhole/tests/extensions/duplicate/errors/syntax-vnd.sieve new file mode 100644 index 0000000..f62aa2c --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/errors/syntax-vnd.sieve @@ -0,0 +1,19 @@ +require "vnd.dovecot.duplicate"; + +# Used as a command +duplicate; + +# Used with no argument (not an error) +if duplicate {} + +# Used with string argument +if duplicate "frop" { } + +# Used with numer argument +if duplicate 23423 { } + +# Used with numer argument +if duplicate ["frop"] { } + + + diff --git a/pigeonhole/tests/extensions/duplicate/errors/syntax.sieve b/pigeonhole/tests/extensions/duplicate/errors/syntax.sieve new file mode 100644 index 0000000..a561cfb --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/errors/syntax.sieve @@ -0,0 +1,54 @@ +require "duplicate"; + +# Used as a command +duplicate; + +# Used with no argument (not an error) +if duplicate {} + +# Used with string argument +if duplicate "frop" { } + +# Used with numner argument +if duplicate 23423 { } + +# Used with numer argument +if duplicate ["frop"] { } + +# Used with unknown tag +if duplicate :test "frop" { } + +# Bad :header parameter +if duplicate :header 23 {} + +# Bad :uniqueid parameter +if duplicate :uniqueid 23 {} + +# Bad :handle parameter +if duplicate :handle ["a", "b", "c"] {} + +# Bad seconds parameter +if duplicate :seconds "a" {} + +# Missing :header parameter +if duplicate :header {} + +# Missing :uniqueid parameter +if duplicate :uniqueid {} + +# Missing :handle parameter +if duplicate :handle {} + +# Missing seconds parameter +if duplicate :seconds {} + +# :last with a parameter +if duplicate :last "frop" {} + +# :last as :seconds parameter +if duplicate :seconds :last {} + +# Conflicting tags +if duplicate :header "X-Frop" :uniqueid "FROP!" { } + + diff --git a/pigeonhole/tests/extensions/duplicate/execute-vnd.svtest b/pigeonhole/tests/extensions/duplicate/execute-vnd.svtest new file mode 100644 index 0000000..386550f --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/execute-vnd.svtest @@ -0,0 +1,20 @@ +require "vnd.dovecot.testsuite"; +require "vnd.dovecot.duplicate"; + +test "Run" { + if duplicate { + test_fail "test erroneously reported a duplicate"; + } + + if duplicate :handle "handle" { + test_fail "test with name erroneously reported a duplicate"; + } + + if duplicate { + test_fail "test erroneously reported a duplicate"; + } + + if duplicate :handle "handle" { + test_fail "test with name erroneously reported a duplicate"; + } +} diff --git a/pigeonhole/tests/extensions/duplicate/execute.svtest b/pigeonhole/tests/extensions/duplicate/execute.svtest new file mode 100644 index 0000000..9e060ff --- /dev/null +++ b/pigeonhole/tests/extensions/duplicate/execute.svtest @@ -0,0 +1,41 @@ +require "vnd.dovecot.testsuite"; +require "duplicate"; + +# Simple execution tests; no duplicate verification can be tested yet. +test "Run" { + if duplicate { + test_fail "test erroneously reported a duplicate"; + } + + if duplicate :handle "handle" { + test_fail "test with :handle erroneously reported a duplicate"; + } + + if duplicate { + test_fail "test erroneously reported a duplicate"; + } + + if duplicate :handle "handle" { + test_fail "test with :handle erroneously reported a duplicate"; + } + + if duplicate :header "X-frop" { + test_fail "test with :header erroneously reported a duplicate"; + } + + if duplicate :uniqueid "FROP!" { + test_fail "test with :uniqueid erroneously reported a duplicate"; + } + + if duplicate :seconds 90 { + test_fail "test with :seconds erroneously reported a duplicate"; + } + + if duplicate :seconds 90 :last { + test_fail "test with :seconds :last erroneously reported a duplicate"; + } + + if duplicate :last { + test_fail "test with :seconds :last erroneously reported a duplicate"; + } +} |