diff --git a/lib/tests/test-mu-str.c b/lib/tests/test-mu-str.c index b8f37da8..84bd5704 100644 --- a/lib/tests/test-mu-str.c +++ b/lib/tests/test-mu-str.c @@ -237,6 +237,7 @@ test_mu_str_process_term (void) const char* esc; } words [] = { { "aap@noot.mies", "aap_noot_mies" }, + { "A&B", "a_b" }, { "Foo..Bar", "foo__bar" }, { "Foo.Bar", "foo_bar" }, { "Foo Bar", "foo_bar" }, @@ -270,6 +271,46 @@ test_mu_str_process_term (void) +static void +test_mu_str_process_text (void) +{ + int i; + struct { + const char* word; + const char* esc; + } words [] = { + { "aap@noot.mies", "aap@noot.mies" }, + { "A&B", "a&b" }, + { "Foo..Bar", "foo..bar" }, + { "Foo.Bar", "foo.bar" }, + { "Foo Bar", "foo bar" }, + { "\\foo", "\\foo" }, + { "subject:test@foo", "subject:test@foo" }, + { "xxx:test@bar", "xxx:test@bar" }, + { "aa$bb$cc", "aa$bb$cc" }, + { "date:2010..2012", "date:2010..2012"}, + { "subject:2010..2012", "subject:2010..2012"}, + { "(maildir:foo)", "(maildir:foo)"}, + { "Тесла, Никола", "тесла, никола"}, + { "Masha@Аркона.ru", "masha@аркона.ru" }, + { "foo:ελληνικά", "foo:ελληνικα" }, + { "日本語!!", "日本語!!" } + }; + + for (i = 0; i != G_N_ELEMENTS(words); ++i) { + gchar *s; + s = mu_str_process_text (words[i].word); + if (g_test_verbose()) + g_print ("expected: '%s' <=> got: '%s'\n", + words[i].esc, s); + g_assert_cmpstr (s, ==, words[i].esc); + g_free (s); + } +} + + + + static void test_mu_str_display_contact (void) { @@ -488,6 +529,9 @@ main (int argc, char *argv[]) test_mu_str_process_query_term); g_test_add_func ("/mu-str/process-term", test_mu_str_process_term); + g_test_add_func ("/mu-str/process-text", + test_mu_str_process_text); + g_test_add_func ("/mu-str/mu-str-display_contact", test_mu_str_display_contact); diff --git a/lib/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S b/lib/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S index 4144dbbe..d0ff0d70 100644 --- a/lib/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S +++ b/lib/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S @@ -45,7 +45,7 @@ In-Reply-To: <73d4fc50808030747g303a170ieac567723c2d4f24@mail.gmail.com> MIME-Version: 1.0 References: <477821040808030533y41f1501dq32447b568b6e6ca5@mail.gmail.com> <73d4fc50808030747g303a170ieac567723c2d4f24@mail.gmail.com> -Subject: Re: [sqlite-dev] SQLite exception +Subject: Re: [sqlite-dev] SQLite exception A&B X-BeenThere: sqlite-dev@sqlite.org X-Mailman-Version: 2.1.9 Priority: normal diff --git a/mu/tests/test-mu-query.c b/mu/tests/test-mu-query.c index e1b66a46..bd86925a 100644 --- a/mu/tests/test-mu-query.c +++ b/mu/tests/test-mu-query.c @@ -169,6 +169,10 @@ test_mu_query_01 (void) { "question", 5 }, { "thanks", 2 }, { "html", 4 }, + { "subject:exception", 1 }, + { "exception", 1 }, + { "subject:A&B", 1 }, + { "A&B", 1 }, { "subject:elisp", 1 }, { "html AND contains", 1 }, { "html and contains", 1 },