[glib/wip/emmanuel.fleury/fix_test_date] Fix test on the date format for FreeBSD and MacOS X.
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/emmanuel.fleury/fix_test_date] Fix test on the date format for FreeBSD and MacOS X.
- Date: Fri, 4 Feb 2022 11:26:28 +0000 (UTC)
commit 3b725f15b361fbace76e581f6cac9d79f8ed5237
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Thu Feb 3 17:19:52 2022 +0100
Fix test on the date format for FreeBSD and MacOS X.
... and dump the output of FreeBSD to know what is wrong
Related to MR !2433
glib/tests/date.c | 49 +++++++++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/glib/tests/date.c b/glib/tests/date.c
index 876e55756..66aa901a0 100644
--- a/glib/tests/date.c
+++ b/glib/tests/date.c
@@ -692,10 +692,31 @@ test_strftime (void)
{ "%y", "01" },
{ "%z", "" },
{ "%%", "%" },
-#ifndef G_OS_WIN32
+#if defined(G_OS_WIN32)
+ { "%C", "00" },
+ { "%c", " 12:00:00 AM" },
+ { "%E", "" },
+ { "%F", "" },
+ { "%G", "" },
+ { "%g", "" },
+ { "%h", "" },
+ { "%k", "" },
+ { "%l", "" },
+ { "%O", "" },
+ { "%P", "" },
+ { "%r", "12:00:00AM" },
+ { "%X", "12:00:00 AM" },
+ { "%x", "" },
+ { "%Y", "0001" },
+ { "%Z", "Pacific Standard Time" },
+#else
{ "%B", "January" },
{ "%b", "Jan" },
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+ { "%C", "00" },
+#else
{ "%C", "0" },
+#endif
{ "%c", "Mon Jan 1 00:00:00 1" },
{ "%E", "%E" },
{ "%F", "1-01-01" },
@@ -711,23 +732,6 @@ test_strftime (void)
{ "%x", "01/01/01" },
{ "%Y", "1" },
{ "%Z", "" },
-#else /* G_OS_WIN32 */
- { "%C", "00" },
- { "%c", " 12:00:00 AM" },
- { "%E", "" },
- { "%F", "" },
- { "%G", "" },
- { "%g", "" },
- { "%h", "" },
- { "%k", "" },
- { "%l", "" },
- { "%O", "" },
- { "%P", "" },
- { "%r", "12:00:00AM" },
- { "%X", "12:00:00 AM" },
- { "%x", "" },
- { "%Y", "0001" },
- { "%Z", "Pacific Standard Time" },
#endif
};
@@ -774,10 +778,11 @@ 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);
+ if (strcmp (buf, strftime_checks[i].expect))
+ 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);
}
g_date_free (d);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]