summaryrefslogtreecommitdiff
path: root/tests-clar/repo/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/repo/open.c')
-rw-r--r--tests-clar/repo/open.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/tests-clar/repo/open.c b/tests-clar/repo/open.c
index b5002843c..c3a7dadbd 100644
--- a/tests-clar/repo/open.c
+++ b/tests-clar/repo/open.c
@@ -1,24 +1,46 @@
#include "clar_libgit2.h"
#include "posix.h"
-void test_repo_open__bare_empty_repo(void)
+static git_repository *repo;
+
+void test_repo_open__cleanup(void)
{
- git_repository *repo;
+ git_repository_free(repo);
+}
+void test_repo_open__bare_empty_repo(void)
+{
cl_git_pass(git_repository_open(&repo, cl_fixture("empty_bare.git")));
+
cl_assert(git_repository_path(repo) != NULL);
+ cl_assert(git__suffixcmp(git_repository_path(repo), "/") == 0);
+
cl_assert(git_repository_workdir(repo) == NULL);
+}
- git_repository_free(repo);
+void test_repo_open__standard_empty_repo_through_gitdir(void)
+{
+ cl_git_pass(git_repository_open(&repo, cl_fixture("empty_standard_repo/.gitted")));
+
+ cl_assert(git_repository_path(repo) != NULL);
+ cl_assert(git__suffixcmp(git_repository_path(repo), "/") == 0);
+
+ cl_assert(git_repository_workdir(repo) != NULL);
+ cl_assert(git__suffixcmp(git_repository_workdir(repo), "/") == 0);
}
-void test_repo_open__standard_empty_repo(void)
+void test_repo_open__standard_empty_repo_through_workdir(void)
{
- git_repository *repo;
+ cl_fixture_sandbox("empty_standard_repo");
+ cl_git_pass(p_rename("empty_standard_repo/.gitted", "empty_standard_repo/.git"));
+
+ cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- cl_git_pass(git_repository_open(&repo, cl_fixture("empty_standard_repo/.gitted")));
cl_assert(git_repository_path(repo) != NULL);
+ cl_assert(git__suffixcmp(git_repository_path(repo), "/") == 0);
+
cl_assert(git_repository_workdir(repo) != NULL);
+ cl_assert(git__suffixcmp(git_repository_workdir(repo), "/") == 0);
- git_repository_free(repo);
+ cl_fixture_cleanup("empty_standard_repo");
}