File: utf-8.svtest

package info (click to toggle)
dovecot 1%3A2.2.13-11~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 38,468 kB
  • sloc: ansic: 341,153; sh: 16,920; makefile: 5,381; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (86 lines) | stat: -rw-r--r-- 2,086 bytes parent folder | download | duplicates (9)
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
require "vnd.dovecot.testsuite";
require "vacation";
require "variables";

test_set "message" text:
From: stephan@example.org
Subject: frop
References: <1234@local.machine.example> <3456@example.net>
 <435444@ttms.com> <4223@froop.example.net> <m345444444@message-id.exp>
Message-ID: <432df324@example.org>
To: nico@frop.example.org

Frop
.
;

test "UTF-8 Subject" {
	/* Trigger vacation response with rediculous Russian subject */
	vacation :subject "Auto: Я могу есть стекло, оно мне не вредит."
		"I am not in today";

	/* Execute Sieve result (sending message to dummy SMTP) */
	if not test_result_execute {
		test_fail "execution of result failed";
	}

	/* Retrieve message from dummy SMTP and set it as the active message under
	 * test.
	 */
	test_message :smtp 0;

	set "expected" "Auto: Я могу есть стекло, оно мне не вредит.";
	if not header :is "subject" "${expected}" {
		if header :matches "subject" "*" { set "subject" "${1}"; }

		test_fail text:
subject header is not encoded/decoded properly:
expected: ${expected}
decoded: ${subject}
.
;
	}
}

test_result_reset;

test_set "message" text:
From: stephan@example.org
Subject: frop
References: <1234@local.machine.example> <3456@example.net>
 <435444@ttms.com> <4223@froop.example.net> <m345444444@message-id.exp>
Message-ID: <432df324@example.org>
To: nico@frop.example.org

Frop
.
;


test "MIME Encoded Subject" {
	/* Trigger vacation response with rediculous Russian subject */
	vacation :subject "=?utf-8?b?w4TDlsOc?= sadasd"
		"I am not in today";

	/* Execute Sieve result (sending message to dummy SMTP) */
	if not test_result_execute {
		test_fail "execution of result failed";
	}

	/* Retrieve message from dummy SMTP and set it as the active message under
	 * test.
	 */
	test_message :smtp 0;

	set "expected" "ÄÖÜ sadasd";
	if not header :is "subject" "${expected}" {
		if header :matches "subject" "*" { set "subject" "${1}"; }

		test_fail text:
subject header is not encoded/decoded properly:
expected: ${expected}
decoded: ${subject}
.
;
	}
}