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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
require "vnd.dovecot.testsuite";
require "index";
require "date";
require "variables";
require "subaddress";
test_set "message" text:
To: first@friep.example.com
X-A: First
Received: from mx.example.com (127.0.0.13) by mx.example.org
(127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
Wed, 12 Nov 2014 18:18:31 +0100
To: second@friep.example.com
From: stephan@example.org
Received: from mx.example.com (127.0.0.13) by mx.example.org
(127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
Wed, 12 Nov 2014 18:18:30 +0100
X-A: Second
To: third@friep.example.com
X-A: Third
Received: from mx.example.com (127.0.0.13) by mx.example.org
(127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
Wed, 12 Nov 2014 18:18:29 +0100
Subject: Frop!
X-A: Fourth
To: fourth@friep.example.com
Received: from mx.example.com (127.0.0.13) by mx.example.org
(127.0.0.12) with Macrosoft SMTP Server (TLS) id 1.2.3.4;
Wed, 12 Nov 2014 18:18:28 +0100
Frop
.
;
test "Header :index" {
if not header :index 3 "x-a" "Third" {
test_fail "wrong header retrieved";
}
if header :index 3 "x-a" ["First", "Second", "Fourth"] {
test_fail "other header retrieved";
}
}
test "Header :index :last" {
if not header :index 3 :last "x-a" "Second" {
test_fail "wrong header retrieved";
}
if header :index 3 :last "x-a" ["First", "Third", "Fourth"] {
test_fail "other header retrieved";
}
}
test "Address :index" {
if not address :localpart :index 2 "to" "second" {
test_fail "wrong header retrieved";
}
if address :localpart :index 2 "to" ["first", "third", "fourth"] {
test_fail "other header retrieved";
}
}
test "Address :index :last" {
if not address :localpart :index 2 :last "to" "third" {
test_fail "wrong header retrieved";
}
if address :localpart :index 2 :last "to" ["first", "second", "fourth"] {
test_fail "other header retrieved";
}
}
test "Date :index" {
if not date :index 1 "received" "second" "31" {
test_fail "wrong header retrieved";
}
if date :index 1 "received" "second" ["30", "29", "28"] {
test_fail "other header retrieved";
}
}
test "Date :index :last" {
if not date :index 1 :last "received" "second" "28"{
test_fail "wrong header retrieved";
}
if date :index 1 :last "received" "second" ["31", "30", "29"] {
test_fail "other header retrieved";
}
}
|