mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 08:28:53 +02:00
tests: Add GPathBuf to the g_auto suite
This commit is contained in:
@@ -618,6 +618,30 @@ test_refstring (void)
|
|||||||
g_assert_nonnull (str);
|
g_assert_nonnull (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_pathbuf (void)
|
||||||
|
{
|
||||||
|
#if defined(G_OS_UNIX)
|
||||||
|
g_autoptr(GPathBuf) buf1 = g_path_buf_new_from_path ("/bin/sh");
|
||||||
|
g_auto(GPathBuf) buf2 = G_PATH_BUF_INIT;
|
||||||
|
|
||||||
|
g_path_buf_push (&buf2, "/bin/sh");
|
||||||
|
#elif defined(G_OS_WIN32)
|
||||||
|
g_autoptr(GPathBuf) buf1 = g_path_buf_new_from_path ("C:\\windows\\system32.dll");
|
||||||
|
g_auto(GPathBuf) buf2 = G_PATH_BUF_INIT;
|
||||||
|
|
||||||
|
g_path_buf_push (&buf2, "C:\\windows\\system32.dll");
|
||||||
|
#else
|
||||||
|
g_test_skip ("Unsupported platform");
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_autofree char *path1 = g_path_buf_to_path (buf1);
|
||||||
|
g_autofree char *path2 = g_path_buf_to_path (&buf2);
|
||||||
|
|
||||||
|
g_assert_cmpstr (path1, ==, path2);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_freed (gpointer ptr)
|
mark_freed (gpointer ptr)
|
||||||
{
|
{
|
||||||
@@ -772,6 +796,7 @@ main (int argc, gchar *argv[])
|
|||||||
g_test_add_func ("/autoptr/g_variant_type", test_g_variant_type);
|
g_test_add_func ("/autoptr/g_variant_type", test_g_variant_type);
|
||||||
g_test_add_func ("/autoptr/strv", test_strv);
|
g_test_add_func ("/autoptr/strv", test_strv);
|
||||||
g_test_add_func ("/autoptr/refstring", test_refstring);
|
g_test_add_func ("/autoptr/refstring", test_refstring);
|
||||||
|
g_test_add_func ("/autoptr/pathbuf", test_pathbuf);
|
||||||
g_test_add_func ("/autoptr/autolist", test_autolist);
|
g_test_add_func ("/autoptr/autolist", test_autolist);
|
||||||
g_test_add_func ("/autoptr/autoslist", test_autoslist);
|
g_test_add_func ("/autoptr/autoslist", test_autoslist);
|
||||||
g_test_add_func ("/autoptr/autoqueue", test_autoqueue);
|
g_test_add_func ("/autoptr/autoqueue", test_autoqueue);
|
||||||
|
Reference in New Issue
Block a user