[glib: 1/2] Fix tests on the date format for FreeBSD and MacOS X.




commit fd52a39abca5a74738587b69fb3d9df802191de8
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Thu Feb 3 17:19:52 2022 +0100

    Fix tests on the date format for FreeBSD and MacOS X.
    
    Related to MR !2433

 glib/tests/date.c | 54 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/glib/tests/date.c b/glib/tests/date.c
index 876e55756..0162d8887 100644
--- a/glib/tests/date.c
+++ b/glib/tests/date.c
@@ -692,42 +692,55 @@ 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" },
+    { "%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" },
-    { "%O", "%O" },
     { "%P", "am" },
     { "%r", "12:00:00 AM" },
     { "%X", "00:00:00" },
     { "%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,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);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]