-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from bittrance/patch-refactor
Allow access to structured object representation of patch data
- Loading branch information
Showing
4 changed files
with
177 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const VERBOSE = false; | ||
|
||
var diff = require('../diff'); | ||
|
||
function log() { | ||
VERBOSE && console.log.apply(console, arguments); | ||
} | ||
|
||
describe('#structuredPatch', function() { | ||
it('should handle files with the last line changed', function() { | ||
var res = diff.structuredPatch( | ||
'oldfile', 'newfile', | ||
'line2\nline3\nline4\n', 'line2\nline3\nline5', | ||
'header1', 'header2' | ||
); | ||
res.should.eql({ | ||
oldFileName: 'oldfile', newFileName: 'newfile', | ||
oldHeader: 'header1', newHeader: 'header2', | ||
hunks: [{ | ||
oldStart: 1, oldLines: 3, newStart: 1, newLines: 3, | ||
lines: [' line2', ' line3', '-line4', '+line5', '\\ No newline at end of file'], | ||
}] | ||
}); | ||
}); | ||
}); |