File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -705,6 +705,45 @@ describe('patch/create', function() {
705705 } ) ;
706706 } ) ;
707707
708+ describe ( 'stripTrailingCr' , function ( ) {
709+ it ( 'stripTrailingCr: false' , function ( ) {
710+ const expectedResult =
711+ '===================================================================\n'
712+ + '--- foo\n'
713+ + '+++ bar\n'
714+ + '@@ -1,2 +1,2 @@\n'
715+ + '\-line\n'
716+ + '\+line\r\n'
717+ + '\ line\n'
718+ + '\\ No newline at end of file\n' ;
719+ expect ( createTwoFilesPatch (
720+ 'foo' ,
721+ 'bar' ,
722+ 'line\nline' ,
723+ 'line\r\nline' ,
724+ undefined ,
725+ undefined ,
726+ { stripTrailingCr : false }
727+ ) ) . to . equal ( expectedResult ) ;
728+ } ) ;
729+
730+ it ( 'stripTrailingCr: true' , function ( ) {
731+ const expectedResult =
732+ '===================================================================\n'
733+ + '--- foo\n'
734+ + '+++ bar\n' ;
735+ expect ( createTwoFilesPatch (
736+ 'foo' ,
737+ 'bar' ,
738+ 'line\nline' ,
739+ 'line\r\nline' ,
740+ undefined ,
741+ undefined ,
742+ { stripTrailingCr : true }
743+ ) ) . to . equal ( expectedResult ) ;
744+ } ) ;
745+ } ) ;
746+
708747 describe ( '#structuredPatch' , function ( ) {
709748 it ( 'should handle files with the last line changed' , function ( ) {
710749 const res = structuredPatch (
You can’t perform that action at this time.
0 commit comments