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 @@ -631,6 +631,45 @@ describe('patch/create', function() {
631631 const diffResult = createTwoFilesPatch ( 'foo' , 'bar' , '' , '' ) ;
632632 expect ( diffResult ) . to . equal ( expectedResult ) ;
633633 } ) ;
634+
635+ describe ( 'stripTrailingCr' , function ( ) {
636+ it ( 'stripTrailingCr: false' , function ( ) {
637+ const expectedResult =
638+ '===================================================================\n'
639+ + '--- foo\n'
640+ + '+++ bar\n'
641+ + '@@ -1,2 +1,2 @@\n'
642+ + '\-line\n'
643+ + '\+line\r\n'
644+ + '\ line\n'
645+ + '\\ No newline at end of file\n' ;
646+ expect ( createTwoFilesPatch (
647+ 'foo' ,
648+ 'bar' ,
649+ 'line\nline' ,
650+ 'line\r\nline' ,
651+ undefined ,
652+ undefined ,
653+ { stripTrailingCr : false }
654+ ) ) . to . equal ( expectedResult ) ;
655+ } ) ;
656+
657+ it ( 'stripTrailingCr: true' , function ( ) {
658+ const expectedResult =
659+ '===================================================================\n'
660+ + '--- foo\n'
661+ + '+++ bar\n' ;
662+ expect ( createTwoFilesPatch (
663+ 'foo' ,
664+ 'bar' ,
665+ 'line\nline' ,
666+ 'line\r\nline' ,
667+ undefined ,
668+ undefined ,
669+ { stripTrailingCr : true }
670+ ) ) . to . equal ( expectedResult ) ;
671+ } ) ;
672+ } ) ;
634673 } ) ;
635674
636675 describe ( '#structuredPatch' , function ( ) {
You can’t perform that action at this time.
0 commit comments