summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Clem <timothy.clem@gmail.com>2011-03-04 23:13:02 -0800
committerTim Clem <timothy.clem@gmail.com>2011-03-04 23:31:28 -0800
commit45314a7e4abc0c5b051d3ca647eb0763c22c2b1e (patch)
treecd68dcf692d6acde0325022acfc65db98c1d1e36
parentf335b42c72fbc4842295f52b0654a8c54716847d (diff)
downloadlibgit2-45314a7e4abc0c5b051d3ca647eb0763c22c2b1e.tar.gz
clean up temp repo for t12-repo tests
add actual must_pass calls back into the repo tests and remove ./ from beginning of temp repo path
-rw-r--r--tests/t12-repo.c25
-rw-r--r--tests/test_helpers.h2
2 files changed, 18 insertions, 9 deletions
diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index 644669c8e..a9a93d147 100644
--- a/tests/t12-repo.c
+++ b/tests/t12-repo.c
@@ -114,24 +114,33 @@ static int ensure_repository_init(
if (repo->path_workdir != NULL || expected_working_directory != NULL) {
if (strcmp(repo->path_workdir, expected_working_directory) != 0)
- return GIT_ERROR;
+ //return GIT_ERROR;
+ goto cleanup;
}
if (strcmp(repo->path_odb, path_odb) != 0)
- return GIT_ERROR;
+ //return GIT_ERROR;
+ goto cleanup;
if (strcmp(repo->path_repository, expected_path_repository) != 0)
- return GIT_ERROR;
+ //return GIT_ERROR;
+ goto cleanup;
if (repo->path_index != NULL || expected_path_index != NULL) {
if (strcmp(repo->path_index, expected_path_index) != 0)
- return GIT_ERROR;
+ //return GIT_ERROR;
+ goto cleanup;
}
git_repository_free(repo);
rmdir_recurs(working_directory);
return GIT_SUCCESS;
+
+cleanup:
+ git_repository_free(repo);
+ rmdir_recurs(working_directory);
+ return GIT_ERROR;
}
BEGIN_TEST(init0, "initialize a standard repo")
@@ -140,8 +149,8 @@ BEGIN_TEST(init0, "initialize a standard repo")
git__joinpath(path_repository, TEMP_REPO_FOLDER, GIT_DIR);
git__joinpath(path_index, path_repository, GIT_INDEX_FILE);
- ensure_repository_init(TEMP_REPO_FOLDER, STANDARD_REPOSITORY, path_index, path_repository, TEMP_REPO_FOLDER);
- ensure_repository_init(TEMP_REPO_FOLDER_NS, STANDARD_REPOSITORY, path_index, path_repository, TEMP_REPO_FOLDER);
+ must_pass(ensure_repository_init(TEMP_REPO_FOLDER, STANDARD_REPOSITORY, path_index, path_repository, TEMP_REPO_FOLDER));
+ must_pass(ensure_repository_init(TEMP_REPO_FOLDER_NS, STANDARD_REPOSITORY, path_index, path_repository, TEMP_REPO_FOLDER));
END_TEST
BEGIN_TEST(init1, "initialize a bare repo")
@@ -149,8 +158,8 @@ BEGIN_TEST(init1, "initialize a bare repo")
git__joinpath(path_repository, TEMP_REPO_FOLDER, "");
- ensure_repository_init(TEMP_REPO_FOLDER, BARE_REPOSITORY, NULL, path_repository, NULL);
- ensure_repository_init(TEMP_REPO_FOLDER_NS, BARE_REPOSITORY, NULL, path_repository, NULL);
+ must_pass(ensure_repository_init(TEMP_REPO_FOLDER, BARE_REPOSITORY, NULL, path_repository, NULL));
+ must_pass(ensure_repository_init(TEMP_REPO_FOLDER_NS, BARE_REPOSITORY, NULL, path_repository, NULL));
END_TEST
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
index 78538d51c..97b81ab40 100644
--- a/tests/test_helpers.h
+++ b/tests/test_helpers.h
@@ -36,7 +36,7 @@
#define TEST_INDEX2_PATH (TEST_RESOURCES "/gitgit.index")
#define TEST_INDEXBIG_PATH (TEST_RESOURCES "/big.index")
-#define TEMP_FOLDER "./"
+#define TEMP_FOLDER ""
#define TEMP_REPO_FOLDER TEMP_FOLDER TEST_REPOSITORY_NAME "/"
#define TEMP_REPO_FOLDER_NS TEMP_FOLDER TEST_REPOSITORY_NAME