summaryrefslogtreecommitdiff
path: root/tests-clar/diff/diff_helpers.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-06-25 00:25:35 +0200
committerVicent Marti <tanoku@gmail.com>2013-06-25 00:25:35 +0200
commit29d7242b1dcd1f09a63417abd648a6217b85d301 (patch)
treededc3bc07a500770382ca4c517e4bb015e506c4b /tests-clar/diff/diff_helpers.c
parenta50086d174658914d4d6462afbc83b02825b1f5b (diff)
parenteddc1f1ed78898a4ca41480045b1d0d5b075e773 (diff)
downloadlibgit2-29d7242b1dcd1f09a63417abd648a6217b85d301.tar.gz
Merge branch 'development'
Diffstat (limited to 'tests-clar/diff/diff_helpers.c')
-rw-r--r--tests-clar/diff/diff_helpers.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c
index 19c005e2e..4e23792a6 100644
--- a/tests-clar/diff/diff_helpers.c
+++ b/tests-clar/diff/diff_helpers.c
@@ -28,7 +28,15 @@ int diff_file_cb(
{
diff_expects *e = payload;
- GIT_UNUSED(progress);
+ if (e->debug)
+ fprintf(stderr, "%c %s (%.3f)\n",
+ git_diff_status_char(delta->status),
+ delta->old_file.path, progress);
+
+ if (e->names)
+ cl_assert_equal_s(e->names[e->files], delta->old_file.path);
+ if (e->statuses)
+ cl_assert_equal_i(e->statuses[e->files], (int)delta->status);
e->files++;
@@ -89,20 +97,15 @@ int diff_line_cb(
e->lines++;
switch (line_origin) {
case GIT_DIFF_LINE_CONTEXT:
+ case GIT_DIFF_LINE_CONTEXT_EOFNL: /* techically not a line */
e->line_ctxt++;
break;
case GIT_DIFF_LINE_ADDITION:
- e->line_adds++;
- break;
- case GIT_DIFF_LINE_ADD_EOFNL:
- /* technically not a line add, but we'll count it as such */
+ case GIT_DIFF_LINE_ADD_EOFNL: /* technically not a line add */
e->line_adds++;
break;
case GIT_DIFF_LINE_DELETION:
- e->line_dels++;
- break;
- case GIT_DIFF_LINE_DEL_EOFNL:
- /* technically not a line delete, but we'll count it as such */
+ case GIT_DIFF_LINE_DEL_EOFNL: /* technically not a line delete */
e->line_dels++;
break;
default:
@@ -210,3 +213,8 @@ void diff_print(FILE *fp, git_diff_list *diff)
{
cl_git_pass(git_diff_print_patch(diff, diff_print_cb, fp ? fp : stderr));
}
+
+void diff_print_raw(FILE *fp, git_diff_list *diff)
+{
+ cl_git_pass(git_diff_print_raw(diff, diff_print_cb, fp ? fp : stderr));
+}