[glib/win32-enhance-gtimezone-2-60: 4/4] 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-2-60: 4/4] glib/tests/gdatetime.c: Fix TZ envvar test on Windows
- Date: Thu, 13 Jun 2019 09:09:43 +0000 (UTC)
commit 31dd71e011e1cf8292d4b9497463a4692f4f4b5b
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 "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 | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 4e6559ad8..c805a8edf 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -2441,12 +2441,21 @@ test_identifier (void)
g_time_zone_unref (tz);
/* Local timezone tests. */
+#ifdef G_OS_WIN32
+ if (g_setenv ("TZ", "SA Eastern Standard Time", TRUE))
+ {
+ tz = g_time_zone_new_local ();
+ g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "SA Eastern Standard Time");
+ 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]