tests: Don’t use a potentially-existent timezone in a test for failure

When checking that the timezone code falls back to UTC if a zone is
unknown, don’t use ‘PST’, because that can actually exist on some
systems.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1433
This commit is contained in:
Philip Withnall 2018-07-31 19:54:56 +01:00
parent 83a4cab12c
commit b2249bf33c

View File

@ -2131,13 +2131,15 @@ test_posix_parse (void)
GTimeZone *tz;
GDateTime *gdt1, *gdt2;
tz = g_time_zone_new ("PST");
/* Check that an unknown zone name falls back to UTC. */
tz = g_time_zone_new ("nonexistent");
g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "UTC");
g_assert_cmpstr (g_time_zone_get_abbreviation (tz, 0), ==, "UTC");
g_assert_cmpint (g_time_zone_get_offset (tz, 0), ==, 0);
g_assert (!g_time_zone_is_dst (tz, 0));
g_time_zone_unref (tz);
/* An existent zone name should not fall back to UTC. */
tz = g_time_zone_new ("PST8");
g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "PST8");
g_assert_cmpstr (g_time_zone_get_abbreviation (tz, 0), ==, "PST");