mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 00:16:15 +01:00
Merge branch 'wip/pwithnall/fix-unix-mounts-tests-deprecations' into 'main'
tests: Fix calls to deprecated API in unix-mounts tests See merge request GNOME/glib!4367
This commit is contained in:
commit
7abfef8e06
@ -38,6 +38,11 @@
|
||||
#include <gio/gio.h>
|
||||
#include <gio/gunixmounts.h>
|
||||
|
||||
/* We test all of the old g_unix_mount_*() API before it was renamed to
|
||||
* g_unix_mount_entry_*(). The old API calls the new API, so both methods get
|
||||
* tested at once. */
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
test_is_system_fs_type (void)
|
||||
{
|
||||
@ -313,7 +318,7 @@ test_get_mount_entries (void)
|
||||
res = g_file_set_contents (tmp_file, fake_mtab, -1, NULL);
|
||||
g_assert (res);
|
||||
|
||||
entries = g_unix_mount_entries_get_from_file (tmp_file, &time_read, &n_entries);
|
||||
entries = g_unix_mounts_get_from_file (tmp_file, &time_read, &n_entries);
|
||||
|
||||
if (entries == NULL)
|
||||
{
|
||||
@ -331,25 +336,27 @@ test_get_mount_entries (void)
|
||||
|
||||
for (size_t i = 0; i < n_entries; i++)
|
||||
{
|
||||
g_assert_cmpstr (g_unix_mount_entry_get_device_path (entries[i]), ==, expected_entries[i].device_path);
|
||||
g_assert_cmpstr (g_unix_mount_entry_get_fs_type (entries[i]), ==, expected_entries[i].fs_type);
|
||||
g_assert_cmpstr (g_unix_mount_entry_get_mount_path (entries[i]), ==, expected_entries[i].mount_path);
|
||||
g_assert_cmpstr (g_unix_mount_entry_get_options (entries[i]), ==, expected_entries[i].options);
|
||||
g_assert_cmpstr (g_unix_mount_get_device_path (entries[i]), ==, expected_entries[i].device_path);
|
||||
g_assert_cmpstr (g_unix_mount_get_fs_type (entries[i]), ==, expected_entries[i].fs_type);
|
||||
g_assert_cmpstr (g_unix_mount_get_mount_path (entries[i]), ==, expected_entries[i].mount_path);
|
||||
g_assert_cmpstr (g_unix_mount_get_options (entries[i]), ==, expected_entries[i].options);
|
||||
|
||||
/* root_path is only supported by libmount */
|
||||
#ifdef HAVE_LIBMOUNT
|
||||
g_assert_cmpstr (g_unix_mount_entry_get_root_path (entries[i]), ==, expected_entries[i].root_path);
|
||||
g_assert_cmpstr (g_unix_mount_get_root_path (entries[i]), ==, expected_entries[i].root_path);
|
||||
#else
|
||||
g_assert_null (g_unix_mount_get_root_path (entries[i]));
|
||||
#endif
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < n_entries; i++)
|
||||
g_unix_mount_entry_free (entries[i]);
|
||||
g_unix_mount_free (entries[i]);
|
||||
g_free (entries);
|
||||
g_free (tmp_file);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
|
Loading…
Reference in New Issue
Block a user