[glib/win32-enhance-gtimezone: 9/9] glib/tests/gdatetime.c: Fix TZ envvar test on Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/win32-enhance-gtimezone: 9/9] glib/tests/gdatetime.c: Fix TZ envvar test on Windows
- Date: Fri, 5 Jul 2019 10:54:19 +0000 (UTC)
commit 5d54727180b46765c30a51e7ebbb2a743f4120c2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Jun 13 16:53:45 2019 +0800
glib/tests/gdatetime.c: Fix TZ envvar test on Windows
Windows does not recognize the "America/Recife" as a valid timezone
identifier, so setting the TZ envvar to that will result in "UTC" to
be returned on Windows.
Instead, set TZ to be the Windows equivilant "SA Eastern Standard
Time", and see whether that is indeed our identifier when we create the
GTimeZone using that.
glib/tests/gdatetime.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index ff2f89a61..32dd69283 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -2416,6 +2416,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);
@@ -2445,10 +2451,10 @@ test_identifier (void)
g_time_zone_unref (tz);
/* Local timezone tests. */
- if (g_setenv ("TZ", "America/Recife", TRUE))
+ if (g_setenv ("TZ", recife_tz, TRUE))
{
tz = g_time_zone_new_local ();
- g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "America/Recife");
+ g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, recife_tz);
g_time_zone_unref (tz);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]