From b2249bf33cf8509ebd0c1287ea0e1f2914429fc4 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 31 Jul 2018 19:54:56 +0100 Subject: [PATCH] =?UTF-8?q?tests:=20Don=E2=80=99t=20use=20a=20potentially-?= =?UTF-8?q?existent=20timezone=20in=20a=20test=20for=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 https://gitlab.gnome.org/GNOME/glib/issues/1433 --- glib/tests/gdatetime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c index c6837fcce..a028f6d20 100644 --- a/glib/tests/gdatetime.c +++ b/glib/tests/gdatetime.c @@ -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");