* tests: fix unit tests for the improved parsing
This commit is contained in:
@ -102,13 +102,16 @@ run_and_count_matches (const char *xpath, const char *query)
|
|||||||
|
|
||||||
if (g_test_verbose()) {
|
if (g_test_verbose()) {
|
||||||
char *xs;
|
char *xs;
|
||||||
g_printerr ("\n=>'%s'\n", query);
|
g_print ("\n==> query: %s\n", query);
|
||||||
g_print ("query : '%s'\n", query);
|
xs = mu_query_preprocess (query);
|
||||||
|
g_print ("==> preproc: '%s'\n", xs);
|
||||||
|
g_free (xs);
|
||||||
xs = mu_query_as_string (mquery, query, NULL);
|
xs = mu_query_as_string (mquery, query, NULL);
|
||||||
g_print ("xquery: '%s'\n", xs);
|
g_print ("==> xquery: '%s'\n", xs);
|
||||||
g_free (xs);
|
g_free (xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
iter = mu_query_run (mquery, query, FALSE, MU_MSG_FIELD_ID_NONE,
|
iter = mu_query_run (mquery, query, FALSE, MU_MSG_FIELD_ID_NONE,
|
||||||
FALSE, -1, NULL);
|
FALSE, -1, NULL);
|
||||||
mu_query_destroy (mquery);
|
mu_query_destroy (mquery);
|
||||||
@ -207,8 +210,9 @@ test_mu_query_03 (void)
|
|||||||
{ "s:lisp", 1},
|
{ "s:lisp", 1},
|
||||||
{ "s:LISP", 1},
|
{ "s:LISP", 1},
|
||||||
|
|
||||||
{ "s:Learning LISP; Scheme vs elisp.", 1},
|
{ "s:\"Re: Learning LISP; Scheme vs elisp.\"", 1},
|
||||||
{ "subject:Re Learning LISP; Scheme vs elisp.", 1},
|
{ "subject:Re: Learning LISP; Scheme vs elisp.", 0},
|
||||||
|
{ "subject:\"Re: Learning LISP; Scheme vs elisp.\"", 1},
|
||||||
{ "to:help-gnu-emacs@gnu.org", 4},
|
{ "to:help-gnu-emacs@gnu.org", 4},
|
||||||
{ "t:help-gnu-emacs", 0},
|
{ "t:help-gnu-emacs", 0},
|
||||||
};
|
};
|
||||||
@ -359,7 +363,6 @@ test_mu_query_dates_helsinki (void)
|
|||||||
int i;
|
int i;
|
||||||
const char *old_tz;
|
const char *old_tz;
|
||||||
|
|
||||||
|
|
||||||
QResults queries[] = {
|
QResults queries[] = {
|
||||||
{ "date:20080731..20080804", 5},
|
{ "date:20080731..20080804", 5},
|
||||||
/* { "date:20080804..20080731", 5}, */
|
/* { "date:20080804..20080731", 5}, */
|
||||||
|
|||||||
@ -154,6 +154,31 @@ test_mu_str_normalize_02 (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_mu_str_esc_to_list (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct {
|
||||||
|
const char* str;
|
||||||
|
const char* strs[3];
|
||||||
|
} strings [] = {
|
||||||
|
{ "maildir:foo", {"maildir:foo", NULL, NULL}},
|
||||||
|
{ "maildir:sent items", {"maildir:sent", "items", NULL}},
|
||||||
|
{ "\"maildir:sent items\"", {"maildir:sent items", NULL, NULL}},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i != G_N_ELEMENTS(strings); ++i) {
|
||||||
|
GSList *lst, *cur;
|
||||||
|
unsigned u;
|
||||||
|
lst = mu_str_esc_to_list (strings[i].str);
|
||||||
|
for (cur = lst, u = 0; cur; cur = g_slist_next(cur), ++u)
|
||||||
|
g_assert_cmpstr ((const char*)cur->data,==,strings[i].strs[u]);
|
||||||
|
mu_str_free_list (lst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mu_str_ascii_xapian_escape (void)
|
test_mu_str_ascii_xapian_escape (void)
|
||||||
{
|
{
|
||||||
@ -165,9 +190,9 @@ test_mu_str_ascii_xapian_escape (void)
|
|||||||
{ "aap@noot.mies", "aap_noot_mies"},
|
{ "aap@noot.mies", "aap_noot_mies"},
|
||||||
{ "Foo..Bar", "foo..bar" },
|
{ "Foo..Bar", "foo..bar" },
|
||||||
{ "Foo.Bar", "foo_bar" },
|
{ "Foo.Bar", "foo_bar" },
|
||||||
{ "Foo. Bar", "foo. bar" },
|
{ "Foo. Bar", "foo__bar" },
|
||||||
{ "subject:test@foo", "subject:test_foo" },
|
{ "subject:test@foo", "subject:test_foo" },
|
||||||
{ "xxx:test@bar", "xxx test_bar" },
|
{ "xxx:test@bar", "xxx_test_bar" },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
||||||
@ -430,6 +455,9 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/mu-str/mu-str-to-list-strip",
|
g_test_add_func ("/mu-str/mu-str-to-list-strip",
|
||||||
test_mu_str_to_list_strip);
|
test_mu_str_to_list_strip);
|
||||||
|
|
||||||
|
g_test_add_func ("/mu-str/mu-str-esc-to-list",
|
||||||
|
test_mu_str_esc_to_list);
|
||||||
|
|
||||||
g_test_add_func ("/mu-str/mu_str_guess_first_name",
|
g_test_add_func ("/mu-str/mu_str_guess_first_name",
|
||||||
test_mu_str_guess_first_name);
|
test_mu_str_guess_first_name);
|
||||||
g_test_add_func ("/mu-str/mu_str_guess_last_name",
|
g_test_add_func ("/mu-str/mu_str_guess_last_name",
|
||||||
|
|||||||
Reference in New Issue
Block a user