[glib/win32-enhance-gtimezone: 53/53] glib/tests/gdatetime.c: Clean up previous commit



commit e8a8ffd941ce11e2a12c0d1cb17c67de8fd1d216
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jul 5 16:09:15 2019 +0800

    glib/tests/gdatetime.c: Clean up previous commit
    
    Incororate Philip's suggestions to make test code cleaner.

 glib/tests/gdatetime.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 891b10b21..c76715af2 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -2408,6 +2408,12 @@ test_identifier (void)
   GTimeZone *tz;
   gchar *old_tz = g_strdup (g_getenv ("TZ"));
 
+#ifdef G_OS_WIN32
+  const char *recife_tz = "SA Eastern Standard Time";
+#else
+  const char *recife_tz = "America/Recife";
+#endif
+
   tz = g_time_zone_new ("UTC");
   g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "UTC");
   g_time_zone_unref (tz);
@@ -2437,21 +2443,12 @@ test_identifier (void)
   g_time_zone_unref (tz);
 
   /* Local timezone tests. */
-#ifdef G_OS_WIN32
-  if (g_setenv ("TZ", "SA Eastern Standard Time", TRUE))
+  if (g_setenv ("TZ", recife_tz, TRUE))
     {
       tz = g_time_zone_new_local ();
-      g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "SA Eastern Standard Time");
+      g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, recife_tz);
       g_time_zone_unref (tz);
     }
-#else
-  if (g_setenv ("TZ", "America/Recife", TRUE))
-    {
-      tz = g_time_zone_new_local ();
-      g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "America/Recife");
-      g_time_zone_unref (tz);
-    }
-#endif
 
   if (g_setenv ("TZ", "some rubbish", TRUE))
     {


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