Commit e833fb89 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Avoid hardcoding of xdg-test-helper binary

parent 2ea7394c
......@@ -107,10 +107,13 @@ static void
xdg_path_impl(girara_xdg_path_t path, const gchar* envvar,
const gchar* expected)
{
const char* xdg_test_helper_path = g_getenv("XDG_TEST_HELPER_PATH");
fail_unless(xdg_test_helper_path != NULL, "XDG_TEST_HELPER_PATH is not set", NULL);
gchar** envp = g_get_environ();
envp = g_environ_setenv(envp, envvar, "", TRUE);
gchar* argv[] = { XDG_TEST_HELPER, g_strdup_printf("%d", path), NULL };
gchar* argv[] = { g_build_filename(xdg_test_helper_path, "xdg_test_helper", NULL), g_strdup_printf("%d", path), NULL };
gchar* output = NULL;
bool result = g_spawn_sync(NULL, argv, envp, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &output, NULL, NULL, NULL);
......@@ -136,6 +139,7 @@ xdg_path_impl(girara_xdg_path_t path, const gchar* envvar,
fail_unless(g_strcmp0(output, "/home/test/xdg") == 0, "Output is not the same (got: %s, expected: %s)",
output, "/home/test/xdg", NULL);
g_free(argv[0]);
g_free(argv[1]);
g_strfreev(envp);
}
......@@ -314,6 +318,5 @@ Suite* suite_utils()
tcase_add_test(tcase, test_strings_replace_substrings_3);
suite_add_tcase(suite, tcase);
return suite;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment