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/compile/recover | |
parent | Initial commit. (diff) | |
download | dovecot-upstream.tar.xz dovecot-upstream.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 '')
4 files changed, 110 insertions, 0 deletions
diff --git a/pigeonhole/tests/compile/recover.svtest b/pigeonhole/tests/compile/recover.svtest new file mode 100644 index 0000000..9c24c11 --- /dev/null +++ b/pigeonhole/tests/compile/recover.svtest @@ -0,0 +1,50 @@ +require "vnd.dovecot.testsuite"; + +require "relational"; +require "comparator-i;ascii-numeric"; + +/* + * Test parser's recover capability + */ + +/* + * Commands + */ + +/* Missing semicolon */ + +test "Missing semicolons" { + if test_script_compile "recover/commands-semicolon.sieve" { + test_fail "compile should have failed."; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "3" { + test_fail "wrong number of errors reported"; + } +} + +/* End of block recovery*/ + +test "Missing semicolon at end of block" { + if test_script_compile "recover/commands-endblock.sieve" { + test_fail "compile should have failed."; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "4" { + test_fail "wrong number of errors reported"; + } +} + +/* + * Tests + */ + +test "Spurious comma at end of test list" { + if test_script_compile "recover/tests-endcomma.sieve" { + test_fail "compile should have failed."; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "3" { + test_fail "wrong number of errors reported"; + } +} diff --git a/pigeonhole/tests/compile/recover/commands-endblock.sieve b/pigeonhole/tests/compile/recover/commands-endblock.sieve new file mode 100644 index 0000000..c06e218 --- /dev/null +++ b/pigeonhole/tests/compile/recover/commands-endblock.sieve @@ -0,0 +1,27 @@ +if true { + if true { + # Missing semicolon + keep + } +} + +if true { + # Erroneous syntax + keep, + keep +} + +if true { + if anyof(true,true,false) { + keep; + } +} + +if true { + if anyof(true,true,false) { + keep; + # Missing semicolon + discard + } +} + diff --git a/pigeonhole/tests/compile/recover/commands-semicolon.sieve b/pigeonhole/tests/compile/recover/commands-semicolon.sieve new file mode 100644 index 0000000..effb389 --- /dev/null +++ b/pigeonhole/tests/compile/recover/commands-semicolon.sieve @@ -0,0 +1,16 @@ + +keep; + +discard; + +# Missing semicolon +keep + +redirect "frop@nl.example.com"; + +discard; + +# Missing semicolon +keep + +redirect "frml@nl.example.com"; diff --git a/pigeonhole/tests/compile/recover/tests-endcomma.sieve b/pigeonhole/tests/compile/recover/tests-endcomma.sieve new file mode 100644 index 0000000..54c93ec --- /dev/null +++ b/pigeonhole/tests/compile/recover/tests-endcomma.sieve @@ -0,0 +1,17 @@ +if true { + if true { + # Spurious comma + if anyof(true,true,true,) { + } + } +} + +if true { + if anyof(true,true) { + # Spurious comma + if anyof(true,true,true,) { + if anyof(true,true,true) { + } + } + } +} |