mirror of https://github.com/djcb/mu.git
* updated test cases; in particular, use g_test_verbose
This commit is contained in:
parent
273ed47eb6
commit
1a2614ec98
|
@ -115,7 +115,7 @@ test_mu_index (void)
|
||||||
store = mu_store_new_read_only (xpath, NULL);
|
store = mu_store_new_read_only (xpath, NULL);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
|
|
||||||
g_assert_cmpuint (mu_store_count (store), ==, 9);
|
g_assert_cmpuint (mu_store_count (store, NULL), ==, 9);
|
||||||
mu_store_unref (store);
|
mu_store_unref (store);
|
||||||
|
|
||||||
g_free (muhome);
|
g_free (muhome);
|
||||||
|
|
|
@ -46,7 +46,8 @@ fill_database (const char *testdir)
|
||||||
" --quiet",
|
" --quiet",
|
||||||
MU_PROGRAM, tmpdir, testdir);
|
MU_PROGRAM, tmpdir, testdir);
|
||||||
|
|
||||||
/* g_printerr ("\n%s\n", cmdline); */
|
if (g_test_verbose())
|
||||||
|
g_printerr ("\n%s\n", cmdline);
|
||||||
|
|
||||||
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
|
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||||
NULL, NULL));
|
NULL, NULL));
|
||||||
|
@ -99,15 +100,14 @@ run_and_count_matches (const char *xpath, const char *query)
|
||||||
|
|
||||||
mu_store_unref (store);
|
mu_store_unref (store);
|
||||||
|
|
||||||
/* g_printerr ("\n=>'%s'\n", query); */
|
if (g_test_verbose()) {
|
||||||
|
char *xs;
|
||||||
/* { /\* debug *\/ */
|
g_printerr ("\n=>'%s'\n", query);
|
||||||
/* char *xs; */
|
g_print ("query : '%s'\n", query);
|
||||||
/* g_print ("query : '%s'\n", query); */
|
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, NULL);
|
FALSE, NULL);
|
||||||
|
@ -161,7 +161,6 @@ test_mu_query_01 (void)
|
||||||
{ "", 13 }
|
{ "", 13 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
xpath = fill_database (MU_TESTMAILDIR);
|
xpath = fill_database (MU_TESTMAILDIR);
|
||||||
g_assert (xpath != NULL);
|
g_assert (xpath != NULL);
|
||||||
|
|
||||||
|
@ -394,7 +393,6 @@ test_mu_query_dates_sydney (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}, */
|
||||||
|
@ -598,9 +596,10 @@ main (int argc, char *argv[])
|
||||||
g_test_add_func ("/mu-query/test-mu-query-tags_02",
|
g_test_add_func ("/mu-query/test-mu-query-tags_02",
|
||||||
test_mu_query_tags_02);
|
test_mu_query_tags_02);
|
||||||
|
|
||||||
g_log_set_handler (NULL,
|
if (!g_test_verbose())
|
||||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
g_log_set_handler (NULL,
|
||||||
(GLogFunc)black_hole, NULL);
|
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||||
|
(GLogFunc)black_hole, NULL);
|
||||||
|
|
||||||
rv = g_test_run ();
|
rv = g_test_run ();
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,11 @@ test_mu_store_new_destroy (void)
|
||||||
g_assert (tmpdir);
|
g_assert (tmpdir);
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
store = mu_store_new_writable (tmpdir, NULL, &err);
|
store = mu_store_new_writable (tmpdir, NULL, FALSE, &err);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
g_assert (err == NULL);
|
g_assert (err == NULL);
|
||||||
|
|
||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
|
||||||
|
|
||||||
mu_store_flush (store);
|
mu_store_flush (store);
|
||||||
mu_store_unref (store);
|
mu_store_unref (store);
|
||||||
|
@ -68,7 +68,7 @@ test_mu_store_version (void)
|
||||||
g_assert (tmpdir);
|
g_assert (tmpdir);
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
store = mu_store_new_writable (tmpdir, NULL, &err);
|
store = mu_store_new_writable (tmpdir, NULL, FALSE, &err);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
mu_store_unref (store);
|
mu_store_unref (store);
|
||||||
store = mu_store_new_read_only (tmpdir, &err);
|
store = mu_store_new_read_only (tmpdir, &err);
|
||||||
|
@ -76,7 +76,7 @@ test_mu_store_version (void)
|
||||||
|
|
||||||
g_assert (err == NULL);
|
g_assert (err == NULL);
|
||||||
|
|
||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
|
||||||
g_assert_cmpstr (MU_STORE_SCHEMA_VERSION,==,
|
g_assert_cmpstr (MU_STORE_SCHEMA_VERSION,==,
|
||||||
mu_store_version(store));
|
mu_store_version(store));
|
||||||
|
|
||||||
|
@ -95,10 +95,10 @@ test_mu_store_store_msg_and_count (void)
|
||||||
tmpdir = test_mu_common_get_random_tmpdir();
|
tmpdir = test_mu_common_get_random_tmpdir();
|
||||||
g_assert (tmpdir);
|
g_assert (tmpdir);
|
||||||
|
|
||||||
store = mu_store_new_writable (tmpdir, NULL, NULL);
|
store = mu_store_new_writable (tmpdir, NULL, FALSE, NULL);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
|
|
||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
|
||||||
|
|
||||||
/* add one */
|
/* add one */
|
||||||
msg = mu_msg_new_from_file (
|
msg = mu_msg_new_from_file (
|
||||||
|
@ -106,10 +106,10 @@ test_mu_store_store_msg_and_count (void)
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
g_assert (msg);
|
g_assert (msg);
|
||||||
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
||||||
g_assert_cmpuint (1,==,mu_store_count (store));
|
g_assert_cmpuint (1,==,mu_store_count (store, NULL));
|
||||||
g_assert_cmpuint (TRUE,==,mu_store_contains_message
|
g_assert_cmpuint (TRUE,==,mu_store_contains_message
|
||||||
(store,
|
(store,
|
||||||
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
|
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,", NULL));
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
|
|
||||||
/* add another one */
|
/* add another one */
|
||||||
|
@ -117,10 +117,10 @@ test_mu_store_store_msg_and_count (void)
|
||||||
"bar/cur/mail3", NULL, NULL);
|
"bar/cur/mail3", NULL, NULL);
|
||||||
g_assert (msg);
|
g_assert (msg);
|
||||||
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
||||||
g_assert_cmpuint (2,==,mu_store_count (store));
|
g_assert_cmpuint (2,==,mu_store_count (store, NULL));
|
||||||
g_assert_cmpuint (TRUE,==,
|
g_assert_cmpuint (TRUE,==,
|
||||||
mu_store_contains_message (store, MU_TESTMAILDIR2
|
mu_store_contains_message (store, MU_TESTMAILDIR2
|
||||||
"bar/cur/mail3"));
|
"bar/cur/mail3", NULL));
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
|
|
||||||
/* try to add the first one again. count should be 2 still */
|
/* try to add the first one again. count should be 2 still */
|
||||||
|
@ -129,7 +129,7 @@ test_mu_store_store_msg_and_count (void)
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
g_assert (msg);
|
g_assert (msg);
|
||||||
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
||||||
g_assert_cmpuint (2,==,mu_store_count (store));
|
g_assert_cmpuint (2,==,mu_store_count (store, NULL));
|
||||||
|
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
|
|
||||||
|
@ -148,10 +148,10 @@ test_mu_store_store_msg_remove_and_count (void)
|
||||||
tmpdir = test_mu_common_get_random_tmpdir();
|
tmpdir = test_mu_common_get_random_tmpdir();
|
||||||
g_assert (tmpdir);
|
g_assert (tmpdir);
|
||||||
|
|
||||||
store = mu_store_new_writable (tmpdir, NULL, NULL);
|
store = mu_store_new_writable (tmpdir, NULL, FALSE, NULL);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
|
|
||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
|
||||||
|
|
||||||
/* add one */
|
/* add one */
|
||||||
err = NULL;
|
err = NULL;
|
||||||
|
@ -160,16 +160,16 @@ test_mu_store_store_msg_remove_and_count (void)
|
||||||
NULL, &err);
|
NULL, &err);
|
||||||
g_assert (msg);
|
g_assert (msg);
|
||||||
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
g_assert_cmpuint (mu_store_store_msg (store, msg, TRUE), ==, TRUE);
|
||||||
g_assert_cmpuint (1,==,mu_store_count (store));
|
g_assert_cmpuint (1,==,mu_store_count (store, NULL));
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
|
|
||||||
/* remove one */
|
/* remove one */
|
||||||
mu_store_remove_path (store,
|
mu_store_remove_path (store,
|
||||||
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,");
|
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,");
|
||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
|
||||||
g_assert_cmpuint (FALSE,==,mu_store_contains_message
|
g_assert_cmpuint (FALSE,==,mu_store_contains_message
|
||||||
(store,
|
(store,
|
||||||
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
|
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,", NULL));
|
||||||
|
|
||||||
mu_store_unref (store);
|
mu_store_unref (store);
|
||||||
}
|
}
|
||||||
|
@ -189,9 +189,11 @@ main (int argc, char *argv[])
|
||||||
test_mu_store_store_msg_and_count);
|
test_mu_store_store_msg_and_count);
|
||||||
g_test_add_func ("/mu-store/mu-store-store-remove-and-count",
|
g_test_add_func ("/mu-store/mu-store-store-remove-and-count",
|
||||||
test_mu_store_store_msg_remove_and_count);
|
test_mu_store_store_msg_remove_and_count);
|
||||||
g_log_set_handler (NULL,
|
|
||||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
if (!g_test_verbose())
|
||||||
(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);
|
||||||
|
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue