summaryrefslogtreecommitdiff
path: root/tests/patch/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/patch/parse.c')
-rw-r--r--tests/patch/parse.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/patch/parse.c b/tests/patch/parse.c
index 3f89eb51a..a3c4c6730 100644
--- a/tests/patch/parse.c
+++ b/tests/patch/parse.c
@@ -27,13 +27,14 @@ static void ensure_patch_validity(git_patch *patch)
cl_assert_equal_i(0, delta->new_file.size);
}
-static void ensure_identical_patch_inout(const char *content) {
+static void ensure_identical_patch_inout(const char *content)
+{
git_buf buf = GIT_BUF_INIT;
git_patch *patch;
cl_git_pass(git_patch_from_buffer(&patch, content, strlen(content), NULL));
cl_git_pass(git_patch_to_buf(&buf, patch));
- cl_assert_equal_strn(git_buf_cstr(&buf), content, strlen(content));
+ cl_assert_equal_strn(buf.ptr, content, strlen(content));
git_patch_free(patch);
git_buf_dispose(&buf);
@@ -131,12 +132,13 @@ void test_patch_parse__files_with_whitespaces_succeeds(void)
void test_patch_parse__lifetime_of_patch_does_not_depend_on_buffer(void)
{
- git_buf diff = GIT_BUF_INIT, rendered = GIT_BUF_INIT;
+ git_str diff = GIT_STR_INIT;
+ git_buf rendered = GIT_BUF_INIT;
git_patch *patch;
- cl_git_pass(git_buf_sets(&diff, PATCH_ORIGINAL_TO_CHANGE_MIDDLE));
+ cl_git_pass(git_str_sets(&diff, PATCH_ORIGINAL_TO_CHANGE_MIDDLE));
cl_git_pass(git_patch_from_buffer(&patch, diff.ptr, diff.size, NULL));
- git_buf_dispose(&diff);
+ git_str_dispose(&diff);
cl_git_pass(git_patch_to_buf(&rendered, patch));
cl_assert_equal_s(PATCH_ORIGINAL_TO_CHANGE_MIDDLE, rendered.ptr);