Refactored some test related constants.
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
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 */