diff options
author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-11-18 22:45:56 +0100 |
---|---|---|
committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-11-18 22:45:56 +0100 |
commit | bdd31dd5e832126b2f22fccbe244a1106c241ab0 (patch) | |
tree | b08a2ad0fad57131563aa8c071221bea241128c1 /tests/t00-core.c | |
parent | 277b7efe493887081ce1dafd91199d0ee9f676c9 (diff) | |
parent | e4c93a392763a006d11e1c1dd01c12f85498dad5 (diff) | |
download | libgit2-error-handling.tar.gz |
Merge branch 'development' into error-handlingerror-handling
The code in this branch has been modified so it works with the global
state introduced in development.
Diffstat (limited to 'tests/t00-core.c')
-rw-r--r-- | tests/t00-core.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/t00-core.c b/tests/t00-core.c index 703504bf8..94824b438 100644 --- a/tests/t00-core.c +++ b/tests/t00-core.c @@ -99,8 +99,8 @@ BEGIN_TEST(vector2, "remove duplicates") must_be_true(x.length == 2); git_vector_free(&x); - free(ptrs[0]); - free(ptrs[1]); + git__free(ptrs[0]); + git__free(ptrs[1]); END_TEST @@ -112,7 +112,7 @@ BEGIN_TEST(path0, "get the dirname of a path") must_be_true(strcmp(dir, B) == 0); \ must_be_true((dir2 = git_path_dirname(A)) != NULL); \ must_be_true(strcmp(dir2, B) == 0); \ - free(dir2); \ + git__free(dir2); \ } DIRNAME_TEST(NULL, "."); @@ -141,7 +141,7 @@ BEGIN_TEST(path1, "get the base name of a path") must_be_true(strcmp(base, B) == 0); \ must_be_true((base2 = git_path_basename(A)) != NULL); \ must_be_true(strcmp(base2, B) == 0); \ - free(base2); \ + git__free(base2); \ } BASENAME_TEST(NULL, "."); @@ -250,21 +250,21 @@ static int setup(walk_data *d) { name_data *n; - if (p_mkdir(top_dir, 0755) < 0) + if (p_mkdir(top_dir, 0777) < 0) return error("can't mkdir(\"%s\")", top_dir); if (p_chdir(top_dir) < 0) return error("can't chdir(\"%s\")", top_dir); if (strcmp(d->sub, ".") != 0) - if (p_mkdir(d->sub, 0755) < 0) + if (p_mkdir(d->sub, 0777) < 0) return error("can't mkdir(\"%s\")", d->sub); strcpy(path_buffer, d->sub); state_loc = d; for (n = d->names; n->name; n++) { - git_file fd = p_creat(n->name, 0600); + git_file fd = p_creat(n->name, 0666); if (fd < 0) return GIT_ERROR; p_close(fd); @@ -479,14 +479,14 @@ BEGIN_TEST(filebuf1, "make sure GIT_FILEBUF_APPEND works as expected") int fd; char test[] = "test"; - fd = p_creat(test, 0644); + fd = p_creat(test, 0666); must_pass(fd); must_pass(p_write(fd, "libgit2 rocks\n", 14)); must_pass(p_close(fd)); must_pass(git_filebuf_open(&file, test, GIT_FILEBUF_APPEND)); must_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks")); - must_pass(git_filebuf_commit(&file)); + must_pass(git_filebuf_commit(&file, 0666)); must_pass(p_unlink(test)); END_TEST @@ -499,7 +499,7 @@ BEGIN_TEST(filebuf2, "make sure git_filebuf_write writes large buffer correctly" memset(buf, 0xfe, sizeof(buf)); must_pass(git_filebuf_open(&file, test, 0)); must_pass(git_filebuf_write(&file, buf, sizeof(buf))); - must_pass(git_filebuf_commit(&file)); + must_pass(git_filebuf_commit(&file, 0666)); must_pass(p_unlink(test)); END_TEST @@ -510,27 +510,27 @@ static int setup_empty_tmp_dir(void) { char path[GIT_PATH_MAX]; - if (p_mkdir(empty_tmp_dir, 0755)) + if (p_mkdir(empty_tmp_dir, 0777)) return -1; git_path_join(path, empty_tmp_dir, "/one"); - if (p_mkdir(path, 0755)) + if (p_mkdir(path, 0777)) return -1; git_path_join(path, empty_tmp_dir, "/one/two_one"); - if (p_mkdir(path, 0755)) + if (p_mkdir(path, 0777)) return -1; git_path_join(path, empty_tmp_dir, "/one/two_two"); - if (p_mkdir(path, 0755)) + if (p_mkdir(path, 0777)) return -1; git_path_join(path, empty_tmp_dir, "/one/two_two/three"); - if (p_mkdir(path, 0755)) + if (p_mkdir(path, 0777)) return -1; git_path_join(path, empty_tmp_dir, "/two"); - if (p_mkdir(path, 0755)) + if (p_mkdir(path, 0777)) return -1; return 0; @@ -547,7 +547,7 @@ BEGIN_TEST(rmdir1, "make sure non-empty dir cannot be deleted recusively") must_pass(setup_empty_tmp_dir()); git_path_join(file, empty_tmp_dir, "/two/file.txt"); - fd = p_creat(file, 0755); + fd = p_creat(file, 0777); must_pass(fd); must_pass(p_close(fd)); must_fail(git_futils_rmdir_r(empty_tmp_dir, 0)); |