Skip to content
Snippets Groups Projects
Commit 896a84a7 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

testsuite: editheader extension: added error tests for header field name verification.

parent 69c22fa4
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,7 @@ test_cases = \
tests/extensions/editheader/deleteheader.svtest \
tests/extensions/editheader/alternating.svtest \
tests/extensions/editheader/utf8.svtest \
tests/extensions/editheader/errors.svtest \
tests/extensions/vnd.dovecot/debug/execute.svtest \
tests/deprecated/notify/basic.svtest \
tests/deprecated/notify/mailto.svtest \
......
require "vnd.dovecot.testsuite";
require "comparator-i;ascii-numeric";
require "relational";
require "editheader";
test "Invalid field-name" {
if test_script_compile "errors/field-name.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";
}
if not test_error :index 1 :matches "*field name*X-field:*invalid" {
test_fail "wrong error reported";
}
if not test_error :index 2 :matches "*field name*X field*invalid" {
test_fail "wrong error reported";
}
if not test_error :index 3 :matches "*field name*X-field:*invalid" {
test_fail "wrong error reported";
}
if not test_error :index 4 :matches "*field name*X field*invalid" {
test_fail "wrong error reported";
}
}
test "Invalid field-name at runtime " {
if not test_script_compile "errors/field-name-runtime.sieve" {
test_fail "compile failed";
}
if test_script_run {
test_fail "run should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "1" {
test_fail "wrong number of errors reported";
}
if not test_error :matches "*field name*X-field:*invalid" {
test_fail "wrong error reported";
}
}
require "editheader";
require "variables";
set "header" "X-field:";
addheader "${header}" "Frop";
require "editheader";
# Ok
addheader "X-field" "Frop";
# Invalid ':'
addheader "X-field:" "Frop";
# Invalid ' '
addheader "X field" "Frop";
# Ok
deleteheader "X-field";
# Invalid ':'
deleteheader "X-field:";
# Invalid ' '
deleteheader "X field";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.