@@ -27,10 +27,24 @@ void test_core_rmdir__initialize(void)
2727 git_buf_dispose (& path );
2828}
2929
30+ void test_core_rmdir__cleanup (void )
31+ {
32+ if (git_path_exists (empty_tmp_dir ))
33+ cl_git_pass (git_futils_rmdir_r (empty_tmp_dir , NULL , GIT_RMDIR_REMOVE_FILES ));
34+ }
35+
3036/* make sure empty dir can be deleted recusively */
3137void test_core_rmdir__delete_recursive (void )
3238{
39+ git_buf path = GIT_BUF_INIT ;
40+ cl_git_pass (git_buf_joinpath (& path , empty_tmp_dir , "/one" ));
41+ cl_assert (git_path_exists (git_buf_cstr (& path )));
42+
3343 cl_git_pass (git_futils_rmdir_r (empty_tmp_dir , NULL , GIT_RMDIR_EMPTY_HIERARCHY ));
44+
45+ cl_assert (!git_path_exists (git_buf_cstr (& path )));
46+
47+ git_buf_dispose (& path );
3448}
3549
3650/* make sure non-empty dir cannot be deleted recusively */
@@ -47,9 +61,17 @@ void test_core_rmdir__fail_to_delete_non_empty_dir(void)
4761 cl_must_pass (p_unlink (file .ptr ));
4862 cl_git_pass (git_futils_rmdir_r (empty_tmp_dir , NULL , GIT_RMDIR_EMPTY_HIERARCHY ));
4963
64+ cl_assert (!git_path_exists (empty_tmp_dir ));
65+
5066 git_buf_dispose (& file );
5167}
5268
69+ void test_core_rmdir__keep_base (void )
70+ {
71+ cl_git_pass (git_futils_rmdir_r (empty_tmp_dir , NULL , GIT_RMDIR_SKIP_ROOT ));
72+ cl_assert (git_path_exists (empty_tmp_dir ));
73+ }
74+
5375void test_core_rmdir__can_skip_non_empty_dir (void )
5476{
5577 git_buf file = GIT_BUF_INIT ;
0 commit comments