dovecot-2.2: lib-fts: Add UTF-8 unit test for lowercase filter.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Aug 31 10:35:15 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/b5dfafc0b235
changeset: 19044:b5dfafc0b235
user: Teemu Huovila <teemu.huovila at dovecot.fi>
date: Mon Aug 31 13:33:26 2015 +0300
description:
lib-fts: Add UTF-8 unit test for lowercase filter.
diffstat:
src/lib-fts/test-fts-filter.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diffs (49 lines):
diff -r 4b8c7440cf4f -r b5dfafc0b235 src/lib-fts/test-fts-filter.c
--- a/src/lib-fts/test-fts-filter.c Mon Aug 31 13:33:26 2015 +0300
+++ b/src/lib-fts/test-fts-filter.c Mon Aug 31 13:33:26 2015 +0300
@@ -110,6 +110,35 @@
test_end();
}
+#ifdef HAVE_LIBICU
+static void test_fts_filter_lowercase_utf8(void)
+{
+ struct {
+ const char *input;
+ const char *output;
+ } tests[] = {
+ { "f\xC3\x85\xC3\x85", "f\xC3\xA5\xC3\xA5" },
+ { "F\xC3\x85\xC3\x85", "f\xC3\xA5\xC3\xA5" },
+ { "F\xC3\x85\xC3\xA5", "f\xC3\xA5\xC3\xA5" }
+ };
+ struct fts_filter *filter;
+ const char *error;
+ const char *token;
+ unsigned int i;
+
+ test_begin("fts filter lowercase, UTF8");
+ test_assert(fts_filter_create(fts_filter_lowercase, NULL, &english_language, NULL, &filter, &error) == 0);
+
+ for (i = 0; i < N_ELEMENTS(tests); i++) {
+ token = tests[i].input;
+ test_assert_idx(fts_filter_filter(filter, &token, &error) > 0 &&
+ strcmp(token, tests[i].output) == 0, 0);
+ }
+ fts_filter_unref(&filter);
+ test_end();
+}
+#endif
+
static void test_fts_filter_stopwords_eng(void)
{
struct fts_filter *filter;
@@ -688,6 +717,9 @@
test_fts_filter_contractions_fail,
test_fts_filter_contractions_fr,
test_fts_filter_lowercase,
+#ifdef HAVE_LIBICU
+ test_fts_filter_lowercase_utf8,
+#endif
test_fts_filter_stopwords_eng,
test_fts_filter_stopwords_fin,
test_fts_filter_stopwords_fra,
More information about the dovecot-cvs
mailing list