* some better error reporting in test cases
This commit is contained in:
@ -34,26 +34,33 @@
|
||||
#include "test-mu-common.h"
|
||||
#include "mu-store.h"
|
||||
|
||||
|
||||
|
||||
static gchar*
|
||||
fill_contacts_cache (void)
|
||||
{
|
||||
gchar *cmdline, *tmpdir;
|
||||
GError *err;
|
||||
|
||||
tmpdir = test_mu_common_get_random_tmpdir();
|
||||
cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s"
|
||||
" --quiet",
|
||||
MU_PROGRAM, tmpdir, MU_TESTMAILDIR);
|
||||
MU_PROGRAM,
|
||||
tmpdir, MU_TESTMAILDIR);
|
||||
if (g_test_verbose())
|
||||
g_print ("%s\n", cmdline);
|
||||
|
||||
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||
NULL, NULL));
|
||||
g_free (cmdline);
|
||||
err = NULL;
|
||||
if (!g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||
NULL, &err)) {
|
||||
g_printerr ("Error: %s\n", err ? err->message : "?");
|
||||
g_assert (0);
|
||||
}
|
||||
|
||||
g_free (cmdline);
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_mu_cfind_plain (void)
|
||||
{
|
||||
|
||||
@ -41,6 +41,7 @@ static gchar*
|
||||
fill_database (void)
|
||||
{
|
||||
gchar *cmdline, *tmpdir;
|
||||
GError *err;
|
||||
|
||||
tmpdir = test_mu_common_get_random_tmpdir();
|
||||
cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s"
|
||||
@ -50,13 +51,18 @@ fill_database (void)
|
||||
if (g_test_verbose())
|
||||
g_print ("%s\n", cmdline);
|
||||
|
||||
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||
NULL, NULL));
|
||||
g_free (cmdline);
|
||||
err = NULL;
|
||||
if (!g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||
NULL, &err)) {
|
||||
g_printerr ("Error: %s\n", err ? err->message : "?");
|
||||
g_assert (0);
|
||||
}
|
||||
|
||||
g_free (cmdline);
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
|
||||
static unsigned
|
||||
newlines_in_output (const char* str)
|
||||
{
|
||||
|
||||
@ -35,14 +35,22 @@ static gchar*
|
||||
fill_database (void)
|
||||
{
|
||||
gchar *cmdline, *tmpdir;
|
||||
GError *err;
|
||||
|
||||
tmpdir = test_mu_common_get_random_tmpdir();
|
||||
cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s"
|
||||
" --quiet",
|
||||
MU_PROGRAM, tmpdir, MU_TESTMAILDIR);
|
||||
|
||||
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||
NULL, NULL));
|
||||
err = NULL;
|
||||
if (!g_spawn_command_line_sync (cmdline, NULL, NULL,
|
||||
NULL, &err)) {
|
||||
g_printerr ("Error: %s\n", err ? err->message : "?");
|
||||
g_clear_error (&err);
|
||||
g_assert (0);
|
||||
}
|
||||
|
||||
g_clear_error (&err);
|
||||
g_free (cmdline);
|
||||
|
||||
return tmpdir;
|
||||
|
||||
@ -523,11 +523,15 @@ test_mu_query_attach (void)
|
||||
xpath = fill_database (MU_TESTMAILDIR2);
|
||||
g_assert (xpath != NULL);
|
||||
|
||||
/* g_print ("(%s)\n", xpath); */
|
||||
if (g_test_verbose())
|
||||
g_print ("(%s)\n", xpath);
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i) {
|
||||
if (g_test_verbose())
|
||||
g_print ("query: %s\n", queries[i].query);
|
||||
g_assert_cmpuint (run_and_count_matches (xpath, queries[i].query),
|
||||
==, queries[i].count);
|
||||
}
|
||||
|
||||
g_free (xpath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user