Fix tests on the date format for FreeBSD and MacOS X.

Related to MR !2433
This commit is contained in:
Emmanuel Fleury 2022-02-03 17:19:52 +01:00
parent 62ee602db4
commit fd52a39abc

View File

@ -692,26 +692,7 @@ test_strftime (void)
{ "%y", "01" },
{ "%z", "" },
{ "%%", "%" },
#ifndef G_OS_WIN32
{ "%B", "January" },
{ "%b", "Jan" },
{ "%C", "0" },
{ "%c", "Mon Jan 1 00:00:00 1" },
{ "%E", "%E" },
{ "%F", "1-01-01" },
{ "%G", "1" },
{ "%g", "01" },
{ "%h", "Jan" },
{ "%k", " 0" },
{ "%l", "12" },
{ "%O", "%O" },
{ "%P", "am" },
{ "%r", "12:00:00 AM" },
{ "%X", "00:00:00" },
{ "%x", "01/01/01" },
{ "%Y", "1" },
{ "%Z", "" },
#else /* G_OS_WIN32 */
#if defined(G_OS_WIN32)
{ "%C", "00" },
{ "%c", " 12:00:00 AM" },
{ "%E", "" },
@ -728,6 +709,38 @@ test_strftime (void)
{ "%x", "" },
{ "%Y", "0001" },
{ "%Z", "Pacific Standard Time" },
#else
{ "%B", "January" },
{ "%b", "Jan" },
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
{ "%C", "00" },
{ "%c", "Mon Jan 1 00:00:00 0001" },
{ "%E", "E" },
{ "%F", "0001-01-01" },
{ "%G", "0001" },
{ "%O", "O" },
{ "%P", "P" },
{ "%Y", "0001" },
#else
{ "%C", "0" },
{ "%c", "Mon Jan 1 00:00:00 1" },
{ "%E", "%E" },
{ "%F", "1-01-01" },
{ "%G", "1" },
{ "%O", "%O" },
{ "%P", "am" },
{ "%Y", "1" },
#endif
{ "%g", "01" },
{ "%h", "Jan" },
{ "%k", " 0" },
{ "%l", "12" },
{ "%P", "am" },
{ "%r", "12:00:00 AM" },
{ "%X", "00:00:00" },
{ "%x", "01/01/01" },
{ "%Y", "1" },
{ "%Z", "" },
#endif
};
@ -774,9 +787,6 @@ test_strftime (void)
for (i = 0; i < G_N_ELEMENTS (strftime_checks); i++)
{
g_date_strftime (buf, 100, strftime_checks[i].format, d);
g_test_message ("Input[%zu]: \"%s\", Output: \"%s\", Expect: \"%s\"",
i, strftime_checks[i].format,
buf, strftime_checks[i].expect);
g_assert_cmpstr (buf, ==, strftime_checks[i].expect);
}