Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7663321

Browse files
committed
binary diff: test that the diff and patch otputs are the same
We test the generation of the textual patch via the patch function, which are just one of two possibilities to get the output. Add a second patch generation via the diff function to make sure both outputs are in sync.
1 parent aacfd03 commit 7663321

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/diff/binary.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "clar_libgit2.h"
22

3+
#include "git2/sys/diff.h"
4+
35
#include "buffer.h"
46
#include "filebuf.h"
57

@@ -49,6 +51,11 @@ void test_patch(
4951

5052
cl_assert_equal_s(expected, actual.ptr);
5153

54+
git_buf_clear(&actual);
55+
cl_git_pass(git_diff_print(diff, GIT_DIFF_FORMAT_PATCH, git_diff_print_callback__to_buf, &actual));
56+
57+
cl_assert_equal_s(expected, actual.ptr);
58+
5259
git_buf_free(&actual);
5360
git_patch_free(patch);
5461
git_diff_free(diff);

0 commit comments

Comments
 (0)