File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ export function chars(input, expect) {
8989
9090 if ( l1 === l2 ) {
9191 // no length offsets
92- } else if ( tmp . removed ) {
92+ } else if ( tmp . removed && arr [ i + 1 ] ) {
9393 let del = tmp . count - arr [ i + 1 ] . count ;
9494 if ( del == 0 ) {
9595 // wash~
Original file line number Diff line number Diff line change @@ -547,6 +547,22 @@ chars('should print "→" character for tab', () => {
547547 ) ;
548548} ) ;
549549
550+ chars ( 'should handle empty string' , ( ) => {
551+ assert . is (
552+ strip ( $ . chars ( 'foo bar' , '' ) ) ,
553+ '++ (Expected)\n' +
554+ '--foo·bar (Actual)\n' +
555+ ' ^^^^^^^'
556+ ) ;
557+
558+ assert . is (
559+ strip ( $ . chars ( '' , 'foo bar' ) ) ,
560+ '++foo·bar (Expected)\n' +
561+ '-- (Actual)\n' +
562+ ' ^^^^^^^'
563+ ) ;
564+ } )
565+
550566chars . run ( ) ;
551567
552568// ---
You can’t perform that action at this time.
0 commit comments