Commit 45314a7e4abc0c5b051d3ca647eb0763c22c2b1e

Tim Clem 2011-03-04T23:13:02

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

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