* update test cases for other changes
This commit is contained in:
@ -116,7 +116,7 @@ test_mu_index (void)
|
||||
g_assert (store);
|
||||
|
||||
g_assert_cmpuint (mu_store_count (store), ==, 9);
|
||||
mu_store_destroy (store);
|
||||
mu_store_unref (store);
|
||||
|
||||
g_free (muhome);
|
||||
g_free (xpath);
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-query.h"
|
||||
#include "src/mu-str.h"
|
||||
|
||||
#include "src/mu-store.h"
|
||||
|
||||
static gchar*
|
||||
fill_database (const char *testdir)
|
||||
@ -69,7 +69,8 @@ assert_no_dups (MuMsgIter *iter)
|
||||
|
||||
mu_msg_iter_reset (iter);
|
||||
while (!mu_msg_iter_is_done(iter)) {
|
||||
MuMsg *msg = mu_msg_iter_get_msg (iter, NULL);
|
||||
MuMsg *msg;
|
||||
msg = mu_msg_iter_get_msg_floating (iter);
|
||||
/* make sure there are no duplicates */
|
||||
g_assert (!g_hash_table_lookup (hash, mu_msg_get_path (msg)));
|
||||
g_hash_table_insert (hash, g_strdup (mu_msg_get_path(msg)),
|
||||
@ -87,11 +88,17 @@ run_and_count_matches (const char *xpath, const char *query)
|
||||
{
|
||||
MuQuery *mquery;
|
||||
MuMsgIter *iter;
|
||||
MuStore *store;
|
||||
guint count1, count2;
|
||||
|
||||
mquery = mu_query_new (xpath, NULL);
|
||||
store = mu_store_new_read_only (xpath, NULL);
|
||||
g_assert (store);
|
||||
|
||||
mquery = mu_query_new (store, NULL);
|
||||
g_assert (query);
|
||||
|
||||
mu_store_unref (store);
|
||||
|
||||
/* g_printerr ("\n=>'%s'\n", query); */
|
||||
|
||||
/* { /\* debug *\/ */
|
||||
@ -257,6 +264,7 @@ test_mu_query_accented_chars_01 (void)
|
||||
MuQuery *query;
|
||||
MuMsgIter *iter;
|
||||
MuMsg *msg;
|
||||
MuStore *store;
|
||||
gchar *xpath;
|
||||
GError *err;
|
||||
gchar *summ;
|
||||
@ -264,11 +272,16 @@ test_mu_query_accented_chars_01 (void)
|
||||
xpath = fill_database (MU_TESTMAILDIR);
|
||||
g_assert (xpath != NULL);
|
||||
|
||||
query = mu_query_new (xpath, NULL);
|
||||
store = mu_store_new_read_only (xpath, NULL);
|
||||
g_assert (store);
|
||||
|
||||
query = mu_query_new (store, NULL);
|
||||
mu_store_unref (store);
|
||||
|
||||
iter = mu_query_run (query, "fünkÿ", FALSE, MU_MSG_FIELD_ID_NONE,
|
||||
FALSE, NULL);
|
||||
err = NULL;
|
||||
msg = mu_msg_iter_get_msg (iter, &err); /* don't unref */
|
||||
msg = mu_msg_iter_get_msg_floating (iter); /* don't unref */
|
||||
if (!msg) {
|
||||
g_warning ("error getting message: %s", err->message);
|
||||
g_error_free (err);
|
||||
@ -585,9 +598,9 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/mu-query/test-mu-query-tags_02",
|
||||
test_mu_query_tags_02);
|
||||
|
||||
/* g_log_set_handler (NULL, */
|
||||
/* G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, */
|
||||
/* (GLogFunc)black_hole, NULL); */
|
||||
g_log_set_handler (NULL,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
(GLogFunc)black_hole, NULL);
|
||||
|
||||
rv = g_test_run ();
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ test_mu_store_new_destroy (void)
|
||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
||||
|
||||
mu_store_flush (store);
|
||||
mu_store_destroy (store);
|
||||
mu_store_unref (store);
|
||||
|
||||
g_free (tmpdir);
|
||||
}
|
||||
@ -70,17 +70,17 @@ test_mu_store_version (void)
|
||||
err = NULL;
|
||||
store = mu_store_new_writable (tmpdir, NULL, &err);
|
||||
g_assert (store);
|
||||
mu_store_destroy (store);
|
||||
mu_store_unref (store);
|
||||
store = mu_store_new_read_only (tmpdir, &err);
|
||||
g_assert (store);
|
||||
|
||||
g_assert (err == NULL);
|
||||
|
||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
||||
g_assert_cmpstr (MU_XAPIAN_DB_VERSION,==,
|
||||
g_assert_cmpstr (MU_STORE_SCHEMA_VERSION,==,
|
||||
mu_store_version(store));
|
||||
|
||||
mu_store_destroy (store);
|
||||
mu_store_unref (store);
|
||||
g_free (tmpdir);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ test_mu_store_store_msg_and_count (void)
|
||||
|
||||
mu_msg_unref (msg);
|
||||
|
||||
mu_store_destroy (store);
|
||||
mu_store_unref (store);
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ test_mu_store_store_msg_remove_and_count (void)
|
||||
(store,
|
||||
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
|
||||
|
||||
mu_store_destroy (store);
|
||||
mu_store_unref (store);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -60,9 +60,14 @@ static MuMsgIter*
|
||||
run_and_get_iter (const char *xpath, const char *query)
|
||||
{
|
||||
MuQuery *mquery;
|
||||
MuStore *store;
|
||||
MuMsgIter *iter;
|
||||
|
||||
mquery = mu_query_new (xpath, NULL);
|
||||
store = mu_store_new_read_only (xpath, NULL);
|
||||
g_assert (store);
|
||||
|
||||
mquery = mu_query_new (store, NULL);
|
||||
mu_store_unref (store);
|
||||
g_assert (query);
|
||||
|
||||
iter = mu_query_run (mquery, query, TRUE, MU_MSG_FIELD_ID_DATE,
|
||||
@ -116,12 +121,12 @@ test_mu_threads_01 (void)
|
||||
|
||||
ti = mu_msg_iter_get_thread_info (iter);
|
||||
if (!ti)
|
||||
g_print ("%s: thread info not found\n",
|
||||
mu_msg_get_msgid(mu_msg_iter_get_msg (iter, NULL)));
|
||||
|
||||
g_print ("%s: thread info not found for %u\n",
|
||||
__FUNCTION__, (unsigned)mu_msg_iter_get_docid(iter));
|
||||
g_assert(ti);
|
||||
|
||||
msg = mu_msg_iter_get_msg (iter, NULL);
|
||||
msg = mu_msg_iter_get_msg_floating (iter);
|
||||
g_assert (msg);
|
||||
/* g_print ("%s %s %s\n", ti->threadpath, */
|
||||
/* mu_msg_get_msgid(msg), */
|
||||
/* mu_msg_get_path (msg) */
|
||||
@ -181,7 +186,7 @@ test_mu_threads_rogue (void)
|
||||
|
||||
/* due to the random order in files can be indexed, there are two possible ways
|
||||
* for the threads to be built-up; both are okay */
|
||||
if (g_strcmp0 (mu_msg_get_msgid(mu_msg_iter_get_msg (iter, NULL)),
|
||||
if (g_strcmp0 (mu_msg_get_msgid(mu_msg_iter_get_msg_floating (iter)),
|
||||
"cycle0@msg.id") == 0)
|
||||
items = items1;
|
||||
else
|
||||
@ -195,11 +200,10 @@ test_mu_threads_rogue (void)
|
||||
ti = mu_msg_iter_get_thread_info (iter);
|
||||
if (!ti)
|
||||
g_print ("%s: thread info not found\n",
|
||||
mu_msg_get_msgid(mu_msg_iter_get_msg (iter, NULL)));
|
||||
|
||||
mu_msg_get_msgid(mu_msg_iter_get_msg_floating (iter)));
|
||||
g_assert(ti);
|
||||
|
||||
msg = mu_msg_iter_get_msg (iter, NULL);
|
||||
msg = mu_msg_iter_get_msg_floating (iter); /* don't unref */
|
||||
/* g_print ("%s %s %s\n", ti->threadpath, */
|
||||
/* mu_msg_get_msgid(msg), */
|
||||
/* mu_msg_get_path (msg) */
|
||||
@ -232,9 +236,9 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/mu-query/test-mu-threads-01", test_mu_threads_01);
|
||||
g_test_add_func ("/mu-query/test-mu-threads-rogue", test_mu_threads_rogue);
|
||||
|
||||
/* g_log_set_handler (NULL, */
|
||||
/* G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, */
|
||||
/* (GLogFunc)black_hole, NULL); */
|
||||
g_log_set_handler (NULL,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
(GLogFunc)black_hole, NULL);
|
||||
|
||||
rv = g_test_run ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user