diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/meson.build | 2 | ||||
-rw-r--r-- | tests/writer.c | 22 |
2 files changed, 21 insertions, 3 deletions
diff --git a/tests/meson.build b/tests/meson.build index 6d70212..6948ee9 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -25,7 +25,7 @@ unit_tests = [ ['gdbus-filter', 'dbus.c', '-DDBUS_BACKEND="/gdbus/filter"', gio_unix_dep, libdconf_gdbus_filter], ['engine', 'engine.c', '-DSRCDIR="@0@"'.format(test_dir), [glib_dep, dl_dep, m_dep], [libdconf_engine, libdconf_common, libdconf_mock]], ['client', 'client.c', '-DSRCDIR="@0@"'.format(test_dir), gio_unix_dep, [libdconf_client, libdconf_engine, libdconf_common, libdconf_mock]], - ['writer', 'writer.c', '-DSRCDIR="@0@"'.format(test_dir), [glib_dep, dl_dep, m_dep], [libdconf_engine, libdconf_common, libdconf_mock]], + ['writer', 'writer.c', '-DSRCDIR="@0@"'.format(test_dir), [glib_dep, dl_dep, m_dep], [libdconf_service, libdconf_mock]], ] foreach unit_test: unit_tests diff --git a/tests/writer.c b/tests/writer.c index 92757d1..f4813ec 100644 --- a/tests/writer.c +++ b/tests/writer.c @@ -19,26 +19,44 @@ #include <glib.h> -#include "service/dconf-generated.h" #include "service/dconf-writer.h" +/* Test basic initialisation of a #DConfWriter. This is essentially a smoketest. */ static void test_writer_basic (void) { g_autoptr(DConfWriter) writer = NULL; - writer = dconf_writer_new (DCONF_TYPE_KEYFILE_WRITER, "some-name"); + writer = DCONF_WRITER (dconf_writer_new (DCONF_TYPE_KEYFILE_WRITER, "some-name")); g_assert_nonnull (writer); g_assert_cmpstr (dconf_writer_get_name (writer), ==, "some-name"); } +/* TODO */ +static void +test_writer_corrupt_file (void) +{ + g_autoptr(DConfWriter) writer = NULL; + gboolean retval; + g_autoptr(GError) local_error = NULL; + + writer = DCONF_WRITER (dconf_writer_new (DCONF_TYPE_KEYFILE_WRITER, "some-name")); + g_assert_nonnull (writer); + + writer_iface = DCONF_DBUS_WRITER_GET_IFACE (writer); + retval = writer_iface->handle_init (DCONF_DBUS_WRITER (writer), invocation); + + /* TODO: this is arse */ +} + int main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/writer/basic", test_writer_basic); + g_test_add_func ("/writer/corrupt-file", test_writer_corrupt_file); return g_test_run (); } |