Skip to content

Commit

Permalink
Test for hunk offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
piranna committed Oct 21, 2015
1 parent 0c2af7b commit d723875
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/patch/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,27 @@ describe('patch/apply', function() {
+ 'line5\n');
});

it('should succeed when hunk has an offset', function() {
expect(applyPatch(
'line1\n'
+ 'line3\n'
+ 'line4\n'
+ 'line5\n',

'--- test\theader1\n'
+ '+++ test\theader2\n'
+ '@@ -3,2 +3,3 @@\n'
+ ' line1\n'
+ '+line2\n'
+ ' line3\n'))
.to.equal(
'line1\n'
+ 'line2\n'
+ 'line3\n'
+ 'line4\n'
+ 'line5\n');
});

it('should allow custom line comparison', function() {
expect(applyPatch(
'line2\n'
Expand Down

0 comments on commit d723875

Please sign in to comment.