diff options
bookmark_test: Add basic test
1 files changed, 34 insertions, 0 deletions
| -rw-r--r-- | bookmarks_test.c | 34 |
diff --git a/bookmarks_test.c b/bookmarks_test.c new file mode 100644 index 0000000..da9ecc7 --- /dev/null +++ b/bookmarks_test.c @@ -0,0 +1,34 @@ +// BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser +// Copyright © 2019-2022 Badwolf Authors <https://hacktivis.me/projects/badwolf> +// SPDX-License-Identifier: BSD-3-Clause + +#include "bookmarks.h" + +#include <glib.h> +#include <gtk/gtk.h> +#include <stdlib.h> /* setenv */ + +static void +bookmarks_completion_init_test(void) +{ + GtkTreeModel *result; + + char *filename = g_build_filename(g_get_current_dir(), "bookmarks_test.fixtures/full/", NULL); + g_assert_true(setenv("XDG_DATA_HOME", filename, 1) == 0); + + result = bookmarks_completion_init(); + + g_assert_true(result != NULL); + g_free(filename); + g_assert_true(unsetenv("XDG_DATA_HOME") == 0); +} + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/bookmarks_completion_init/test", bookmarks_completion_init_test); + + return g_test_run(); +} |