Skip to content

Commit 823d31d

Browse files
authored
Add a test for removing the last newline in a file (#59)
This worked, but completes the test coverage in combination with the test that adds a final newline and one that leaves the missing newline in place.
1 parent fffa3cc commit 823d31d

4 files changed

+17
-0
lines changed

gitdiff/apply_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func TestApplyTextFragment(t *testing.T) {
2222
"changeStart": {Files: getApplyFiles("text_fragment_change_start")},
2323
"changeMiddle": {Files: getApplyFiles("text_fragment_change_middle")},
2424
"changeEnd": {Files: getApplyFiles("text_fragment_change_end")},
25+
"changeEndEOL": {Files: getApplyFiles("text_fragment_change_end_eol")},
2526
"changeExact": {Files: getApplyFiles("text_fragment_change_exact")},
2627
"changeSingleNoEOL": {Files: getApplyFiles("text_fragment_change_single_noeol")},
2728

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
line 1
2+
line 2
3+
line 3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
diff --git a/gitdiff/testdata/apply/text_fragment_remove_last_eol.src b/gitdiff/testdata/apply/text_fragment_remove_last_eol.src
2+
index a92d664..8cf2f17 100644
3+
--- a/gitdiff/testdata/apply/text_fragment_remove_last_eol.src
4+
+++ b/gitdiff/testdata/apply/text_fragment_remove_last_eol.src
5+
@@ -1,3 +1,3 @@
6+
line 1
7+
line 2
8+
-line 3
9+
+line 3
10+
\ No newline at end of file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
line 1
2+
line 2
3+
line 3

0 commit comments

Comments
 (0)