File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff 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 ( ) {
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ module.exports = (input) => {
163163 ] ;
164164
165165 const schemaContent = [
166+ [ / ^ \\ N o n e w l i n e a t e n d o f f i l e $ / , eof ] ,
166167 [ / ^ - / , del ] ,
167168 [ / ^ \+ / , add ] ,
168169 [ / ^ \s + / , normal ] ,
You can’t perform that action at this time.
0 commit comments