mirror of https://github.com/djcb/mu.git
* update some unit tests
This commit is contained in:
parent
b19ab68d3b
commit
e7c63cee47
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 },
|
||||
|
|
Loading…
Reference in New Issue