dovecot-2.2: various - remove 8-bit characters from literal stri...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Nov 16 10:30:23 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/36353046b107
changeset: 19365:36353046b107
user: Phil Carmody <phil at dovecot.fi>
date: Mon Nov 16 12:29:51 2015 +0200
description:
various - remove 8-bit characters from literal strings in test cases
C has a portable way of expressing characters not in the basic character
set, namely \xNN escaping. Otherwise, the interpretation of the raw utf-8
is implentation dependent. This has the benefit of making some tests'
expected output more obvious, such as "=c3=a4" matching "\xC3\xA4", even
if it hinders the readability of some natural-language-based tests.
Signed-off-by: Phil Carmody <phil at dovecot.fi>
diffstat:
src/lib-charset/test-charset.c | 8 ++++++--
src/lib-fts/test-fts-filter.c | 16 ++++++++--------
src/lib-fts/test-fts-tokenizer.c | 22 +++++++++++-----------
src/lib-imap/test-imap-utf7.c | 5 +++--
src/lib-mail/test-istream-qp-decoder.c | 10 +++++-----
src/lib-mail/test-message-header-decode.c | 14 +++++++-------
src/lib-mail/test-message-header-encode.c | 12 ++++++------
7 files changed, 46 insertions(+), 41 deletions(-)
diffs (258 lines):
diff -r ae5be2c19fce -r 36353046b107 src/lib-charset/test-charset.c
--- a/src/lib-charset/test-charset.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-charset/test-charset.c Mon Nov 16 12:29:51 2015 +0200
@@ -66,9 +66,13 @@
const char *output;
enum charset_result result;
} tests[] = {
- { "ISO-8859-1", "p\xE4\xE4", "pää", CHARSET_RET_OK },
+ { "ISO-8859-1", "p\xE4\xE4", "p\xC3\xA4\xC3\xA4", CHARSET_RET_OK },
{ "UTF-7", "+AOQA5AD2AOQA9gDkAPYA5AD2AOQA9gDkAPYA5AD2AOQA9gDkAPYA5AD2AOQA9gDkAPYA5AD2AOQA9gDkAPYA5AD2AOQA9gDk",
- "ääöäöäöäöäöäöäöäöäöäöäöäöäöäöäöäöäöä", CHARSET_RET_OK }
+ "\xC3\xA4\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4"
+ "\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4"
+ "\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4"
+ "\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4"
+ "\xC3\xB6\xC3\xA4\xC3\xB6\xC3\xA4", CHARSET_RET_OK }
};
string_t *str = t_str_new(128);
struct charset_translation *trans;
diff -r ae5be2c19fce -r 36353046b107 src/lib-fts/test-fts-filter.c
--- a/src/lib-fts/test-fts-filter.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-fts/test-fts-filter.c Mon Nov 16 12:29:51 2015 +0200
@@ -415,8 +415,8 @@
struct fts_filter *norm = NULL;
const char *input[] = {
"Vem",
- "Å",
- "ÅÄÖ",
+ "\xC3\x85",
+ "\xC3\x85\xC3\x84\xC3\x96",
"Vem kan segla f\xC3\xB6rutan vind?\n"
"\xC3\x85\xC3\x84\xC3\x96\xC3\xB6\xC3\xA4\xC3\xA5"
};
@@ -450,8 +450,8 @@
struct fts_filter *norm = NULL;
const char *input[] = {
"Vem",
- "Å",
- "ÅÄÖ",
+ "\xC3\x85",
+ "\xC3\x85\xC3\x84\xC3\x96",
"Vem kan segla f\xC3\xB6rutan vind?\n"
"\xC3\x85\xC3\x84\xC3\x96\xC3\xB6\xC3\xA4\xC3\xA5"
};
@@ -662,14 +662,14 @@
"foo'",
"foo's",
- "fooä's",
+ "foo\xC3\xA4's",
"foo'S",
"foos'S",
"foo's's",
"foo'ss",
"foo\xE2\x80\x99s",
- "fooä\xE2\x80\x99s",
+ "foo\xC3\xA4\xE2\x80\x99s",
"foo\xE2\x80\x99S",
"foos\xE2\x80\x99S",
"foo\xE2\x80\x99s\xE2\x80\x99s",
@@ -679,14 +679,14 @@
"foo'",
"foo",
- "fooä",
+ "foo\xC3\xA4",
"foo",
"foos",
"foo's",
"foo'ss",
"foo",
- "fooä",
+ "foo\xC3\xA4",
"foo",
"foos",
"foo\xE2\x80\x99s",
diff -r ae5be2c19fce -r 36353046b107 src/lib-fts/test-fts-tokenizer.c
--- a/src/lib-fts/test-fts-tokenizer.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-fts/test-fts-tokenizer.c Mon Nov 16 12:29:51 2015 +0200
@@ -20,9 +20,9 @@
"abc at example.com, "
"Bar Baz <bar at example.org>, "
"foo at domain "
- "1234567890123456789012345678ä,"
- "12345678901234567890123456789ä,"
- "123456789012345678901234567890ä,"
+ "1234567890123456789012345678\xC3\xA4,"
+ "12345678901234567890123456789\xC3\xA4,"
+ "123456789012345678901234567890\xC3\xA4,"
"and longlonglongabcdefghijklmnopqrstuvwxyz more.\n\n "
"(\"Hello world\")3.14 3,14 last",
@@ -30,8 +30,8 @@
"' ' '' ''' 'quoted text' 'word' 'hlo words' you're bad'''word '''pre post'''",
- "'1234567890123456789012345678ä,"
- "123456789012345678901234567x'ä,"
+ "'1234567890123456789012345678\xC3\xA4,"
+ "123456789012345678901234567x'\xC3\xA4,"
"1234567890123456789012345678x're,"
"1234567890123456789012345678x',"
"1234567890123456789012345678x'',"
@@ -141,7 +141,7 @@
"there", "was", "text", "galor\xC3\xA9",
"abc", "example", "com", "Bar", "Baz",
"bar", "example", "org", "foo", "domain",
- "1234567890123456789012345678ä",
+ "1234567890123456789012345678\xC3\xA4",
"12345678901234567890123456789",
"123456789012345678901234567890",
"and", "longlonglongabcdefghijklmnopqr",
@@ -152,7 +152,7 @@
"quoted", "text", "word", "hlo", "words", "you're", "bad",
"word", "pre", "post", NULL,
- "1234567890123456789012345678ä",
+ "1234567890123456789012345678\xC3\xA4",
"123456789012345678901234567x'",
"1234567890123456789012345678x'",
"1234567890123456789012345678x",
@@ -200,7 +200,7 @@
"there", "was", "text", "galor\xC3\xA9",
"abc", "example", "com", "Bar", "Baz",
"bar", "example", "org", "foo", "domain",
- "1234567890123456789012345678ä",
+ "1234567890123456789012345678\xC3\xA4",
"12345678901234567890123456789",
"123456789012345678901234567890",
"and", "longlonglongabcdefghijklmnopqr",
@@ -211,7 +211,7 @@
"quoted", "text", "word", "hlo", "words", "you're", "bad",
"word", "pre", "post", NULL,
- "1234567890123456789012345678ä",
+ "1234567890123456789012345678\xC3\xA4",
"123456789012345678901234567x'",
"1234567890123456789012345678x'",
"1234567890123456789012345678x",
@@ -256,7 +256,7 @@
"there", "was", "text", "galor\xC3\xA9",
"abc", "example", "com", "Bar", "Baz",
"bar", "example", "org", "foo", "domain",
- "1234567890123456789012345678ä",
+ "1234567890123456789012345678\xC3\xA4",
"12345678901234567890123456789",
"123456789012345678901234567890",
"and", "longlonglongabcdefghijklmnopqr",
@@ -267,7 +267,7 @@
"quoted", "text", "word", "hlo", "words", "you're", "bad",
"word", "pre", "post", NULL,
- "1234567890123456789012345678ä",
+ "1234567890123456789012345678\xC3\xA4",
"123456789012345678901234567x'",
"1234567890123456789012345678x'",
"1234567890123456789012345678x",
diff -r ae5be2c19fce -r 36353046b107 src/lib-imap/test-imap-utf7.c
--- a/src/lib-imap/test-imap-utf7.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-imap/test-imap-utf7.c Mon Nov 16 12:29:51 2015 +0200
@@ -13,8 +13,9 @@
const char *mutf7;
} tests[] = {
{ "&&x&&", "&-&-x&-&-" },
- { "~peter/mail/台北/日本語", "~peter/mail/&U,BTFw-/&ZeVnLIqe-" },
- { "tietäjä", "tiet&AOQ-j&AOQ-" },
+ { "~peter/mail/\xe5\x8f\xb0\xe5\x8c\x97/\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e",
+ "~peter/mail/&U,BTFw-/&ZeVnLIqe-" },
+ { "tiet\xc3\xa4j\xc3\xa4", "tiet&AOQ-j&AOQ-" },
{ "p\xe4\xe4", NULL },
{ NULL, "&" },
{ NULL, "&Jjo" },
diff -r ae5be2c19fce -r 36353046b107 src/lib-mail/test-istream-qp-decoder.c
--- a/src/lib-mail/test-istream-qp-decoder.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-mail/test-istream-qp-decoder.c Mon Nov 16 12:29:51 2015 +0200
@@ -10,15 +10,15 @@
const char *output;
int ret;
} tests[] = {
- { "p=C3=A4=C3=A4t=C3=B6s", "päätös", 0 },
- { "p=c3=a4=c3=a4t=c3=b6s= \n", "päätös", 0 },
- { "p=c3=a4= \t \n=c3=\r\n=a4t= \r\n=c3=b6s", "päätös", 0 },
+ { "p=C3=A4=C3=A4t=C3=B6s", "p\xC3\xA4\xC3\xA4t\xC3\xB6s", 0 },
+ { "p=c3=a4=c3=a4t=c3=b6s= \n", "p\xC3\xA4\xC3\xA4t\xC3\xB6s", 0 },
+ { "p=c3=a4= \t \n=c3=\r\n=a4t= \r\n=c3=b6s", "p\xC3\xA4\xC3\xA4t\xC3\xB6s", 0 },
- { "p=c3=a4\rasdf", "pä", -1 },
+ { "p=c3=a4\rasdf", "p\xC3\xA4", -1 },
{ "p=c", "p", -1 },
{ "p=A", "p", -1 },
{ "p=Ax", "p", -1 },
- { "p=c3=a4=c3=a4t=c3=b6s= ", "päätös", -1 }
+ { "p=c3=a4=c3=a4t=c3=b6s= ", "p\xC3\xA4\xC3\xA4t\xC3\xB6s", -1 }
};
static void
diff -r ae5be2c19fce -r 36353046b107 src/lib-mail/test-message-header-decode.c
--- a/src/lib-mail/test-message-header-decode.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-mail/test-message-header-decode.c Mon Nov 16 12:29:51 2015 +0200
@@ -27,13 +27,13 @@
static void test_message_header_decode(void)
{
static const char *data[] = {
- " \t=?utf-8?q?=c3=a4?= =?utf-8?q?=c3=a4?= b \t\r\n ", "ää b \t\r\n ",
- "a =?utf-8?q?=c3=a4?= b", "a ä b",
- "a =?utf-8?q?=c3=a4?= b", "a ä b",
- "a =?utf-8?q?=c3=a4?=\t\t\r\n =?utf-8?q?=c3=a4?= b", "a ää b",
- "a =?utf-8?q?=c3=a4?= x =?utf-8?q?=c3=a4?= b", "a ä x ä b",
- "a =?utf-8?b?w6TDpCDDpA==?= b", "a ää ä b",
- "=?utf-8?b?w6Qgw6Q=?=", "ä ä",
+ " \t=?utf-8?q?=c3=a4?= =?utf-8?q?=c3=a4?= b \t\r\n ", "\xC3\xA4\xC3\xA4 b \t\r\n ",
+ "a =?utf-8?q?=c3=a4?= b", "a \xC3\xA4 b",
+ "a =?utf-8?q?=c3=a4?= b", "a \xC3\xA4 b",
+ "a =?utf-8?q?=c3=a4?=\t\t\r\n =?utf-8?q?=c3=a4?= b", "a \xC3\xA4\xC3\xA4 b",
+ "a =?utf-8?q?=c3=a4?= x =?utf-8?q?=c3=a4?= b", "a \xC3\xA4 x \xC3\xA4 b",
+ "a =?utf-8?b?w6TDpCDDpA==?= b", "a \xC3\xA4\xC3\xA4 \xC3\xA4 b",
+ "=?utf-8?b?w6Qgw6Q=?=", "\xC3\xA4 \xC3\xA4",
};
string_t *dest;
unsigned int i;
diff -r ae5be2c19fce -r 36353046b107 src/lib-mail/test-message-header-encode.c
--- a/src/lib-mail/test-message-header-encode.c Mon Nov 16 12:29:21 2015 +0200
+++ b/src/lib-mail/test-message-header-encode.c Mon Nov 16 12:29:51 2015 +0200
@@ -57,7 +57,7 @@
str_append_c(input, 'a');
for (i = 0; i < 40; i++)
- str_append(input, "ä");
+ str_append(input, "\xC3\xA4");
for (i = 0; i < 80; i++) {
for (skip = 0; skip < 2; skip++) {
str_truncate(str, 0);
@@ -144,7 +144,7 @@
str_append_c(input, 'a');
for (i = 0; i < 40; i++)
- str_append(input, "ä");
+ str_append(input, "\xC3\xA4");
for (i = 0; i < 80; i++) {
for (skip = 0; skip < 2; skip++) {
str_truncate(str, 0);
@@ -166,10 +166,10 @@
{
const char *data[] = {
"a b", "a b",
- "a bcäde f", "a =?utf-8?q?bc=C3=A4de?= f",
- "a ää ä b", "a =?utf-8?b?w6TDpCDDpA==?= b",
- "ä a ä", "=?utf-8?q?=C3=A4_a_=C3=A4?=",
- "ää a ä", "=?utf-8?b?w6TDpCBhIMOk?=",
+ "a bc\xC3\xA4""de f", "a =?utf-8?q?bc=C3=A4de?= f",
+ "a \xC3\xA4\xC3\xA4 \xC3\xA4 b", "a =?utf-8?b?w6TDpCDDpA==?= b",
+ "\xC3\xA4 a \xC3\xA4", "=?utf-8?q?=C3=A4_a_=C3=A4?=",
+ "\xC3\xA4\xC3\xA4 a \xC3\xA4", "=?utf-8?b?w6TDpCBhIMOk?=",
"=", "=",
"?", "?",
"a=?", "a=?",
More information about the dovecot-cvs
mailing list