From: Phil Carmody Date: Mon, 16 Nov 2015 10:29:51 +0000 (+0200) Subject: various - remove 8-bit characters from literal strings in test cases X-Git-Tag: 2.2.20.rc1~87 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19ed8f08b23d6ed204e6b27e5d1c0c6fe6bb11dd;p=thirdparty%2Fdovecot%2Fcore.git 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 --- diff --git a/src/lib-charset/test-charset.c b/src/lib-charset/test-charset.c index daf4227d94..b82539375f 100644 --- a/src/lib-charset/test-charset.c +++ b/src/lib-charset/test-charset.c @@ -66,9 +66,13 @@ static void test_charset_iconv(void) 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 --git a/src/lib-fts/test-fts-filter.c b/src/lib-fts/test-fts-filter.c index 4955c73dd7..4f6a2cf737 100644 --- a/src/lib-fts/test-fts-filter.c +++ b/src/lib-fts/test-fts-filter.c @@ -415,8 +415,8 @@ static void test_fts_filter_normalizer_swedish_short(void) 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 @@ static void test_fts_filter_normalizer_swedish_short_default_id(void) 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 @@ static void test_fts_filter_english_possessive(void) "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 @@ static void test_fts_filter_english_possessive(void) "foo'", "foo", - "fooä", + "foo\xC3\xA4", "foo", "foos", "foo's", "foo'ss", "foo", - "fooä", + "foo\xC3\xA4", "foo", "foos", "foo\xE2\x80\x99s", diff --git a/src/lib-fts/test-fts-tokenizer.c b/src/lib-fts/test-fts-tokenizer.c index d861e85c76..643acd77dc 100644 --- a/src/lib-fts/test-fts-tokenizer.c +++ b/src/lib-fts/test-fts-tokenizer.c @@ -20,9 +20,9 @@ static const char *test_inputs[] = { "abc@example.com, " "Bar Baz , " "foo@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 @@ static const char *test_inputs[] = { "' ' '' ''' '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 @@ static void test_fts_tokenizer_generic_only(void) "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 @@ static void test_fts_tokenizer_generic_only(void) "quoted", "text", "word", "hlo", "words", "you're", "bad", "word", "pre", "post", NULL, - "1234567890123456789012345678ä", + "1234567890123456789012345678\xC3\xA4", "123456789012345678901234567x'", "1234567890123456789012345678x'", "1234567890123456789012345678x", @@ -200,7 +200,7 @@ static void test_fts_tokenizer_generic_tr29_only(void) "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 @@ static void test_fts_tokenizer_generic_tr29_only(void) "quoted", "text", "word", "hlo", "words", "you're", "bad", "word", "pre", "post", NULL, - "1234567890123456789012345678ä", + "1234567890123456789012345678\xC3\xA4", "123456789012345678901234567x'", "1234567890123456789012345678x'", "1234567890123456789012345678x", @@ -256,7 +256,7 @@ static void test_fts_tokenizer_generic_tr29_wb5a(void) "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 @@ static void test_fts_tokenizer_generic_tr29_wb5a(void) "quoted", "text", "word", "hlo", "words", "you're", "bad", "word", "pre", "post", NULL, - "1234567890123456789012345678ä", + "1234567890123456789012345678\xC3\xA4", "123456789012345678901234567x'", "1234567890123456789012345678x'", "1234567890123456789012345678x", diff --git a/src/lib-imap/test-imap-utf7.c b/src/lib-imap/test-imap-utf7.c index efece73bd8..509a755558 100644 --- a/src/lib-imap/test-imap-utf7.c +++ b/src/lib-imap/test-imap-utf7.c @@ -13,8 +13,9 @@ static void test_imap_utf7_by_example(void) 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 --git a/src/lib-mail/test-istream-qp-decoder.c b/src/lib-mail/test-istream-qp-decoder.c index c47a3d91b6..71ccd4eb3a 100644 --- a/src/lib-mail/test-istream-qp-decoder.c +++ b/src/lib-mail/test-istream-qp-decoder.c @@ -10,15 +10,15 @@ static const struct { 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 --git a/src/lib-mail/test-message-header-decode.c b/src/lib-mail/test-message-header-decode.c index 04898cd6d0..154b2967ac 100644 --- a/src/lib-mail/test-message-header-decode.c +++ b/src/lib-mail/test-message-header-decode.c @@ -27,13 +27,13 @@ charset_to_utf8(struct charset_translation *t ATTR_UNUSED, 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 --git a/src/lib-mail/test-message-header-encode.c b/src/lib-mail/test-message-header-encode.c index 70c80aff6f..a1f47be438 100644 --- a/src/lib-mail/test-message-header-encode.c +++ b/src/lib-mail/test-message-header-encode.c @@ -57,7 +57,7 @@ static void test_message_header_encode_q(void) 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 @@ static void test_message_header_encode_b(void) 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 @@ static void test_message_header_encode(void) { 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=?",