summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/repo/extensions.c44
-rw-r--r--tests/repo/open.c42
2 files changed, 44 insertions, 42 deletions
diff --git a/tests/repo/extensions.c b/tests/repo/extensions.c
new file mode 100644
index 000000000..8ba89f1a9
--- /dev/null
+++ b/tests/repo/extensions.c
@@ -0,0 +1,44 @@
+#include "clar_libgit2.h"
+#include "futils.h"
+#include "sysdir.h"
+#include <ctype.h>
+
+git_repository *repo;
+
+void test_repo_extensions__initialize(void)
+{
+ git_config *config;
+
+ repo = cl_git_sandbox_init("empty_bare.git");
+
+ cl_git_pass(git_repository_config(&config, repo));
+ cl_git_pass(git_config_set_int32(config, "core.repositoryformatversion", 1));
+ git_config_free(config);
+}
+
+void test_repo_extensions__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+void test_repo_extensions__builtin(void)
+{
+ git_repository *extended;
+
+ cl_repo_set_string(repo, "extensions.noop", "foobar");
+
+ cl_git_pass(git_repository_open(&extended, "empty_bare.git"));
+ cl_assert(git_repository_path(extended) != NULL);
+ cl_assert(git__suffixcmp(git_repository_path(extended), "/") == 0);
+ git_repository_free(extended);
+}
+
+void test_repo_extensions__unsupported(void)
+{
+ git_repository *extended = NULL;
+
+ cl_repo_set_string(repo, "extensions.unknown", "foobar");
+
+ cl_git_fail(git_repository_open(&extended, "empty_bare.git"));
+ git_repository_free(extended);
+}
diff --git a/tests/repo/open.c b/tests/repo/open.c
index 881a23d34..bd60c12c2 100644
--- a/tests/repo/open.c
+++ b/tests/repo/open.c
@@ -42,48 +42,6 @@ void test_repo_open__format_version_1(void)
git_repository_free(repo);
}
-void test_repo_open__format_version_1_with_valid_extension(void)
-{
- git_repository *repo;
- git_config *config;
-
- repo = cl_git_sandbox_init("empty_bare.git");
-
- cl_git_pass(git_repository_open(&repo, "empty_bare.git"));
- cl_git_pass(git_repository_config(&config, repo));
-
- cl_git_pass(git_config_set_int32(config, "core.repositoryformatversion", 1));
- cl_git_pass(git_config_set_int32(config, "extensions.noop", 1));
-
- git_config_free(config);
- git_repository_free(repo);
-
- cl_git_pass(git_repository_open(&repo, "empty_bare.git"));
- cl_assert(git_repository_path(repo) != NULL);
- cl_assert(git__suffixcmp(git_repository_path(repo), "/") == 0);
- git_repository_free(repo);
-}
-
-void test_repo_open__format_version_1_with_invalid_extension(void)
-{
- git_repository *repo;
- git_config *config;
-
- repo = cl_git_sandbox_init("empty_bare.git");
-
- cl_git_pass(git_repository_open(&repo, "empty_bare.git"));
- cl_git_pass(git_repository_config(&config, repo));
-
- cl_git_pass(git_config_set_int32(config, "core.repositoryformatversion", 1));
- cl_git_pass(git_config_set_int32(config, "extensions.invalid", 1));
-
- git_config_free(config);
- git_repository_free(repo);
-
- cl_git_fail(git_repository_open(&repo, "empty_bare.git"));
- git_repository_free(repo);
-}
-
void test_repo_open__standard_empty_repo_through_gitdir(void)
{
git_repository *repo;