Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-11-01 20:25:32 +0400
committerVicent Marti <tanoku@gmail.com>2013-11-01 20:25:32 +0400
commit653ec420f9db9924e669a749d7c4e226f824a1d2 (patch)
treed908db20abefa16069c96906f3137180de9ef288 /tests-clar
parentab44c62e548373c1494e967f54720faa06ce38b7 (diff)
parent376454d03dbb0c78b1266a85b29ec8bf48930a4d (diff)
Merge remote-tracking branch 'drodriguez/fix-remote-save' into development
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/config/multivar.c65
-rw-r--r--tests-clar/network/remote/remotes.c25
2 files changed, 81 insertions, 9 deletions
diff --git a/tests-clar/config/multivar.c b/tests-clar/config/multivar.c
index 0d552d65e..afdb1e5f4 100644
--- a/tests-clar/config/multivar.c
+++ b/tests-clar/config/multivar.c
@@ -221,3 +221,68 @@ void test_config_multivar__replace_multiple(void)
git_config_free(cfg);
}
+
+void test_config_multivar__delete(void)
+{
+ git_config *cfg;
+ int n;
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config/config11"));
+
+ n = 0;
+ cl_git_pass(git_config_get_multivar_foreach(cfg, _name, NULL, cb, &n));
+ cl_assert(n == 2);
+
+ cl_git_pass(git_config_delete_multivar(cfg, _name, "github"));
+
+ n = 0;
+ cl_git_pass(git_config_get_multivar_foreach(cfg, _name, NULL, cb, &n));
+ cl_assert(n == 1);
+
+ git_config_free(cfg);
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config/config11"));
+
+ n = 0;
+ cl_git_pass(git_config_get_multivar_foreach(cfg, _name, NULL, cb, &n));
+ cl_assert(n == 1);
+
+ git_config_free(cfg);
+}
+
+void test_config_multivar__delete_multiple(void)
+{
+ git_config *cfg;
+ int n;
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config/config11"));
+
+ n = 0;
+ cl_git_pass(git_config_get_multivar_foreach(cfg, _name, NULL, cb, &n));
+ cl_assert(n == 2);
+
+ cl_git_pass(git_config_delete_multivar(cfg, _name, "git"));
+
+ n = 0;
+ cl_git_fail_with(git_config_get_multivar_foreach(cfg, _name, NULL, cb, &n), GIT_ENOTFOUND);
+
+ git_config_free(cfg);
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config/config11"));
+
+ n = 0;
+ cl_git_fail_with(git_config_get_multivar_foreach(cfg, _name, NULL, cb, &n), GIT_ENOTFOUND);
+
+ git_config_free(cfg);
+}
+
+void test_config_multivar__delete_notfound(void)
+{
+ git_config *cfg;
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config/config11"));
+
+ cl_git_fail_with(git_config_delete_multivar(cfg, "remote.ab.noturl", "git"), GIT_ENOTFOUND);
+
+ git_config_free(cfg);
+}
diff --git a/tests-clar/network/remote/remotes.c b/tests-clar/network/remote/remotes.c
index 6e0eeeb05..7c79b8318 100644
--- a/tests-clar/network/remote/remotes.c
+++ b/tests-clar/network/remote/remotes.c
@@ -150,8 +150,10 @@ void test_network_remote_remotes__add_pushspec(void)
void test_network_remote_remotes__save(void)
{
git_strarray array;
- const char *fetch_refspec = "refs/heads/*:refs/remotes/upstream/*";
- const char *push_refspec = "refs/heads/*:refs/heads/*";
+ const char *fetch_refspec1 = "refs/heads/ns1/*:refs/remotes/upstream/ns1/*";
+ const char *fetch_refspec2 = "refs/heads/ns2/*:refs/remotes/upstream/ns2/*";
+ const char *push_refspec1 = "refs/heads/ns1/*:refs/heads/ns1/*";
+ const char *push_refspec2 = "refs/heads/ns2/*:refs/heads/ns2/*";
git_remote_free(_remote);
_remote = NULL;
@@ -160,8 +162,10 @@ void test_network_remote_remotes__save(void)
cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2"));
git_remote_clear_refspecs(_remote);
- cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec));
- cl_git_pass(git_remote_add_push(_remote, push_refspec));
+ cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec1));
+ cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec2));
+ cl_git_pass(git_remote_add_push(_remote, push_refspec1));
+ cl_git_pass(git_remote_add_push(_remote, push_refspec2));
cl_git_pass(git_remote_set_pushurl(_remote, "git://github.com/libgit2/libgit2_push"));
cl_git_pass(git_remote_save(_remote));
git_remote_free(_remote);
@@ -171,16 +175,19 @@ void test_network_remote_remotes__save(void)
cl_git_pass(git_remote_load(&_remote, _repo, "upstream"));
cl_git_pass(git_remote_get_fetch_refspecs(&array, _remote));
- cl_assert_equal_i(1, (int)array.count);
- cl_assert_equal_s(fetch_refspec, array.strings[0]);
+ cl_assert_equal_i(2, (int)array.count);
+ cl_assert_equal_s(fetch_refspec1, array.strings[0]);
+ cl_assert_equal_s(fetch_refspec2, array.strings[1]);
git_strarray_free(&array);
cl_git_pass(git_remote_get_push_refspecs(&array, _remote));
- cl_assert_equal_i(1, (int)array.count);
- cl_assert_equal_s(push_refspec, array.strings[0]);
+ cl_assert_equal_i(2, (int)array.count);
+ cl_assert_equal_s(push_refspec1, array.strings[0]);
+ cl_assert_equal_s(push_refspec2, array.strings[1]);
+ git_strarray_free(&array);
+
cl_assert_equal_s(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
cl_assert_equal_s(git_remote_pushurl(_remote), "git://github.com/libgit2/libgit2_push");
- git_strarray_free(&array);
/* remove the pushurl again and see if we can save that too */
cl_git_pass(git_remote_set_pushurl(_remote, NULL));