File tree 1 file changed +23
-0
lines changed
java-diff-utils/src/test/java/com/github/difflib/text
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 9
9
import java .util .List ;
10
10
import java .util .regex .Pattern ;
11
11
import static java .util .stream .Collectors .toList ;
12
+ import static org .assertj .core .api .Assertions .assertThat ;
12
13
import static org .junit .jupiter .api .Assertions .assertEquals ;
13
14
import static org .junit .jupiter .api .Assertions .assertTrue ;
14
15
import org .junit .jupiter .api .Test ;
@@ -457,4 +458,26 @@ public void testIgnoreWhitespaceIssue66_2() throws DiffException {
457
458
458
459
assertEquals ("This is a test~.~" , rows .get (0 ).getOldLine ());
459
460
}
461
+
462
+ @ Test
463
+ public void testIgnoreWhitespaceIssue64 () throws DiffException {
464
+ DiffRowGenerator generator = DiffRowGenerator .create ()
465
+ .showInlineDiffs (true )
466
+ .inlineDiffByWord (true )
467
+ .ignoreWhiteSpaces (true )
468
+ .mergeOriginalRevised (true )
469
+ .oldTag (f -> "~" ) //introduce markdown style for strikethrough
470
+ .newTag (f -> "**" ) //introduce markdown style for bold
471
+ .build ();
472
+
473
+ //compute the differences for two test texts.
474
+ List <DiffRow > rows = generator .generateDiffRows (
475
+ Arrays .asList ("test\n \n testline" .split ("\n " )),
476
+ Arrays .asList ("A new text line\n \n another one" .split ("\n " )));
477
+
478
+ assertThat (rows ).extracting (item -> item .getOldLine ())
479
+ .containsExactly ("~test~**A new text line**" ,
480
+ "" ,
481
+ "~testline~**another one**" );
482
+ }
460
483
}
You can’t perform that action at this time.
0 commit comments