diff options
| author | Etienne Samson <samson.etienne@gmail.com> | 2018-06-20 02:26:56 +0200 |
|---|---|---|
| committer | Etienne Samson <samson.etienne@gmail.com> | 2018-11-02 14:58:02 +0100 |
| commit | f8fc987ca295420d33e15d1948a78d7d376c589f (patch) | |
| tree | 754bc8493170f5002fd11a042c96085dbab52349 /tests/remote/create.c | |
| parent | 4e0da4501c3e4a43d519659f3d21aaf19646545a (diff) | |
| download | libgit2-f8fc987ca295420d33e15d1948a78d7d376c589f.tar.gz | |
tests: git_remote_create_detached
Diffstat (limited to 'tests/remote/create.c')
| -rw-r--r-- | tests/remote/create.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/remote/create.c b/tests/remote/create.c index 84dc0bec9..394f7dddc 100644 --- a/tests/remote/create.c +++ b/tests/remote/create.c @@ -76,6 +76,7 @@ void test_remote_create__named(void) cl_assert_equal_s(git_remote_name(remote), "valid-name"); cl_assert_equal_s(git_remote_url(remote), TEST_URL); + cl_assert_equal_p(git_remote_owner(remote), _repo); cl_git_pass(git_repository_config_snapshot(&cfg, _repo)); @@ -119,6 +120,10 @@ void test_remote_create__with_fetchspec(void) size_t section_count = cl_git_config_sections_count(_config, "remote."); cl_git_pass(git_remote_create_with_fetchspec(&remote, _repo, "test-new", "git://github.com/libgit2/libgit2", "+refs/*:refs/*")); + cl_assert_equal_s(git_remote_name(remote), "test-new"); + cl_assert_equal_s(git_remote_url(remote), "git://github.com/libgit2/libgit2"); + cl_assert_equal_p(git_remote_owner(remote), _repo); + cl_git_pass(git_remote_get_fetch_refspecs(&array, remote)); cl_assert_equal_s("+refs/*:refs/*", array.strings[0]); cl_assert_equal_i(1, array.count); @@ -162,6 +167,7 @@ void test_remote_create__anonymous(void) cl_git_pass(git_remote_create_anonymous(&remote, _repo, TEST_URL)); cl_assert_equal_s(git_remote_name(remote), NULL); cl_assert_equal_s(git_remote_url(remote), TEST_URL); + cl_assert_equal_p(git_remote_owner(remote), _repo); cl_git_pass(git_remote_get_fetch_refspecs(&array, remote)); cl_assert_equal_i(0, array.count); @@ -175,3 +181,27 @@ void test_remote_create__anonymous_invalid_url(void) { cl_git_assert_cannot_create_remote(GIT_EINVALIDSPEC, git_remote_create_anonymous(&r, _repo, "")); } + +void test_remote_create__detached(void) +{ + git_remote *remote; + git_strarray array; + size_t section_count = cl_git_config_sections_count(_config, "remote."); + + cl_git_pass(git_remote_create_detached(&remote, TEST_URL)); + cl_assert_equal_s(git_remote_name(remote), NULL); + cl_assert_equal_s(git_remote_url(remote), TEST_URL); + cl_assert_equal_p(git_remote_owner(remote), NULL); + + cl_git_pass(git_remote_get_fetch_refspecs(&array, remote)); + cl_assert_equal_i(0, array.count); + cl_assert_equal_i(section_count, cl_git_config_sections_count(_config, "remote.")); + + git_strarray_free(&array); + git_remote_free(remote); +} + +void test_remote_create__detached_invalid_url(void) +{ + cl_git_assert_cannot_create_remote(GIT_EINVALIDSPEC, git_remote_create_detached(&r, "")); +} |
