diff --git a/Makefile.am b/Makefile.am index 2331e532af581502d606ca4c4ea12720b5efe09c..128ea65443dc2af3667a07d5b0bfaa874a285ac3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -106,6 +106,7 @@ test_cases = \ tests/extensions/imap4flags/flagstring.svtest \ tests/extensions/imap4flags/flagstore.svtest \ tests/extensions/body/basic.svtest \ + tests/extensions/body/errors.svtest \ tests/extensions/body/raw.svtest \ tests/extensions/body/content.svtest \ tests/extensions/body/match-values.svtest \ diff --git a/tests/extensions/body/errors.svtest b/tests/extensions/body/errors.svtest new file mode 100644 index 0000000000000000000000000000000000000000..8db5657bf8d15b7309eef2f851e1d2da98848d31 --- /dev/null +++ b/tests/extensions/body/errors.svtest @@ -0,0 +1,19 @@ +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" "12" { + test_fail "wrong number of errors reported"; + } +} + diff --git a/tests/extensions/body/errors/syntax.sieve b/tests/extensions/body/errors/syntax.sieve new file mode 100644 index 0000000000000000000000000000000000000000..8adf0efd6ee1138102de31d7c5159aeea50f9715 --- /dev/null +++ b/tests/extensions/body/errors/syntax.sieve @@ -0,0 +1,38 @@ +require "body"; + +# 1: No key list +if body { } + +# 2: Number +if body 3 { } + +# OK: String +if body "frop" { } + +# 3: To many arguments +if body "frop" "friep" { } + +# 4: Unknown tag +if body :frop { } + +# 5: Unknown tag with valid key +if body :friep "frop" { } + +# 6: Content without argument +if body :content { } + +# 7: Content without key argument +if body :content "frop" { } + +# 8: Content with number argument +if body :content 3 "frop" { } + +# 9: Content with unknown tag +if body :content :frml "frop" { } + +# 10: Content with known tag +if body :content :contains "frop" { } + +# 11: Duplicate transform +if body :content "frop" :raw "frop" { } +