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
7ea50f60
Commit
7ea50f60
authored
Jun 09, 2011
by
schu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for git_futils_rmdir_resurs()
Signed-off-by: schu <schu-github@schulog.org>
parent
42b3a460
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
tests/t00-core.c
+53
-0
No files found.
tests/t00-core.c
View file @
7ea50f60
...
@@ -474,6 +474,56 @@ BEGIN_TEST(filebuf2, "make sure git_filebuf_write writes large buffer correctly"
...
@@ -474,6 +474,56 @@ BEGIN_TEST(filebuf2, "make sure git_filebuf_write writes large buffer correctly"
must_pass
(
p_unlink
(
test
));
must_pass
(
p_unlink
(
test
));
END_TEST
END_TEST
static
char
*
empty_tmp_dir
=
"test_gitfo_rmdir_recurs_test"
;
static
int
setup_empty_tmp_dir
()
{
char
path
[
GIT_PATH_MAX
];
if
(
mkdir
(
empty_tmp_dir
,
0755
))
return
-
1
;
git_path_join
(
path
,
empty_tmp_dir
,
"/one"
);
if
(
mkdir
(
path
,
0755
))
return
-
1
;
git_path_join
(
path
,
empty_tmp_dir
,
"/one/two_one"
);
if
(
mkdir
(
path
,
0755
))
return
-
1
;
git_path_join
(
path
,
empty_tmp_dir
,
"/one/two_two"
);
if
(
mkdir
(
path
,
0755
))
return
-
1
;
git_path_join
(
path
,
empty_tmp_dir
,
"/one/two_two/three"
);
if
(
mkdir
(
path
,
0755
))
return
-
1
;
git_path_join
(
path
,
empty_tmp_dir
,
"/two"
);
if
(
mkdir
(
path
,
0755
))
return
-
1
;
return
0
;
}
BEGIN_TEST
(
rmdir0
,
"make sure empty dir can be deleted recusively"
)
must_pass
(
setup_empty_tmp_dir
());
must_pass
(
git_futils_rmdir_recurs
(
empty_tmp_dir
));
END_TEST
BEGIN_TEST
(
rmdir1
,
"make sure non-empty dir cannot be deleted recusively"
)
char
file
[
GIT_PATH_MAX
];
must_pass
(
setup_empty_tmp_dir
());
git_path_join
(
file
,
empty_tmp_dir
,
"/two/file.txt"
);
must_pass
(
fd
=
p_creat
(
file
,
0755
));
must_pass
(
fd
);
must_fail
(
git_futils_rmdir_recurs
(
empty_tmp_dir
));
must_pass
(
p_close
(
fd
));
must_pass
(
p_unlink
(
file
));
must_pass
(
git_futils_rmdir_recurs
(
empty_tmp_dir
));
END_TEST
BEGIN_SUITE
(
core
)
BEGIN_SUITE
(
core
)
ADD_TEST
(
string0
);
ADD_TEST
(
string0
);
ADD_TEST
(
string1
);
ADD_TEST
(
string1
);
...
@@ -496,4 +546,7 @@ BEGIN_SUITE(core)
...
@@ -496,4 +546,7 @@ BEGIN_SUITE(core)
ADD_TEST
(
filebuf0
);
ADD_TEST
(
filebuf0
);
ADD_TEST
(
filebuf1
);
ADD_TEST
(
filebuf1
);
ADD_TEST
(
filebuf2
);
ADD_TEST
(
filebuf2
);
ADD_TEST
(
rmdir0
);
ADD_TEST
(
rmdir1
);
END_SUITE
END_SUITE
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