tests: config: make sure to clean up after each test The config::global test suite creates various different directories and files which are being populated with pretend-global files. Unfortunately, the tests do not clean up after themselves, which may cause subsequent tests to fail due to cruft left behind. Fix this by always removing created directories and their contents.
diff --git a/tests/config/global.c b/tests/config/global.c
index 9446d8d..e10dbd7 100644
--- a/tests/config/global.c
+++ b/tests/config/global.c
@@ -27,6 +27,9 @@ void test_config_global__initialize(void)
void test_config_global__cleanup(void)
{
cl_sandbox_set_search_path_defaults();
+ cl_git_pass(git_futils_rmdir_r("home", NULL, GIT_RMDIR_REMOVE_FILES));
+ cl_git_pass(git_futils_rmdir_r("xdg", NULL, GIT_RMDIR_REMOVE_FILES));
+ cl_git_pass(git_futils_rmdir_r("etc", NULL, GIT_RMDIR_REMOVE_FILES));
}
void test_config_global__open_global(void)