* updated test cases; in particular, use g_test_verbose

This commit is contained in:
Dirk-Jan C. Binnema
2011-09-03 10:51:00 +03:00
parent 273ed47eb6
commit 1a2614ec98
3 changed files with 36 additions and 35 deletions

View File

@ -44,11 +44,11 @@ test_mu_store_new_destroy (void)
g_assert (tmpdir);
err = NULL;
store = mu_store_new_writable (tmpdir, NULL, &err);
store = mu_store_new_writable (tmpdir, NULL, FALSE, &err);
g_assert (store);
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_unref (store);
@ -68,7 +68,7 @@ test_mu_store_version (void)
g_assert (tmpdir);
err = NULL;
store = mu_store_new_writable (tmpdir, NULL, &err);
store = mu_store_new_writable (tmpdir, NULL, FALSE, &err);
g_assert (store);
mu_store_unref (store);
store = mu_store_new_read_only (tmpdir, &err);
@ -76,7 +76,7 @@ test_mu_store_version (void)
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,==,
mu_store_version(store));
@ -95,10 +95,10 @@ test_mu_store_store_msg_and_count (void)
tmpdir = test_mu_common_get_random_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_cmpuint (0,==,mu_store_count (store));
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
/* add one */
msg = mu_msg_new_from_file (
@ -106,10 +106,10 @@ test_mu_store_store_msg_and_count (void)
NULL, NULL);
g_assert (msg);
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
(store,
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,", NULL));
mu_msg_unref (msg);
/* add another one */
@ -117,10 +117,10 @@ test_mu_store_store_msg_and_count (void)
"bar/cur/mail3", NULL, NULL);
g_assert (msg);
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,==,
mu_store_contains_message (store, MU_TESTMAILDIR2
"bar/cur/mail3"));
"bar/cur/mail3", NULL));
mu_msg_unref (msg);
/* 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);
g_assert (msg);
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);
@ -148,10 +148,10 @@ test_mu_store_store_msg_remove_and_count (void)
tmpdir = test_mu_common_get_random_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_cmpuint (0,==,mu_store_count (store));
g_assert_cmpuint (0,==,mu_store_count (store, NULL));
/* add one */
err = NULL;
@ -160,16 +160,16 @@ test_mu_store_store_msg_remove_and_count (void)
NULL, &err);
g_assert (msg);
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);
/* remove one */
mu_store_remove_path (store,
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
(store,
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,", NULL));
mu_store_unref (store);
}
@ -189,9 +189,11 @@ main (int argc, char *argv[])
test_mu_store_store_msg_and_count);
g_test_add_func ("/mu-store/mu-store-store-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,
(GLogFunc)black_hole, NULL);
if (!g_test_verbose())
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 ();
}