diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-06-13 16:53:45 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-07-05 18:52:02 +0800 |
commit | 5d54727180b46765c30a51e7ebbb2a743f4120c2 (patch) | |
tree | 2550a39eab0c9786c7ad9df97e5a63b39f535708 | |
parent | f24444c585d5668e3b19dee41976eba2c7e3d27b (diff) | |
download | glib-5d54727180b46765c30a51e7ebbb2a743f4120c2.tar.gz |
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.
-rw-r--r-- | glib/tests/gdatetime.c | 10 |
1 files 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); } |