Commit 7167422cbf66252cc7d4978ee66216fb46280ffb

nulltoken 2011-02-28T12:16:44

Refactored some test related constants.

diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index da28731..68b3660 100644
--- a/tests/t12-repo.c
+++ b/tests/t12-repo.c
@@ -90,8 +90,6 @@ BEGIN_TEST("odb", backend_alternates_sorting)
 	git_odb_close(odb);
 END_TEST
 
-#define WORK_TREE_WITHOUT_TRAILING_SLASH TEST_RESOURCES "/temp_working"
-#define WORK_TREE_WITH_TRAILING_SLASH WORK_TREE_WITHOUT_TRAILING_SLASH "/"
 
 #define STANDARD_REPOSITORY 0
 #define BARE_REPOSITORY 1
@@ -118,20 +116,20 @@ static void ensure_repository_init(git_test *_gittest, char *working_directory, 
 BEGIN_TEST("repo_initialization", init_standard_repo)
 	char path_index[GIT_PATH_MAX], path_repository[GIT_PATH_MAX];
 
-	git__joinpath(path_repository, WORK_TREE_WITH_TRAILING_SLASH, GIT_DIR);
+	git__joinpath(path_repository, TEMP_DIR, GIT_DIR);
 	git__joinpath(path_index, path_repository, GIT_INDEX_FILE);
 
-	ensure_repository_init(_gittest, WORK_TREE_WITH_TRAILING_SLASH, STANDARD_REPOSITORY, path_index, path_repository, WORK_TREE_WITH_TRAILING_SLASH);
-	ensure_repository_init(_gittest, WORK_TREE_WITHOUT_TRAILING_SLASH, STANDARD_REPOSITORY, path_index, path_repository, WORK_TREE_WITH_TRAILING_SLASH);
+	ensure_repository_init(_gittest, TEMP_DIR, STANDARD_REPOSITORY, path_index, path_repository, TEMP_DIR);
+	ensure_repository_init(_gittest, TEMP_DIR_WITHOUT_TRAILING_SLASH, STANDARD_REPOSITORY, path_index, path_repository, TEMP_DIR);
 END_TEST
 
 BEGIN_TEST("repo_initialization", init_bare_repo)
 	char path_repository[GIT_PATH_MAX];
 
-	git__joinpath(path_repository, WORK_TREE_WITH_TRAILING_SLASH, "");
+	git__joinpath(path_repository, TEMP_DIR, "");
 
-	ensure_repository_init(_gittest, WORK_TREE_WITH_TRAILING_SLASH, BARE_REPOSITORY, NULL, path_repository, NULL);
-	ensure_repository_init(_gittest, WORK_TREE_WITHOUT_TRAILING_SLASH, BARE_REPOSITORY, NULL, path_repository, NULL);
+	ensure_repository_init(_gittest, TEMP_DIR, BARE_REPOSITORY, NULL, path_repository, NULL);
+	ensure_repository_init(_gittest, TEMP_DIR_WITHOUT_TRAILING_SLASH, BARE_REPOSITORY, NULL, path_repository, NULL);
 END_TEST
 
 git_testsuite *libgit2_suite_repository(void)
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
index c757eb6..57152b5 100644
--- a/tests/test_helpers.h
+++ b/tests/test_helpers.h
@@ -29,11 +29,15 @@
 #include "test_lib.h"
 #include <git2.h>
 
-#define ODB_FOLDER			(TEST_RESOURCES "/testrepo.git/objects/")
-#define REPOSITORY_FOLDER	(TEST_RESOURCES "/testrepo.git/")
-#define TEST_INDEX_PATH		(TEST_RESOURCES "/testrepo.git/index")
-#define TEST_INDEX2_PATH	(TEST_RESOURCES "/gitgit.index")
-#define TEST_INDEXBIG_PATH	(TEST_RESOURCES "/big.index")
+#define TEST_REPOSITORY_NAME	"testrepo.git"
+#define REPOSITORY_FOLDER		TEST_RESOURCES "/" TEST_REPOSITORY_NAME "/"
+#define ODB_FOLDER				(REPOSITORY_FOLDER "objects/")
+#define TEST_INDEX_PATH			(REPOSITORY_FOLDER "index")
+#define TEST_INDEX2_PATH		(TEST_RESOURCES "/gitgit.index")
+#define TEST_INDEXBIG_PATH		(TEST_RESOURCES "/big.index")
+
+#define TEMP_DIR_WITHOUT_TRAILING_SLASH TEST_RESOURCES "/temp_working"
+#define TEMP_DIR TEMP_DIR_WITHOUT_TRAILING_SLASH "/"
 
 typedef struct object_data {
     unsigned char *bytes;  /* (compressed) bytes stored in object store */