Summary Files Commits Branches @commit @diff @stats
path: root / bookmarks_test.c
diff options
context:
space:
mode:
Commitcb6872cc9790ee2cd04f54ee762c23f5e48d9f4b (patch)
Author
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2022-03-13 00:15:35 +0100
Committer
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2022-03-13 00:15:35 +0100
Files6837fa0a76434dba56aec60842c34501fa203f83 /bookmarks_test.c
goodwolf-cb6872cc9790ee2cd04f54ee762c23f5e48d9f4b.tar
goodwolf-cb6872cc9790ee2cd04f54ee762c23f5e48d9f4b.tar.gz
goodwolf-cb6872cc9790ee2cd04f54ee762c23f5e48d9f4b.zip
Parentedbe278f8dcf822504e25f055dc89dcfcd9e3656 (diff)
bookmark_test: Add basic test
1 files changed, 34 insertions, 0 deletions
-rw-r--r--bookmarks_test.c34
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();
+}