* mu_msg_str: sanitize date strings a bit, update test case

This commit is contained in:
Dirk-Jan C. Binnema 2010-11-02 21:14:24 +02:00
parent a4ea979aaa
commit a10525d3c9
2 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ mu_msg_str_date_s (time_t t)
tmbuf = localtime(&t); tmbuf = localtime(&t);
strftime (buf, sizeof(buf), "%c", tmbuf); strftime (buf, sizeof(buf), "%x", tmbuf);
return buf; return buf;
} }

View File

@ -17,7 +17,7 @@
** **
*/ */
#ifdef HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif /*HAVE_CONFIG_H*/ #endif /*HAVE_CONFIG_H*/
@ -41,7 +41,7 @@ test_mu_msg_str_date_01 (void)
some_time = 1234567890; some_time = 1234567890;
tmbuf = localtime (&some_time); tmbuf = localtime (&some_time);
strftime (buf, 64, "%c", tmbuf); strftime (buf, 64, "%x", tmbuf);
/* $ date -ud@1234567890; Fri Feb 13 23:31:30 UTC 2009 */ /* $ date -ud@1234567890; Fri Feb 13 23:31:30 UTC 2009 */
g_assert_cmpstr (mu_msg_str_date_s (some_time), ==, buf); g_assert_cmpstr (mu_msg_str_date_s (some_time), ==, buf);
@ -49,7 +49,7 @@ test_mu_msg_str_date_01 (void)
/* date -ud@987654321 Thu Apr 19 04:25:21 UTC 2001 */ /* date -ud@987654321 Thu Apr 19 04:25:21 UTC 2001 */
some_time = 987654321; some_time = 987654321;
tmbuf = localtime (&some_time); tmbuf = localtime (&some_time);
strftime (buf, 64, "%c", tmbuf); strftime (buf, 64, "%x", tmbuf);
tmp = mu_msg_str_date (some_time); tmp = mu_msg_str_date (some_time);
g_assert_cmpstr (tmp, ==, buf); g_assert_cmpstr (tmp, ==, buf);