Skip to content

Commit 5630958

Browse files
authored
Merge branch 'master' into feature/git-modes
2 parents 6678d35 + 147a32d commit 5630958

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

__tests__/parse.spec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,9 @@ index 123..456 789
258258
+++ b/file1
259259
@@ -1,1 +1,1 @@
260260
- line1
261+
\\ No newline at end of file
261262
+ line2
262-
\\ No newline at end of file\
263+
\\ No newline at end of file
263264
`;
264265
const files = parse(diff);
265266
expect(files.length).toBe(1);
@@ -270,11 +271,13 @@ index 123..456 789
270271
expect(file.newMode).toBe("789");
271272
const chunk = file.chunks[0];
272273
expect(chunk.content).toBe("@@ -1,1 +1,1 @@");
273-
expect(chunk.changes.length).toBe(3);
274+
expect(chunk.changes.length).toBe(4);
274275
expect(chunk.changes[0].content).toBe("- line1");
275-
expect(chunk.changes[1].content).toBe("+ line2");
276-
expect(chunk.changes[2].type).toBe("add");
277-
expect(chunk.changes[2].content).toBe("\\ No newline at end of file");
276+
expect(chunk.changes[1].type).toBe("del");
277+
expect(chunk.changes[1].content).toBe("\\ No newline at end of file");
278+
expect(chunk.changes[2].content).toBe("+ line2");
279+
expect(chunk.changes[3].type).toBe("add");
280+
expect(chunk.changes[3].content).toBe("\\ No newline at end of file");
278281
});
279282

280283
it("should parse gnu sample diff", function () {

parse.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ module.exports = (input) => {
163163
];
164164

165165
const schemaContent = [
166+
[/^\\ No newline at end of file$/, eof],
166167
[/^-/, del],
167168
[/^\+/, add],
168169
[/^\s+/, normal],

0 commit comments

Comments
 (0)