Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
838a2f29
Unverified
Commit
838a2f29
authored
Oct 07, 2018
by
Edward Thomson
Committed by
GitHub
Oct 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4828 from csware/git_futils_rmdir_r_failing
Add some more tests for git_futils_rmdir_r and some cleanup
parents
0cd976c8
ad273718
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
tests/core/rmdir.c
+22
-0
No files found.
tests/core/rmdir.c
View file @
838a2f29
...
...
@@ -27,10 +27,24 @@ void test_core_rmdir__initialize(void)
git_buf_dispose
(
&
path
);
}
void
test_core_rmdir__cleanup
(
void
)
{
if
(
git_path_exists
(
empty_tmp_dir
))
cl_git_pass
(
git_futils_rmdir_r
(
empty_tmp_dir
,
NULL
,
GIT_RMDIR_REMOVE_FILES
));
}
/* make sure empty dir can be deleted recusively */
void
test_core_rmdir__delete_recursive
(
void
)
{
git_buf
path
=
GIT_BUF_INIT
;
cl_git_pass
(
git_buf_joinpath
(
&
path
,
empty_tmp_dir
,
"/one"
));
cl_assert
(
git_path_exists
(
git_buf_cstr
(
&
path
)));
cl_git_pass
(
git_futils_rmdir_r
(
empty_tmp_dir
,
NULL
,
GIT_RMDIR_EMPTY_HIERARCHY
));
cl_assert
(
!
git_path_exists
(
git_buf_cstr
(
&
path
)));
git_buf_dispose
(
&
path
);
}
/* make sure non-empty dir cannot be deleted recusively */
...
...
@@ -47,9 +61,17 @@ void test_core_rmdir__fail_to_delete_non_empty_dir(void)
cl_must_pass
(
p_unlink
(
file
.
ptr
));
cl_git_pass
(
git_futils_rmdir_r
(
empty_tmp_dir
,
NULL
,
GIT_RMDIR_EMPTY_HIERARCHY
));
cl_assert
(
!
git_path_exists
(
empty_tmp_dir
));
git_buf_dispose
(
&
file
);
}
void
test_core_rmdir__keep_base
(
void
)
{
cl_git_pass
(
git_futils_rmdir_r
(
empty_tmp_dir
,
NULL
,
GIT_RMDIR_SKIP_ROOT
));
cl_assert
(
git_path_exists
(
empty_tmp_dir
));
}
void
test_core_rmdir__can_skip_non_empty_dir
(
void
)
{
git_buf
file
=
GIT_BUF_INIT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment