clang-format: update c/cc coding style
Update all cc code using .clang-format; please do so as well for future PRs etc.; emacs has a handy 'clang-format' mode to make this automatic. For comparing old changes with git blame, we can disregard this one using --ignore-rev (see https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame )
This commit is contained in:
@ -32,105 +32,103 @@
|
||||
#include "test-mu-common.hh"
|
||||
#include <lib/mu-store.hh>
|
||||
|
||||
|
||||
/* Tests For The command line interface, uses testdir2 */
|
||||
|
||||
static gchar*
|
||||
fill_database (void)
|
||||
fill_database(void)
|
||||
{
|
||||
gchar *cmdline, *tmpdir;
|
||||
GError *err;
|
||||
gchar * cmdline, *tmpdir;
|
||||
GError* err;
|
||||
|
||||
tmpdir = test_mu_common_get_random_tmpdir();
|
||||
cmdline = g_strdup_printf (
|
||||
"/bin/sh -c '"
|
||||
"%s init --muhome=%s --maildir=%s --quiet; "
|
||||
"%s index --muhome=%s --quiet'",
|
||||
MU_PROGRAM, tmpdir, MU_TESTMAILDIR2,
|
||||
MU_PROGRAM, tmpdir);
|
||||
tmpdir = test_mu_common_get_random_tmpdir();
|
||||
cmdline = g_strdup_printf("/bin/sh -c '"
|
||||
"%s init --muhome=%s --maildir=%s --quiet; "
|
||||
"%s index --muhome=%s --quiet'",
|
||||
MU_PROGRAM,
|
||||
tmpdir,
|
||||
MU_TESTMAILDIR2,
|
||||
MU_PROGRAM,
|
||||
tmpdir);
|
||||
|
||||
if (g_test_verbose())
|
||||
g_print ("%s\n", cmdline);
|
||||
g_print("%s\n", 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);
|
||||
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);
|
||||
g_free(cmdline);
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_something (const char *what)
|
||||
test_something(const char* what)
|
||||
{
|
||||
char *dir, *cmdline;
|
||||
gint result;
|
||||
gint result;
|
||||
|
||||
dir = fill_database ();
|
||||
cmdline = g_strdup_printf (
|
||||
"GUILE_AUTO_COMPILE=0 "
|
||||
"LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH "
|
||||
"%s -q -L %s -e main %s/test-mu-guile.scm "
|
||||
"--muhome=%s --test=%s",
|
||||
MU_GUILE_LIBRARY_PATH,
|
||||
GUILE_BINARY,
|
||||
MU_GUILE_MODULE_PATH,
|
||||
ABS_SRCDIR,
|
||||
dir,
|
||||
what);
|
||||
dir = fill_database();
|
||||
cmdline = g_strdup_printf("GUILE_AUTO_COMPILE=0 "
|
||||
"LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH "
|
||||
"%s -q -L %s -e main %s/test-mu-guile.scm "
|
||||
"--muhome=%s --test=%s",
|
||||
MU_GUILE_LIBRARY_PATH,
|
||||
GUILE_BINARY,
|
||||
MU_GUILE_MODULE_PATH,
|
||||
ABS_SRCDIR,
|
||||
dir,
|
||||
what);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("cmdline: %s\n", cmdline);
|
||||
if (g_test_verbose())
|
||||
g_print("cmdline: %s\n", cmdline);
|
||||
|
||||
result = system (cmdline);
|
||||
g_assert (result == 0);
|
||||
result = system(cmdline);
|
||||
g_assert(result == 0);
|
||||
|
||||
g_free (dir);
|
||||
g_free (cmdline);
|
||||
g_free(dir);
|
||||
g_free(cmdline);
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_guile_queries (void)
|
||||
test_mu_guile_queries(void)
|
||||
{
|
||||
test_something ("queries");
|
||||
test_something("queries");
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_guile_messages (void)
|
||||
test_mu_guile_messages(void)
|
||||
{
|
||||
test_something ("message");
|
||||
test_something("message");
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_guile_stats (void)
|
||||
test_mu_guile_stats(void)
|
||||
{
|
||||
test_something ("stats");
|
||||
test_something("stats");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
int rv;
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
g_test_init(&argc, &argv, NULL);
|
||||
|
||||
if (!set_en_us_utf8_locale())
|
||||
return 0; /* don't error out... */
|
||||
|
||||
g_test_add_func ("/guile/queries", test_mu_guile_queries);
|
||||
g_test_add_func ("/guile/message", test_mu_guile_messages);
|
||||
g_test_add_func ("/guile/stats", test_mu_guile_stats);
|
||||
g_test_add_func("/guile/queries", test_mu_guile_queries);
|
||||
g_test_add_func("/guile/message", test_mu_guile_messages);
|
||||
g_test_add_func("/guile/stats", test_mu_guile_stats);
|
||||
|
||||
g_log_set_handler (NULL,
|
||||
(GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_LEVEL_WARNING|
|
||||
G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION),
|
||||
(GLogFunc)black_hole, NULL);
|
||||
g_log_set_handler(NULL,
|
||||
(GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_LEVEL_WARNING |
|
||||
G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
|
||||
(GLogFunc)black_hole,
|
||||
NULL);
|
||||
|
||||
rv = g_test_run ();
|
||||
rv = g_test_run();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user