Fix problems with the keyfile test

We must set XDG_DATA_HOME early on, and we must clear error
before using it.
This commit is contained in:
Matthias Clasen 2010-07-06 07:43:19 -04:00
parent eea9d343cc
commit f0b6cbb139

View File

@ -1285,9 +1285,8 @@ test_load (void)
GError *error; GError *error;
gboolean bools[2] = { TRUE, FALSE }; gboolean bools[2] = { TRUE, FALSE };
g_setenv ("XDG_DATA_HOME", SRCDIR, TRUE);
file = g_key_file_new (); file = g_key_file_new ();
error = NULL;
g_assert (g_key_file_load_from_data_dirs (file, "keyfiletest.ini", NULL, 0, &error)); g_assert (g_key_file_load_from_data_dirs (file, "keyfiletest.ini", NULL, 0, &error));
g_assert_no_error (error); g_assert_no_error (error);
@ -1300,9 +1299,15 @@ test_load (void)
g_key_file_free (file); g_key_file_free (file);
} }
#ifndef SRCDIR
#define SRCDIR "."
#endif
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
g_setenv ("XDG_DATA_HOME", SRCDIR, TRUE);
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/"); g_test_bug_base ("http://bugzilla.gnome.org/");