summaryrefslogtreecommitdiff
path: root/tests/diff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-11-19 11:36:02 -0800
committerVicent Martí <vicent@github.com>2013-11-19 11:36:02 -0800
commite479628a01eddafd357bd3b49526ab49998edcef (patch)
treeab8d7b7b6646ab1b3fcb8af0133ae2a9575ac979 /tests/diff
parent7146eff309938c966e379d0e03825f3eabcc52be (diff)
parentd8e7ffc2a246491aa139875e840fff34c832a739 (diff)
downloadlibgit2-e479628a01eddafd357bd3b49526ab49998edcef.tar.gz
Merge pull request #1966 from nickh/patch_content_offsets
Add content offset to git_diff_line
Diffstat (limited to 'tests/diff')
-rw-r--r--tests/diff/patch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/diff/patch.c b/tests/diff/patch.c
index 366e5da58..bd1598b21 100644
--- a/tests/diff/patch.c
+++ b/tests/diff/patch.c
@@ -275,6 +275,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("Ivory their outposts were--the guardrooms of them gilded,\n", actual.ptr);
cl_assert_equal_i(6, line->old_lineno);
cl_assert_equal_i(6, line->new_lineno);
+ cl_assert_equal_i(-1, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 0, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)line->origin);
@@ -282,6 +283,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("All the world went softly when it walked before my Cities--\n", actual.ptr);
cl_assert_equal_i(9, line->old_lineno);
cl_assert_equal_i(-1, line->new_lineno);
+ cl_assert_equal_i(252, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 0, 12));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)line->origin);
@@ -289,6 +291,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("This is some new text;\n", actual.ptr);
cl_assert_equal_i(-1, line->old_lineno);
cl_assert_equal_i(9, line->new_lineno);
+ cl_assert_equal_i(252, line->content_offset);
/* check hunk 1 */
@@ -309,6 +312,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("My rulers and their treasure and their unborn populations,\n", actual.ptr);
cl_assert_equal_i(31, line->old_lineno);
cl_assert_equal_i(25, line->new_lineno);
+ cl_assert_equal_i(-1, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 1, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)line->origin);
@@ -316,6 +320,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("The Daughters of the Palace whom they cherished in my Cities,\n", actual.ptr);
cl_assert_equal_i(34, line->old_lineno);
cl_assert_equal_i(-1, line->new_lineno);
+ cl_assert_equal_i(1468, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 1, 12));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)line->origin);
@@ -323,6 +328,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("Another replacement;\n", actual.ptr);
cl_assert_equal_i(-1, line->old_lineno);
cl_assert_equal_i(28, line->new_lineno);
+ cl_assert_equal_i(1066, line->content_offset);
git_patch_free(patch);
git_diff_free(diff);