diff options
author | Nick Hengeveld <nickh@github.com> | 2013-11-18 14:03:25 -0800 |
---|---|---|
committer | Nick Hengeveld <nickh@github.com> | 2013-11-18 14:03:25 -0800 |
commit | d8e7ffc2a246491aa139875e840fff34c832a739 (patch) | |
tree | 26c8ac94f356e381b98274413f4446dc9573aa2e /tests | |
parent | e1ce5249e52e9c5271727d7e2ef5bba4c45277b9 (diff) | |
download | libgit2-d8e7ffc2a246491aa139875e840fff34c832a739.tar.gz |
Add content offset to git_diff_line
For additions and deletions, external consumers like subversion
can make use of the content offset to generate diffs in their
proprietary formats.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/diff/patch.c | 6 |
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); |