* make test-mu-cfind.c work on other days but 2011-05-19 too...

This commit is contained in:
Dirk-Jan C. Binnema 2011-05-20 08:20:11 +03:00
parent 99a5b4918c
commit ce7c354f74
1 changed files with 24 additions and 13 deletions

View File

@ -80,8 +80,12 @@ test_mu_cfind_plain (void)
static void static void
test_mu_cfind_bbdb (void) test_mu_cfind_bbdb (void)
{ {
gchar *muhome, *cmdline, *output, *erroutput; gchar *muhome, *cmdline, *output, *erroutput, *expected;
gchar today[12];
const char* frm;
struct tm *tmtoday;
time_t now;
muhome = fill_contacts_cache (); muhome = fill_contacts_cache ();
g_assert (muhome != NULL); g_assert (muhome != NULL);
@ -92,23 +96,30 @@ test_mu_cfind_bbdb (void)
output = erroutput = NULL; output = erroutput = NULL;
g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput,
NULL, NULL)); NULL, NULL));
g_assert_cmpstr (output,
==, frm = ";; -*-coding: utf-8-emacs;-*-\n"
";; -*-coding: utf-8-emacs;-*-\n" ";;; file-version: 6\n"
";;; file-version: 6\n" "[\"Helmut\" \"Kröger\" nil nil nil nil (\"hk@testmu.xxx\") "
"((creation-date . \"%s\") "
"[\"Helmut\" \"Kröger\" nil nil nil nil (\"hk@testmu.xxx\") " "(time-stamp . \"1970-01-01\")) nil]\n"
"((creation-date . \"2011-05-19\") " "[\"\" \"\" nil nil nil nil (\"testmu@testmu.xx\") "
"(time-stamp . \"1970-01-01\")) nil]\n" "((creation-date . \"%s\") "
"(time-stamp . \"1970-01-01\")) nil]\n";
"[\"\" \"\" nil nil nil nil (\"testmu@testmu.xx\") " now = time(NULL);
"((creation-date . \"2011-05-19\") " tmtoday = localtime(&now);
"(time-stamp . \"1970-01-01\")) nil]\n"); strftime(today,sizeof(today),"%Y-%m-%d", tmtoday);
expected = g_strdup_printf (frm, today, today);
/* g_print ("\n%s\n", output); */
g_assert_cmpstr (output, ==, expected);
g_free (cmdline); g_free (cmdline);
g_free (muhome); g_free (muhome);
g_free (output); g_free (output);
g_free (erroutput); g_free (erroutput);
g_free (expected);
} }