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:
Diffstat (limited to 'tests/refs/branches/remote.c')
-rw-r--r--tests/refs/branches/remote.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/tests/refs/branches/remote.c b/tests/refs/branches/remote.c
index c110adb33..bac088454 100644
--- a/tests/refs/branches/remote.c
+++ b/tests/refs/branches/remote.c
@@ -21,53 +21,40 @@ void test_refs_branches_remote__cleanup(void)
void test_refs_branches_remote__can_get_remote_for_branch(void)
{
- char remotename[1024] = {0};
+ git_buf remotename = {0};
- cl_assert_equal_i(expected_remote_name_length,
- git_branch_remote_name(NULL, 0, g_repo, remote_tracking_branch_name));
+ cl_git_pass(git_branch_remote_name(&remotename, g_repo, remote_tracking_branch_name));
- cl_assert_equal_i(expected_remote_name_length,
- git_branch_remote_name(remotename, expected_remote_name_length, g_repo,
- remote_tracking_branch_name));
-
- cl_assert_equal_s("test", remotename);
-}
-
-void test_refs_branches_remote__insufficient_buffer_returns_error(void)
-{
- char remotename[1024] = {0};
-
- cl_assert_equal_i(expected_remote_name_length,
- git_branch_remote_name(NULL, 0, g_repo, remote_tracking_branch_name));
-
- cl_git_fail_with(git_branch_remote_name(remotename,
- expected_remote_name_length - 1, g_repo, remote_tracking_branch_name),
- expected_remote_name_length);
+ cl_assert_equal_s("test", remotename.ptr);
+ git_buf_free(&remotename);
}
void test_refs_branches_remote__no_matching_remote_returns_error(void)
{
const char *unknown = "refs/remotes/nonexistent/master";
+ git_buf buf;
giterr_clear();
- cl_git_fail_with(git_branch_remote_name(
- NULL, 0, g_repo, unknown), GIT_ENOTFOUND);
+ memset(&buf, 0, sizeof(git_buf));
+ cl_git_fail_with(git_branch_remote_name(&buf, g_repo, unknown), GIT_ENOTFOUND);
cl_assert(giterr_last() != NULL);
}
void test_refs_branches_remote__local_remote_returns_error(void)
{
const char *local = "refs/heads/master";
+ git_buf buf;
giterr_clear();
- cl_git_fail_with(git_branch_remote_name(
- NULL, 0, g_repo, local), GIT_ERROR);
+ memset(&buf, 0, sizeof(git_buf));
+ cl_git_fail_with(git_branch_remote_name(&buf, g_repo, local), GIT_ERROR);
cl_assert(giterr_last() != NULL);
}
void test_refs_branches_remote__ambiguous_remote_returns_error(void)
{
git_remote *remote;
+ git_buf buf;
/* Create the remote */
cl_git_pass(git_remote_create(&remote, g_repo, "addtest", "http://github.com/libgit2/libgit2"));
@@ -80,7 +67,7 @@ void test_refs_branches_remote__ambiguous_remote_returns_error(void)
git_remote_free(remote);
giterr_clear();
- cl_git_fail_with(git_branch_remote_name(NULL, 0, g_repo,
- remote_tracking_branch_name), GIT_EAMBIGUOUS);
+ memset(&buf, 0, sizeof(git_buf));
+ cl_git_fail_with(git_branch_remote_name(&buf, g_repo, remote_tracking_branch_name), GIT_EAMBIGUOUS);
cl_assert(giterr_last() != NULL);
}