* update testcases for mu-msg-field
This commit is contained in:
@ -48,6 +48,10 @@ TEST_PROGS += test-mu-maildir
|
|||||||
test_mu_maildir_SOURCES= test-mu-maildir.c
|
test_mu_maildir_SOURCES= test-mu-maildir.c
|
||||||
test_mu_maildir_LDADD= libtestmucommon.la
|
test_mu_maildir_LDADD= libtestmucommon.la
|
||||||
|
|
||||||
|
TEST_PROGS += test-mu-msg-fields
|
||||||
|
test_mu_msg_fields_SOURCES= test-mu-msg-fields.c
|
||||||
|
test_mu_msg_fields_LDADD= libtestmucommon.la
|
||||||
|
|
||||||
TEST_PROGS += test-mu-query
|
TEST_PROGS += test-mu-query
|
||||||
test_mu_query_SOURCES= test-mu-query.c dummy.cc
|
test_mu_query_SOURCES= test-mu-query.c dummy.cc
|
||||||
test_mu_query_LDADD= libtestmucommon.la
|
test_mu_query_LDADD= libtestmucommon.la
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif /*HAVE_CONFIG_H*/
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,10 @@ fill_database (void)
|
|||||||
" --quiet",
|
" --quiet",
|
||||||
MU_PROGRAM, tmpdir, MU_TESTMAILDIR);
|
MU_PROGRAM, tmpdir, MU_TESTMAILDIR);
|
||||||
|
|
||||||
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, NULL));
|
/* g_printerr ("\n%s\n", cmdline); */
|
||||||
|
|
||||||
|
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||||
|
NULL, NULL));
|
||||||
g_free (cmdline);
|
g_free (cmdline);
|
||||||
|
|
||||||
xpath= g_strdup_printf ("%s%c%s", tmpdir, G_DIR_SEPARATOR, "xapian");
|
xpath= g_strdup_printf ("%s%c%s", tmpdir, G_DIR_SEPARATOR, "xapian");
|
||||||
@ -64,10 +67,13 @@ run_and_count_matches (const char *xpath, const char *query)
|
|||||||
mquery = mu_query_new (xpath);
|
mquery = mu_query_new (xpath);
|
||||||
g_assert (query);
|
g_assert (query);
|
||||||
|
|
||||||
iter = mu_query_run (mquery, query, NULL, FALSE, 1);
|
iter = mu_query_run (mquery, query, MU_MSG_FIELD_ID_NONE,
|
||||||
|
FALSE, 1);
|
||||||
mu_query_destroy (mquery);
|
mu_query_destroy (mquery);
|
||||||
g_assert (iter);
|
g_assert (iter);
|
||||||
|
|
||||||
|
/* g_printerr ("\n=> %s\n", query); */
|
||||||
|
|
||||||
for (count = 0; !mu_msg_iter_is_done(iter);
|
for (count = 0; !mu_msg_iter_is_done(iter);
|
||||||
mu_msg_iter_next(iter), ++count);
|
mu_msg_iter_next(iter), ++count);
|
||||||
|
|
||||||
@ -100,7 +106,6 @@ test_mu_query_01 (void)
|
|||||||
{ "foo:pepernoot", 0 },
|
{ "foo:pepernoot", 0 },
|
||||||
{ "funky", 1 },
|
{ "funky", 1 },
|
||||||
{ "fünkÿ", 1 },
|
{ "fünkÿ", 1 },
|
||||||
|
|
||||||
};
|
};
|
||||||
xpath = fill_database ();
|
xpath = fill_database ();
|
||||||
g_assert (xpath != NULL);
|
g_assert (xpath != NULL);
|
||||||
@ -135,7 +140,8 @@ test_mu_query_03 (void)
|
|||||||
|
|
||||||
QResults queries[] = {
|
QResults queries[] = {
|
||||||
{ "ploughed", 1},
|
{ "ploughed", 1},
|
||||||
{ "i:3BE9E6535E3029448670913581E7A1A20D852173@emss35m06.us.lmco.com", 1},
|
{ "i:3BE9E6535E3029448670913581E7A1A20D852173@"
|
||||||
|
"emss35m06.us.lmco.com", 1},
|
||||||
|
|
||||||
/* subsets of the words in the subject should match */
|
/* subsets of the words in the subject should match */
|
||||||
{ "s:gcc include search order" , 1},
|
{ "s:gcc include search order" , 1},
|
||||||
@ -170,10 +176,10 @@ test_mu_query_04 (void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
QResults queries[] = {
|
QResults queries[] = {
|
||||||
// { "frodo@example.com", 1},
|
// { "frodo@example.com", 1}, /* does not match: see mu-find (1) */
|
||||||
{ "f:frodo@example.com", 1},
|
{ "f:frodo@example.com", 1},
|
||||||
{ "f:Frodo Baggins", 1},
|
{ "f:Frodo Baggins", 1},
|
||||||
// { "bilbo@anotherexample.com", 1},
|
// { "bilbo@anotherexample.com", 1}, /* same things */
|
||||||
{ "t:bilbo@anotherexample.com", 1},
|
{ "t:bilbo@anotherexample.com", 1},
|
||||||
{ "t:bilbo", 1},
|
{ "t:bilbo", 1},
|
||||||
{ "f:bilbo", 0},
|
{ "f:bilbo", 0},
|
||||||
@ -203,7 +209,8 @@ test_mu_query_05 (void)
|
|||||||
g_assert (xpath != NULL);
|
g_assert (xpath != NULL);
|
||||||
|
|
||||||
query = mu_query_new (xpath);
|
query = mu_query_new (xpath);
|
||||||
iter = mu_query_run (query, "fünkÿ", NULL, FALSE, 1);
|
iter = mu_query_run (query, "fünkÿ", MU_MSG_FIELD_ID_NONE,
|
||||||
|
FALSE, 1);
|
||||||
msg = mu_msg_iter_get_msg (iter);
|
msg = mu_msg_iter_get_msg (iter);
|
||||||
|
|
||||||
g_assert_cmpstr (mu_msg_get_subject(msg),==,
|
g_assert_cmpstr (mu_msg_get_subject(msg),==,
|
||||||
|
|||||||
Reference in New Issue
Block a user