[glib/wip/pwithnall/more-macos-fixes] tests: Fix a path comparison in the file tests




commit 24e8d7ad85ec633b1054c151d17a4bfb3e352b74
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Jun 24 12:04:31 2022 +0100

    tests: Fix a path comparison in the file tests
    
    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 <pwithnall endlessos org>

 gio/tests/file.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gio/tests/file.c b/gio/tests/file.c
index 39444158f4..85ec41a764 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]