Summary Files Commits Branches @commit @diff @stats
path: root / bookmarks_test.c
blob: da9ecc72d964e786264645801de82ed5c0391442 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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();
}