summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/compile/errors/address.sieve
blob: f7d3b260f8709ab9ecae16369984894248cf34c3 (plain)
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
require "comparator-i;ascii-numeric";

/*
 * Address test errors
 *
 * Total count: 8 (+1 = 9)
 */

/*
 * Command structure
 */

# Invalid tag
if address :nonsense :comparator "i;ascii-casemap" :localpart "From" "nico" {
	discard;
}

# Invalid first argument
if address :is :comparator "i;ascii-numeric" :localpart 45 "nico" {
	discard;
}

# Invalid second argument
if address :is :comparator "i;ascii-numeric" :localpart "From" 45 {
	discard;
}

# Invalid second argument
if address :comparator "i;ascii-numeric" :localpart "From" :is {
	discard;
}

# Missing second argument
if address :is :comparator "i;ascii-numeric" :localpart "From" {
	discard;
}

# Missing arguments
if address :is :comparator "i;ascii-numeric" :localpart {
	discard;
}

# Not an error
if address :localpart :is :comparator "i;ascii-casemap" "from" ["frop", "frop"] {
	discard;
}

/*
 * Specified headers must contain addresses
 */

# Invalid header
if address :is "frop" "frml" {
	keep;
}

# Not an error
if address :is "reply-to" "frml" {
	keep;
}

# Invalid header (#2)
if address :is ["to", "frop"] "frml" {
	keep;
}

# Not an error
if address :is ["to", "reply-to"] "frml" {
	keep;
}