File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
java-diff-utils/src/test/java/com/github/difflib/text Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 99import java .util .List ;
1010import java .util .regex .Pattern ;
1111import static java .util .stream .Collectors .toList ;
12+ import static org .assertj .core .api .Assertions .assertThat ;
1213import static org .junit .jupiter .api .Assertions .assertEquals ;
1314import static org .junit .jupiter .api .Assertions .assertTrue ;
1415import org .junit .jupiter .api .Test ;
@@ -457,4 +458,26 @@ public void testIgnoreWhitespaceIssue66_2() throws DiffException {
457458
458459 assertEquals ("This is a test~.~" , rows .get (0 ).getOldLine ());
459460 }
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+ }
460483}
You can’t perform that action at this time.
0 commit comments