1
require "vnd.dovecot.testsuite";
3
require "comparator-i;ascii-numeric";
7
test_set "message" text:
8
From: stephan@rename-it.nl
10
Subject: Test message.
20
* 'The body test matches content in the body of an email message, that
21
* is, anything following the first empty line after the header. (The
22
* empty line itself, if present, is not considered to be part of the
25
test "The empty line" {
27
if not body :raw :is text:
32
test_fail "invalid message body extracted (1)";
35
if body :raw :is text:
41
test_fail "invalid message body extracted (2)";
44
if body :raw :is "Test"
46
test_fail "body test matches nonsense (3)";
50
/* Default comparator and match type
53
* 'The COMPARATOR and MATCH-TYPE keyword parameters are defined in
54
* [SIEVE]. As specified in Sections 2.7.1 and 2.7.3 of [SIEVE], the
55
* default COMPARATOR is "i;ascii-casemap" and the default MATCH-TYPE is
60
if anyof ( body :raw "Test", body :raw "*Test*" ) {
61
test_fail "default match type is not :is as is required";
64
if allof( not body :raw :contains "tesT", body :raw :contains "Test" ) {
65
test_fail "default comparator is not i;ascii-casemap as is required";
72
* 'If a message consists of a header only, not followed by an empty line,
73
* then that set is empty and all "body" tests return false, including
74
* those that test for an empty string. (This is similar to how the
75
* "header" test always fails when the named header fields aren't present.)'
78
test_set "message" text:
79
From: stephan@rename-it.nl
81
Subject: No body is here!
86
if body :raw :contains "" {
87
test_fail "matched against non-existant body (:contains \"\")";
91
test_fail "matched against non-existant body (:is \"\")";
94
if body :raw :matches "*" {
95
test_fail "matched against non-existant body (:matches \"*\")";