diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-09-16 18:07:56 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-17 10:00:35 -0400 |
commit | 08df66301ec677f6cd98175a914dc933e2fb43a9 (patch) | |
tree | 127c1c52ad5246a2f6d3544cb3e9efcfea53838b | |
parent | ac2fba0ecd68e8eae348dec688cbcd0828432cdf (diff) | |
download | libgit2-08df66301ec677f6cd98175a914dc933e2fb43a9.tar.gz |
core::mkdir tests: include absolute mkdirs
-rw-r--r-- | tests/core/mkdir.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/core/mkdir.c b/tests/core/mkdir.c index e435a9a64..11fecb118 100644 --- a/tests/core/mkdir.c +++ b/tests/core/mkdir.c @@ -13,6 +13,41 @@ static void cleanup_basic_dirs(void *ref) git_futils_rmdir_r("d4", NULL, GIT_RMDIR_EMPTY_HIERARCHY); } +void test_core_mkdir__absolute(void) +{ + git_buf path = GIT_BUF_INIT; + + cl_set_cleanup(cleanup_basic_dirs, NULL); + + git_buf_joinpath(&path, clar_sandbox_path(), "d0"); + + /* make a directory */ + cl_assert(!git_path_isdir(path.ptr)); + cl_git_pass(git_futils_mkdir(path.ptr, 0755, 0)); + cl_assert(git_path_isdir(path.ptr)); + + git_buf_joinpath(&path, path.ptr, "subdir"); + + /* make a directory */ + cl_assert(!git_path_isdir(path.ptr)); + cl_git_pass(git_futils_mkdir(path.ptr, 0755, 0)); + cl_assert(git_path_isdir(path.ptr)); + + git_buf_joinpath(&path, path.ptr, "another"); + + /* make a directory */ + cl_assert(!git_path_isdir(path.ptr)); + cl_git_pass(git_futils_mkdir_r(path.ptr, 0755)); + cl_assert(git_path_isdir(path.ptr)); + + git_buf_joinpath(&path, clar_sandbox_path(), "d1/foo/bar/asdf"); + + /* make a directory */ + cl_assert(!git_path_isdir(path.ptr)); + cl_git_pass(git_futils_mkdir_r(path.ptr, 0755)); + cl_assert(git_path_isdir(path.ptr)); +} + void test_core_mkdir__basic(void) { cl_set_cleanup(cleanup_basic_dirs, NULL); |