Merge branch 'g-clear-pointer-no-side-effects' into 'master'
[glib.git] / gio / tests / unix-mounts.c
blob67b8c8d98c091880cdfd82a165a04c8f47f45ff2
1 /* GLib testing framework examples and tests
3 * Copyright © 2017 Endless Mobile, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #include <glib.h>
21 #ifndef G_OS_UNIX
22 #error This is a Unix-specific test
23 #endif
25 #include <errno.h>
26 #include <locale.h>
27 #include <glib/gstdio.h>
28 #include <gio/gio.h>
29 #include <gio/gunixmounts.h>
31 static void
32 test_is_system_fs_type (void)
34 g_assert_true (g_unix_is_system_fs_type ("tmpfs"));
35 g_assert_false (g_unix_is_system_fs_type ("ext4"));
37 /* Check that some common network file systems aren’t considered ‘system’. */
38 g_assert_false (g_unix_is_system_fs_type ("cifs"));
39 g_assert_false (g_unix_is_system_fs_type ("nfs"));
40 g_assert_false (g_unix_is_system_fs_type ("nfs4"));
41 g_assert_false (g_unix_is_system_fs_type ("smbfs"));
44 static void
45 test_is_system_device_path (void)
47 g_assert_true (g_unix_is_system_device_path ("devpts"));
48 g_assert_false (g_unix_is_system_device_path ("/"));
51 int
52 main (int argc,
53 char *argv[])
55 setlocale (LC_ALL, "");
57 g_test_init (&argc, &argv, NULL);
59 g_test_add_func ("/unix-mounts/is-system-fs-type", test_is_system_fs_type);
60 g_test_add_func ("/unix-mounts/is-system-device-path", test_is_system_device_path);
62 return g_test_run ();