diff options
author | Philip Chimento <philip@endlessm.com> | 2013-11-27 20:12:05 -0800 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2013-11-27 20:12:05 -0800 |
commit | 4b54cc4dacc502a583d864e49faf122272746a09 (patch) | |
tree | 0ea4dc2588fc9ad8f62317272acb2b60eb60b4d8 /test | |
parent | 789d44d5bcfa224803864f087ef979d48d80afdd (diff) |
Handle relative path in XDG_CONFIG_HOME
Playing with XDG_CONFIG_HOME in the previous commit showed that one
test failed if it was a relative path. Luckily that is a bug in the
test and not in the code.
[endlessm/eos-sdk#357]
Diffstat (limited to 'test')
-rw-r--r-- | test/test-application.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/test-application.c b/test/test-application.c index 065f3f8..75165d4 100644 --- a/test/test-application.c +++ b/test/test-application.c @@ -76,6 +76,8 @@ test_config_dir_returns_expected_path (ConfigDirFixture *fixture, gconstpointer unused) { GFile *config_dir = eos_application_get_config_dir (fixture->app); + /* XDG_CONFIG_HOME may be a relative path, so resolve it via file handles */ + GFile *xdg_user_config_dir = g_file_new_for_path (g_get_user_config_dir ()); char *basename = g_file_get_basename (config_dir); g_assert_cmpstr (basename, ==, fixture->unique_id); @@ -84,8 +86,13 @@ test_config_dir_returns_expected_path (ConfigDirFixture *fixture, GFile *parent = g_file_get_parent (config_dir); char *dirname = g_file_get_path (parent); g_object_unref (parent); - g_assert_cmpstr (dirname, ==, g_get_user_config_dir ()); + + char *xdg_dirname = g_file_get_path (xdg_user_config_dir); + g_object_unref (xdg_user_config_dir); + + g_assert_cmpstr (dirname, ==, xdg_dirname); g_free (dirname); + g_free (xdg_dirname); } static void |