1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Test we've added a nonewline line

This commit is contained in:
joshvera 2016-03-11 17:19:20 -05:00
parent 14094590a8
commit df8f7589ee
4 changed files with 8 additions and 3 deletions

View File

@ -47,7 +47,7 @@ rowIncrement = fmap lineIncrement
-- | Given the before and after sources, render a hunk to a string.
showHunk :: Both SourceBlob -> Hunk (SplitDiff a Info) -> String
showHunk blobs hunk = if last sourceHunk /= '\n'
then sourceHunk ++ "\n\\ No newline at end of file\n"
then sourceHunk ++ "\n\\\\ No newline at end of file\n"
else sourceHunk
where sources = source <$> blobs
sourceHunk = header blobs hunk ++ concat (showChange sources <$> changes hunk) ++ showLines (snd sources) ' ' (snd <$> trailingContext hunk)

View File

@ -0,0 +1 @@
console.log("hello, world");

View File

@ -0,0 +1,3 @@
console.log("hello, world");
console.log("insertion");

View File

@ -2,7 +2,8 @@ diff --git a/test/diffs/no-newline-at-eof.A.js b/test/diffs/no-newline-at-eof.B.
index .. 100644
--- a/test/diffs/no-newline-at-eof.A.js
+++ b/test/diffs/no-newline-at-eof.B.js
@@ -1,1 +1,3 @@
@@ -1,2 +1,3 @@
console.log("hello, world");
+console.log("insertion");
+console.log("insertion");
\\ No newline at end of file