Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a consistency test
  • Loading branch information
ExplodingCabbage committed Dec 27, 2023
commit be9ad3c9a20992b2f4d53cd68ca95def9415fcfa
34 changes: 34 additions & 0 deletions test/patch/parse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {parsePatch} from '../../lib/patch/parse';
import {createPatch} from '../../lib/patch/create';

import {expect} from 'chai';

Expand Down Expand Up @@ -464,5 +465,38 @@ Index: test2
}
]);
});

it('should treat vertical tabs in a way consistent with createPatch', function() {
// This is basically the same as the test above, but this time we create
// the patch USING JsDiff instead of testing one created with Unix diff
const patch = createPatch('foo', 'foo\nbar\vbar\nbaz\nqux', 'foo\nbarry\vbarry\nbaz\nqux');

expect(parsePatch(patch)).to.eql([
{
oldFileName: 'foo',
oldHeader: '',
newFileName: 'foo',
newHeader: '',
index: 'foo',
hunks: [
{
oldStart: 1,
oldLines: 4,
newStart: 1,
newLines: 4,
lines: [
' foo',
'-bar\x0Bbar',
'+barry\x0Bbarry',
' baz',
' qux',
'\\ No newline at end of file'
],
linedelimiters: [ '\n', '\n', '\n', '\n', '\n', '\n' ]
}
]
}
]);
});
});
});