summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/multiscript/conflicts.svtest
blob: a2b8fab9fc25b545585b277a6ff94545d914b745 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
require "vnd.dovecot.testsuite";

test_set "message" text:
From: stephan@example.org
Message-ID: <frop33333333333333333@nl.example.com>
To: nico@frop.example.org
Subject: Frop.

Friep.
.
;

test "Graceful Conflicts" {
	if not allof (
		test_script_compile "fileinto-inbox.sieve",
		test_script_run ){
		test_fail "failed to compile and run first script";
	}

	if not test_result_execute {
		test_fail "result execute failed after first script";
	}

	if not allof (
		test_script_compile "reject-1.sieve",
		test_script_run :append_result ) {
		test_fail "failed to compile and run second script";
	}

	if not test_result_execute {
		test_fail "result execute failed after second script";
	}

	if not allof (
		test_script_compile "reject-2.sieve",
		test_script_run :append_result ) {
		test_fail "failed to compile and run third script";
	}

	if not test_result_execute {
		test_fail "result execute failed after third script";
	}

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

	if not test_result_action :index 2 "reject" {
		test_result_print;
		test_fail "first reject action not retained";
	}

	if test_result_action :index 3 "reject" {
		test_result_print;
		test_fail "second reject action not discarded";
	}

}

test "Duplicates" {
	if not allof (
		test_script_compile "fileinto-inbox.sieve",
		test_script_run ){
		test_fail "failed to compile and run first script";
	}

	if not test_result_execute {
		test_fail "result execute failed after first script";
	}

	if not allof (
		test_script_compile "fileinto-inbox.sieve",
		test_script_run :append_result ) {
		test_fail "failed to compile and run second script";
	}

	if not test_result_execute {
		test_fail "result execute failed after second script";
	}

	if not allof (
		test_script_compile "keep.sieve",
		test_script_run :append_result ) {
		test_fail "failed to compile and run third script";
	}

	if not test_result_execute {
		test_fail "result execute failed after third script";
	}

	if not test_result_action :index 1 "keep" {
		test_fail "first action is not 'keep'";
	}

	if test_result_action :index 2 "store" {
		test_fail "fileinto action not discarded";
	}
}