summaryrefslogtreecommitdiff
path: root/tests/patch/patch_common.h
diff options
context:
space:
mode:
authorMax Kostyukevich <maxim.kostyukevich@mera.com>2019-08-28 23:18:31 +0300
committerMax Kostyukevich <maxim.kostyukevich@mera.com>2019-08-28 23:18:31 +0300
commit585fbd74d2bdd0789c62cb9f12452898a9cbecae (patch)
treed6b1f9070536b5a7c43d6dba311d1bf696c73611 /tests/patch/patch_common.h
parent630127e318663a0d48a73cdf20f5aae662500f86 (diff)
downloadlibgit2-585fbd74d2bdd0789c62cb9f12452898a9cbecae.tar.gz
apply: Test for EOFNL mishandling when several hunks are processed
Introduce an unit test to validate that git_apply__patch() properly handles EOFNL changes in case of patches with several hunks.
Diffstat (limited to 'tests/patch/patch_common.h')
-rw-r--r--tests/patch/patch_common.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/patch/patch_common.h b/tests/patch/patch_common.h
index 2db8d933f..690e0a662 100644
--- a/tests/patch/patch_common.h
+++ b/tests/patch/patch_common.h
@@ -263,6 +263,32 @@
"-(this line is changed)\n" \
"+(THIS line is changed!)\n"
+/* A change in the middle and a deletion of the newline at the end of the file */
+
+#define FILE_CHANGE_MIDDLE_AND_LASTLINE \
+ "hey!\n" \
+ "this is some context!\n" \
+ "around some lines\n" \
+ "that will change\n" \
+ "yes it is!\n" \
+ "(THIS line is changed!)\n" \
+ "and this\n" \
+ "is additional context\n" \
+ "BELOW it! - (THIS line is changed!)"
+
+#define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_AND_LASTLINE_NOCONTEXT \
+ "diff --git a/file.txt b/file.txt\n" \
+ "index 9432026..e05d36c 100644\n" \
+ "--- a/file.txt\n" \
+ "+++ b/file.txt\n" \
+ "@@ -6 +6 @@ yes it is!\n" \
+ "-(this line is changed)\n" \
+ "+(THIS line is changed!)\n" \
+ "@@ -9 +9 @@ is additional context\n" \
+ "-below it!\n" \
+ "+BELOW it! - (THIS line is changed!)\n" \
+ "\\ No newline at end of file\n"
+
/* A deletion at the beginning of the file and a change in the middle */
#define FILE_DELETE_AND_CHANGE \