~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002101901

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
require "vnd.dovecot.testsuite";
require "relational";
require "comparator-i;ascii-numeric";

test_set "message" text:
To: nico@vestingbar.nl
From: stephan@rename-it.nl
Subject: Test

Test.
.
;

test_mailbox :create "INBOX.VB";
test_mailbox :create "INBOX.backup";

test "Fileinto" {
	if not test_script_compile "actions/fileinto.sieve" {
		test_fail "script compile failed";
	}

	if not test_script_run {
		test_fail "script run failed";
	}

	if not test_result :count "eq" :comparator "i;ascii-numeric" "3" {
		test_fail "wrong number of actions in result";
	} 

	if not test_result :index 1 "store" {
		test_fail "first action is not 'store'";
	} 

	if not test_result :index 2 "store" {
		test_fail "second action is not 'store'";
	} 

	if not test_result :index 3 "keep" {
		test_fail "third action is not 'keep'";
	} 

	if not test_result_execute {
		test_fail "result execute failed";
	}
}

test "Redirect" {
	if not test_script_compile "actions/redirect.sieve" {
		test_fail "compile failed";
	}

	if not test_script_run {
		test_fail "execute failed";
	}

	if not test_result :count "eq" :comparator "i;ascii-numeric" "4" {
		test_fail "wrong number of actions in result";
	} 

	if not test_result :index 1 "redirect" {
		test_fail "first action is not 'redirect'";
	} 

	if not test_result :index 2 "keep" {
		test_fail "second action is not 'keep'";
	} 

	if not test_result :index 3 "redirect" {
		test_fail "third action is not 'redirect'";
	} 

	if not test_result :index 4 "redirect" {
		test_fail "fourth action is not 'redirect'";
	} 

	if not test_result_execute {
		test_fail "result execute failed";
	}
}