@@ -14,13 +14,13 @@ describe('patch/parse', function() {
1414 . to . eql ( [ {
1515 hunks : [
1616 {
17- from : { line : 1 , count : 3 } ,
18- to : { line : 1 , count : 4 } ,
17+ oldStart : 1 , oldLines : 3 ,
18+ newStart : 1 , newLines : 4 ,
1919 lines : [
20- { operation : ' ' , content : ' line2'} ,
21- { operation : ' ' , content : ' line3'} ,
22- { operation : '+' , content : ' line4'} ,
23- { operation : ' ' , content : ' line5'}
20+ ' line2',
21+ ' line3',
22+ '+ line4',
23+ ' line5'
2424 ]
2525 }
2626 ]
@@ -34,11 +34,11 @@ describe('patch/parse', function() {
3434 . to . eql ( [ {
3535 hunks : [
3636 {
37- from : { line : 1 , count : 1 } ,
38- to : { line : 1 , count : 1 } ,
37+ oldStart : 1 , oldLines : 1 ,
38+ newStart : 1 , newLines : 1 ,
3939 lines : [
40- { operation : '-' , content : ' line3'} ,
41- { operation : '+' , content : ' line4'}
40+ '- line3',
41+ '+ line4'
4242 ]
4343 }
4444 ]
@@ -59,23 +59,23 @@ describe('patch/parse', function() {
5959 . to . eql ( [ {
6060 hunks : [
6161 {
62- from : { line : 1 , count : 3 } ,
63- to : { line : 1 , count : 4 } ,
62+ oldStart : 1 , oldLines : 3 ,
63+ newStart : 1 , newLines : 4 ,
6464 lines : [
65- { operation : ' ' , content : ' line2'} ,
66- { operation : ' ' , content : ' line3'} ,
67- { operation : '+' , content : ' line4'} ,
68- { operation : ' ' , content : ' line5'}
65+ ' line2',
66+ ' line3',
67+ '+ line4',
68+ ' line5'
6969 ]
7070 } ,
7171 {
72- from : { line : 4 , count : 3 } ,
73- to : { line : 1 , count : 4 } ,
72+ oldStart : 4 , oldLines : 3 ,
73+ newStart : 1 , newLines : 4 ,
7474 lines : [
75- { operation : ' ' , content : ' line2'} ,
76- { operation : ' ' , content : ' line3'} ,
77- { operation : '-' , content : ' line4'} ,
78- { operation : ' ' , content : ' line5'}
75+ ' line2',
76+ ' line3',
77+ '- line4',
78+ ' line5'
7979 ]
8080 }
8181 ]
@@ -94,23 +94,19 @@ describe('patch/parse', function() {
9494 line5` ) )
9595 . to . eql ( [ {
9696 index : 'test' ,
97- from : {
98- file : 'from' ,
99- header : 'header1'
100- } ,
101- to : {
102- file : 'to' ,
103- header : 'header2'
104- } ,
97+ oldFileName : 'from' ,
98+ oldHeader : 'header1' ,
99+ newFileName : 'to' ,
100+ newHeader : 'header2' ,
105101 hunks : [
106102 {
107- from : { line : 1 , count : 3 } ,
108- to : { line : 1 , count : 4 } ,
103+ oldStart : 1 , oldLines : 3 ,
104+ newStart : 1 , newLines : 4 ,
109105 lines : [
110- { operation : ' ' , content : ' line2'} ,
111- { operation : ' ' , content : ' line3'} ,
112- { operation : '+' , content : ' line4'} ,
113- { operation : ' ' , content : ' line5'}
106+ ' line2',
107+ ' line3',
108+ '+ line4',
109+ ' line5'
114110 ]
115111 }
116112 ]
@@ -138,45 +134,37 @@ Index: test2
138134 line5` ) )
139135 . to . eql ( [ {
140136 index : 'test' ,
141- from : {
142- file : 'from' ,
143- header : 'header1'
144- } ,
145- to : {
146- file : 'to' ,
147- header : 'header2'
148- } ,
137+ oldFileName : 'from' ,
138+ oldHeader : 'header1' ,
139+ newFileName : 'to' ,
140+ newHeader : 'header2' ,
149141 hunks : [
150142 {
151- from : { line : 1 , count : 3 } ,
152- to : { line : 1 , count : 4 } ,
143+ oldStart : 1 , oldLines : 3 ,
144+ newStart : 1 , newLines : 4 ,
153145 lines : [
154- { operation : ' ' , content : ' line2'} ,
155- { operation : ' ' , content : ' line3'} ,
156- { operation : '+' , content : ' line4'} ,
157- { operation : ' ' , content : ' line5'}
146+ ' line2',
147+ ' line3',
148+ '+ line4',
149+ ' line5'
158150 ]
159151 }
160152 ]
161153 } , {
162154 index : 'test2' ,
163- from : {
164- file : 'from' ,
165- header : 'header1'
166- } ,
167- to : {
168- file : 'to' ,
169- header : 'header2'
170- } ,
155+ oldFileName : 'from' ,
156+ oldHeader : 'header1' ,
157+ newFileName : 'to' ,
158+ newHeader : 'header2' ,
171159 hunks : [
172160 {
173- from : { line : 1 , count : 3 } ,
174- to : { line : 1 , count : 4 } ,
161+ oldStart : 1 , oldLines : 3 ,
162+ newStart : 1 , newLines : 4 ,
175163 lines : [
176- { operation : ' ' , content : ' line2'} ,
177- { operation : ' ' , content : ' line3'} ,
178- { operation : '+' , content : ' line4'} ,
179- { operation : ' ' , content : ' line5'}
164+ ' line2',
165+ ' line3',
166+ '+ line4',
167+ ' line5'
180168 ]
181169 }
182170 ]
@@ -191,14 +179,14 @@ Index: test2
191179 . to . eql ( [ {
192180 hunks : [
193181 {
194- from : { line : 1 , count : 3 } ,
195- to : { line : 1 , count : 4 } ,
182+ oldStart : 1 , oldLines : 3 ,
183+ newStart : 1 , newLines : 4 ,
196184 lines : [
197- { operation : '-' , content : 'line5' }
185+ '-line5' ,
186+ '\\ No newline at end of file'
198187 ]
199188 }
200- ] ,
201- addEOFNL : true
189+ ]
202190 } ] ) ;
203191 } ) ;
204192 it ( 'should note removed EOFNL' , function ( ) {
@@ -209,14 +197,14 @@ Index: test2
209197 . to . eql ( [ {
210198 hunks : [
211199 {
212- from : { line : 1 , count : 3 } ,
213- to : { line : 1 , count : 4 } ,
200+ oldStart : 1 , oldLines : 3 ,
201+ newStart : 1 , newLines : 4 ,
214202 lines : [
215- { operation : '+' , content : 'line5' }
203+ '+line5' ,
204+ '\\ No newline at end of file'
216205 ]
217206 }
218- ] ,
219- removeEOFNL : true
207+ ]
220208 } ] ) ;
221209 } ) ;
222210 it ( 'should ignore context no EOFNL' , function ( ) {
@@ -228,11 +216,12 @@ Index: test2
228216 . to . eql ( [ {
229217 hunks : [
230218 {
231- from : { line : 1 , count : 3 } ,
232- to : { line : 1 , count : 4 } ,
219+ oldStart : 1 , oldLines : 3 ,
220+ newStart : 1 , newLines : 4 ,
233221 lines : [
234- { operation : '+' , content : 'line4' } ,
235- { operation : ' ' , content : 'line5' }
222+ '+line4' ,
223+ ' line5' ,
224+ '\\ No newline at end of file'
236225 ]
237226 }
238227 ]
0 commit comments