Blame gio/tests/unix-mounts.c

Packit ae235b
/* GLib testing framework examples and tests
Packit ae235b
 *
Packit ae235b
 * Copyright © 2017 Endless Mobile, Inc.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General
Packit ae235b
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#include <glib.h>
Packit ae235b
Packit ae235b
#ifndef G_OS_UNIX
Packit ae235b
#error This is a Unix-specific test
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#include <errno.h>
Packit ae235b
#include <locale.h>
Packit ae235b
#include <glib/gstdio.h>
Packit ae235b
#include <gio/gio.h>
Packit ae235b
#include <gio/gunixmounts.h>
Packit ae235b
Packit ae235b
static void
Packit ae235b
test_is_system_fs_type (void)
Packit ae235b
{
Packit ae235b
  g_assert_true (g_unix_is_system_fs_type ("tmpfs"));
Packit ae235b
  g_assert_false (g_unix_is_system_fs_type ("ext4"));
Packit ae235b
}
Packit ae235b
Packit ae235b
static void
Packit ae235b
test_is_system_device_path (void)
Packit ae235b
{
Packit ae235b
  g_assert_true (g_unix_is_system_device_path ("devpts"));
Packit ae235b
  g_assert_false (g_unix_is_system_device_path ("/"));
Packit ae235b
}
Packit ae235b
Packit ae235b
int
Packit ae235b
main (int   argc,
Packit ae235b
      char *argv[])
Packit ae235b
{
Packit ae235b
  setlocale (LC_ALL, "");
Packit ae235b
Packit ae235b
  g_test_init (&argc, &argv, NULL);
Packit ae235b
Packit ae235b
  g_test_add_func ("/unix-mounts/is-system-fs-type", test_is_system_fs_type);
Packit ae235b
  g_test_add_func ("/unix-mounts/is-system-device-path", test_is_system_device_path);
Packit ae235b
Packit ae235b
  return g_test_run ();
Packit ae235b
}