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

tests: extensions: metadata: Add tests for bad UTF-8 in mailbox names.

parent f87ddf2b
No related branches found
No related tags found
No related merge requests found
...@@ -16,3 +16,41 @@ test "Invalid Syntax" { ...@@ -16,3 +16,41 @@ test "Invalid Syntax" {
test_fail "wrong number of errors reported"; test_fail "wrong number of errors reported";
} }
} }
/*
* Metadataexists - bad UTF-8 in mailbox name
*/
test "Metadataexists - bad UTF-8 in mailbox name" {
if not test_script_compile "errors/metadataexists-bad-utf8.sieve" {
test_fail "compile failed";
}
if not test_script_run {
test_fail "execution failed";
}
# FIXME: check warnings
if not test_error :count "eq" :comparator "i;ascii-numeric" "0" {
test_fail "wrong number of runtime errors reported";
}
}
/*
* Metadata - bad UTF-8 in mailbox name
*/
test "Metadata - bad UTF-8 in mailbox name" {
if not test_script_compile "errors/metadata-bad-utf8.sieve" {
test_fail "compile failed";
}
if not test_script_run {
test_fail "execution failed";
}
# FIXME: check warnings
if not test_error :count "eq" :comparator "i;ascii-numeric" "0" {
test_fail "wrong number of runtime errors reported";
}
}
require "mboxmetadata";
require "variables";
require "encoded-character";
set "mailbox" "${hex:ff}rop";
if metadata "${mailbox}" "/private/frop" "friep" {
keep;
}
require "mboxmetadata";
require "variables";
require "encoded-character";
set "mailbox" "${hex:ff}rop";
if metadataexists "${mailbox}" ["/private/frop", "/shared/friep"] {
keep;
}
require "mboxmetadata"; require "mboxmetadata";
require "servermetadata"; require "servermetadata";
require "encoded-character";
# 1-4: Used as a command # 1-4: Used as a command
metadata; metadata;
...@@ -13,36 +14,40 @@ if metadataexists {} ...@@ -13,36 +14,40 @@ if metadataexists {}
if servermetadata {} if servermetadata {}
if servermetadataexists {} if servermetadataexists {}
# 9-10: Used with one string argument # 9-11: Used with one string argument
if metadata "frop" { } if metadata "frop" { }
if servermetadata "frop" { } if servermetadata "frop" { }
if metadataexists "frop" { } if metadataexists "frop" { }
# Used with one number argument # 12-15: Used with one number argument
if metadata 13123123 { } if metadata 13123123 { }
if servermetadata 123123 { } if servermetadata 123123 { }
if metadataexists 123123 { } if metadataexists 123123 { }
if servermetadataexists 123123 {} if servermetadataexists 123123 {}
# Used with one string list argument # 16-18: Used with one string list argument
if metadata ["frop"] { } if metadata ["frop"] { }
if servermetadata ["frop"] { } if servermetadata ["frop"] { }
if metadataexists ["frop"] { } if metadataexists ["frop"] { }
# Used with unknown tag # 19-22: Used with unknown tag
if metadata :frop "frop" { } if metadata :frop "frop" { }
if servermetadata :frop "frop" { } if servermetadata :frop "frop" { }
if metadataexists :frop "frop" { } if metadataexists :frop "frop" { }
if servermetadataexists :frop "frop" {} if servermetadataexists :frop "frop" {}
# Invalid arguments # 23-26: Invalid arguments
if metadata "/private/frop" "friep" {} if metadata "/private/frop" "friep" {}
if servermetadata "INBOX" "/private/frop" "friep" {} if servermetadata "INBOX" "/private/frop" "friep" {}
if metadataexists 23 "/private/frop" {} if metadataexists 23 "/private/frop" {}
if servermetadataexists "INBOX" "/private/frop" {} if servermetadataexists "INBOX" "/private/frop" {}
# Invalid annotations # W1-W4: Invalid annotations
if metadata "INBOX" "frop" "friep" {} if metadata "INBOX" "frop" "friep" {}
if servermetadata "frop" "friep" {} if servermetadata "frop" "friep" {}
if metadataexists "INBOX" ["/private/frop", "/friep"] { } if metadataexists "INBOX" ["/private/frop", "/friep"] { }
if servermetadataexists ["/private/frop", "/friep", "/private/friep"] { } if servermetadataexists ["/private/frop", "/friep", "/private/friep"] { }
# W5-W6: Invalid mailbox name
if metadata "${hex:ff}rop" "/private/frop" "friep" {}
if metadataexists "${hex:ff}rop" ["/private/frop", "/shared/friep"] { }
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.