From a98bd895d58f878602b622b98f7f27dd270262ac Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 24 Jun 2022 12:04:31 +0100 Subject: [PATCH] tests: Fix a path comparison in the file tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS the comparison was failing as one of the paths had a trailing slash while the other didn’t. Signed-off-by: Philip Withnall --- gio/tests/file.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gio/tests/file.c b/gio/tests/file.c index 39444158f..04805931b 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -1988,7 +1988,7 @@ on_new_tmp_done (GObject *object, GError *error = NULL; GMainLoop *loop = user_data; gchar *basename; - gchar *parent_path; + GFile *tmpdir = NULL; g_assert_null (object); @@ -2009,9 +2009,9 @@ on_new_tmp_done (GObject *object, g_assert_no_error (error); parent = g_file_get_parent (file); - parent_path = g_file_get_path (parent); + tmpdir = g_file_new_for_path (g_get_tmp_dir ()); - g_assert_cmpstr (g_get_tmp_dir (), ==, parent_path); + g_assert_true (g_file_equal (tmpdir, parent)); g_main_loop_quit (loop); @@ -2020,7 +2020,7 @@ on_new_tmp_done (GObject *object, g_object_unref (iostream); g_object_unref (info); g_free (basename); - g_free (parent_path); + g_object_unref (tmpdir); } static void @@ -2087,7 +2087,7 @@ on_new_tmp_dir_done (GObject *object, GError *error = NULL; GMainLoop *loop = user_data; gchar *basename; - gchar *parent_path; + GFile *tmpdir = NULL; g_assert_null (object); @@ -2106,9 +2106,9 @@ on_new_tmp_dir_done (GObject *object, g_assert_cmpuint (g_file_info_get_file_type (info), ==, G_FILE_TYPE_DIRECTORY); parent = g_file_get_parent (file); - parent_path = g_file_get_path (parent); + tmpdir = g_file_new_for_path (g_get_tmp_dir ()); - g_assert_cmpstr (g_get_tmp_dir (), ==, parent_path); + g_assert_true (g_file_equal (tmpdir, parent)); g_main_loop_quit (loop); @@ -2116,7 +2116,7 @@ on_new_tmp_dir_done (GObject *object, g_object_unref (parent); g_object_unref (info); g_free (basename); - g_free (parent_path); + g_object_unref (tmpdir); } static void