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

testsuite: editheader: added command syntax checks.

parent be2eed8c
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,6 @@ Current activities: ...@@ -2,7 +2,6 @@ Current activities:
* Implement editheader extension * Implement editheader extension
- Implement configurable limit on header value length - Implement configurable limit on header value length
- Add command syntax checks to the test suite.
Parallel plugin-based efforts: Parallel plugin-based efforts:
......
...@@ -66,6 +66,16 @@ test "Invalid field value" { ...@@ -66,6 +66,16 @@ test "Invalid field value" {
} }
} }
test "Invalid field value (FIXME: count only)" {
if test_script_compile "errors/command-syntax.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "10" {
test_fail "wrong number of errors reported";
}
}
test_set "message" text: test_set "message" text:
From: stephan@example.com From: stephan@example.com
To: tss@example.com To: tss@example.com
......
require "editheader";
/* "addheader" [":last"] <field-name: string> <value: string>
*/
# 1: missing field name and value
addheader;
# 2: missing value
addheader "x-frop";
# 3: value not a string; number
addheader "x-frop" 2;
# 4: value not a string; list
addheader "x-frop" ["frop"];
# 5: strange tag
addheader :tag "x-frop" "frop";
/* "deleteheader" [":index" <fieldno: number> [":last"]]
* [COMPARATOR] [MATCH-TYPE]
* <field-name: string>
* [<value-patterns: string-list>]
*/
# 6: missing field name
deleteheader;
# 7: :last tag without index
deleteheader :last "x-frop";
# 8: :index tag with string argument
deleteheader :index "frop" "x-frop";
# OK: match type without value patterns
deleteheader :matches "x-frop";
# 9: value patterns not a string(list)
deleteheader "x-frop" 1;
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.