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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index 644669c..a9a93d1 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 78538d5..97b81ab 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