1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
require "vnd.dovecot.testsuite";
require "date";
require "variables";
require "relational";
test_set "message" text:
From: stephan@rename-it.nl
To: sirius@drunksnipers.com
Subject: Frop!
Date: Mon, 20 Jul 2009 21:44:43 +0300
Delivery-Date: Mon, 22 Jul 2009 23:30:14 +0300
Invalid-Date: Moo, 34 Juul 3060 25:30:42 +6600
Wanna date?
.
;
test "Defaults" {
if not date :originalzone "date" "std11" "mon, 20 jul 2009 21:44:43 +0300" {
test_fail "default comparator is not i;ascii-casemap";
}
if anyof ( date "date" "std11" "Mon", date "date" "std11" "*") {
test_fail "default match type appears to be :contains or :matches";
}
}
test "Count" {
if not date :count "eq" "date" "date" "1" {
test_fail "count of existing date header field is not 1";
}
if not date :count "eq" "resent-date" "date" "0" {
test_fail "count of non-existent date header field is not 0";
}
}
test "Invalid" {
if date :matches "invalid-date" "std11" "*" {
test_fail "matched invalid date: ${0}";
}
}
|