summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-24 14:25:36 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-24 14:33:02 +0200
commit76633215d155dff2d5cda302aa868043b2c7090c (patch)
tree333f34ca9f9ca5c7f4dd8013d29cac9f64d70e91
parentaacfd03dba68333da726bb63e2594f3ed4a16422 (diff)
downloadlibgit2-cmn/diff-binary-patch.tar.gz
binary diff: test that the diff and patch otputs are the samecmn/diff-binary-patch
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.
-rw-r--r--tests/diff/binary.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/diff/binary.c b/tests/diff/binary.c
index 424a53e5f..90f2d5a06 100644
--- a/tests/diff/binary.c
+++ b/tests/diff/binary.c
@@ -1,5 +1,7 @@
#include "clar_libgit2.h"
+#include "git2/sys/diff.h"
+
#include "buffer.h"
#include "filebuf.h"
@@ -49,6 +51,11 @@ void test_patch(
cl_assert_equal_s(expected, actual.ptr);
+ git_buf_clear(&actual);
+ cl_git_pass(git_diff_print(diff, GIT_DIFF_FORMAT_PATCH, git_diff_print_callback__to_buf, &actual));
+
+ cl_assert_equal_s(expected, actual.ptr);
+
git_buf_free(&actual);
git_patch_free(patch);
git_diff_free(diff);