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

Imap4flags extension: added tests to verify removeflag behavior.

parent dbcfa2e7
No related branches found
No related tags found
No related merge requests found
......@@ -84,25 +84,153 @@ test "Flag operations" {
}
if hasflag :comparator "i;ascii-numeric" :count "gt" "2" {
test_fail "hasflag sees more than two flags";
}
test_fail "hasflag sees more than two flags";
}
addflag ["C", "D", "E F"];
if not hasflag :comparator "i;ascii-numeric" :count "eq" "6" {
test_fail "hasflag sees more than two flags";
}
test_fail "hasflag sees more than two flags";
}
removeflag ["D"];
if not hasflag :comparator "i;ascii-numeric" :count "eq" "5" {
test_fail "hasflag sees more than two flags";
}
test_fail "hasflag sees more than two flags";
}
if hasflag "D" {
test_fail "removed flag still present";
}
}
test "Removal: one" {
setflag "\\seen";
if not hasflag "\\seen" {
test_fail "hasflag misses set flag";
}
removeflag "\\seen";
if hasflag "\\seen" {
test_fail "flag not removed";
}
if not hasflag :comparator "i;ascii-numeric" :count "eq" "0" {
test_fail "flags are still set";
}
}
test "Removal: first" {
setflag "$frop \\seen";
if not allof ( hasflag "\\seen", hasflag "$frop" ) {
test_fail "hasflag misses set flags";
}
removeflag "$frop";
if not hasflag "\\seen" {
test_fail "wrong flag removed";
}
if hasflag "$frop" {
test_fail "flag not removed";
}
if not hasflag :comparator "i;ascii-numeric" :count "eq" "1" {
test_fail "more than one flag remains set";
}
}
test "Removal: last" {
setflag "\\seen $friep";
if not allof ( hasflag "\\seen", hasflag "$friep" ) {
test_fail "hasflag misses set flags";
}
removeflag "$friep";
if not hasflag "\\seen" {
test_fail "wrong flag removed";
}
if hasflag "$friep" {
test_fail "flag not removed";
}
if not hasflag :comparator "i;ascii-numeric" :count "eq" "1" {
test_fail "more than one flag remains set";
}
}
test "Removal: middle" {
setflag "\\seen $friep \\flagged";
if not allof ( hasflag "\\flagged", hasflag "\\seen", hasflag "$friep" ) {
test_fail "hasflag misses set flags";
}
removeflag "$friep";
if not allof ( hasflag "\\seen", hasflag "\\flagged" ) {
test_fail "wrong flag removed";
}
if hasflag "$friep" {
test_fail "flag not removed";
}
if not hasflag :comparator "i;ascii-numeric" :count "eq" "2" {
test_fail "more than two flags remain set";
}
}
test "Removal: duplicates" {
setflag "\\seen $friep $friep \\flagged $friep";
if not allof ( hasflag "\\flagged", hasflag "\\seen", hasflag "$friep" ) {
test_fail "hasflag misses set flags";
}
removeflag "$friep";
if not allof ( hasflag "\\seen", hasflag "\\flagged" ) {
test_fail "wrong flag removed";
}
if hasflag "$friep" {
test_fail "flag not removed";
}
if not hasflag :comparator "i;ascii-numeric" :count "eq" "2" {
test_fail "more than two flags remain set";
}
}
test "Removal: whitespace" {
setflag " \\seen $friep $friep \\flagged $friep ";
if not allof ( hasflag "\\flagged", hasflag "\\seen", hasflag "$friep" ) {
test_fail "hasflag misses set flags";
}
removeflag "$friep";
if not allof ( hasflag "\\seen", hasflag "\\flagged" ) {
test_fail "wrong flag removed";
}
if hasflag "$friep" {
test_fail "flag not removed";
}
if not hasflag :comparator "i;ascii-numeric" :count "eq" "2" {
test_fail "more than two flags remain set";
}
}
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.