summaryrefslogtreecommitdiff
path: root/tests/diff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-22 23:56:10 -0400
committerDrew DeVault <sir@cmpwn.com>2019-04-05 20:44:10 -0400
commit30c06b601eaf9b87975a3731ad1051d74b1ae73d (patch)
treec577ebc827c3b42f447c25b6367c3c61a7c30929 /tests/diff
parentaeea1c463941806a0176859c06c0e2e9716efcb0 (diff)
downloadlibgit2-30c06b601eaf9b87975a3731ad1051d74b1ae73d.tar.gz
patch_parse.c: Handle CRLF in parse_header_start
Diffstat (limited to 'tests/diff')
-rw-r--r--tests/diff/parse.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/diff/parse.c b/tests/diff/parse.c
index 7cc468245..a067861de 100644
--- a/tests/diff/parse.c
+++ b/tests/diff/parse.c
@@ -360,6 +360,7 @@ void test_diff_parse__lineinfo(void)
git_diff_free(diff);
}
+
void test_diff_parse__new_file_with_space(void)
{
const char *content = PATCH_ORIGINAL_NEW_FILE_WITH_SPACE;
@@ -377,3 +378,21 @@ void test_diff_parse__new_file_with_space(void)
git_patch_free(patch);
git_diff_free(diff);
}
+
+void test_diff_parse__crlf(void)
+{
+ const char *text = PATCH_CRLF;
+ git_diff *diff;
+ git_patch *patch;
+ const git_diff_delta *delta;
+
+ cl_git_pass(git_diff_from_buffer(&diff, text, strlen(text)));
+ cl_git_pass(git_patch_from_diff(&patch, diff, 0));
+ delta = git_patch_get_delta(patch);
+
+ cl_assert_equal_s(delta->old_file.path, "test-file");
+ cl_assert_equal_s(delta->new_file.path, "test-file");
+
+ git_patch_free(patch);
+ git_diff_free(diff);
+}