GeezerVison is showing github.com — started decompression idea · autoplot/java-diff-utils@04b5c7e
File treeExpand file treeCollapse file tree Open diff view settings java-diff-utils/src/test/java/com/github/difflib
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: java-diff-utils/src/test/java/com/github/difflib/DiffUtilsTest.java +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -227,4 +227,12 @@ public void testDiff_ProblemIssue42() { | 227 | 227 | assertEquals(new Chunk<>(3, Arrays.asList("brown")), delta.getSource()); | 228 | 228 | assertEquals(new Chunk<>(3, Arrays.asList("down")), delta.getTarget()); | 229 | 229 | } | | 230 | + | | 231 | + @Test | | 232 | + public void testDiffIssue114() { | | 233 | + final Patch<String> patch = DiffUtils.diff(Arrays.asList("A", "B", "C", "D", "E"), Arrays.asList("a", "C", "", "E"), true); | | 234 | + assertNotNull(patch); | | 235 | + assertEquals(4, patch.getDeltas().size()); | | 236 | + assertEquals("Patch{deltas=[[DeleteDelta, position: 0, lines: [A, B]], [InsertDelta, position: 3, lines: [B]], [DeleteDelta, position: 5, lines: [B]], [InsertDelta, position: 7, lines: [C]]]}", patch.toString()); | | 237 | + } | 230 | 238 | } |
Collapse file Copy file name to clipboardExpand all lines: java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java +29-11Lines changed: 29 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -600,23 +600,41 @@ public void testLinefeedInStandardTagsWithLineWidthIssue81() { | 600 | 600 |
| 601 | 601 | System.out.println(deltas); | 602 | 602 | } | 603 | | - | | 603 | + | 604 | 604 | @Test | 605 | | - public void testIssue86WrongInlineDiff() throws IOException { | | 605 | + public void testIssue86WrongInlineDiff() throws IOException { | 606 | 606 | String original = Files.lines(Paths.get("target/test-classes/com/github/difflib/text/issue_86_original.txt")).collect(joining("\n")); | 607 | 607 | String revised = Files.lines(Paths.get("target/test-classes/com/github/difflib/text/issue_86_revised.txt")).collect(joining("\n")); | 608 | | - | 609 | | - DiffRowGenerator generator = DiffRowGenerator.create() | 610 | | - .showInlineDiffs(true) | 611 | | - .mergeOriginalRevised(false) | 612 | | - .inlineDiffByWord(true) | 613 | | - .oldTag( f -> "~" ) | 614 | | - .newTag( f -> "**" ) | 615 | | - .build(); | | 608 | + | | 609 | + DiffRowGenerator generator = DiffRowGenerator.create() | | 610 | + .showInlineDiffs(true) | | 611 | + .mergeOriginalRevised(false) | | 612 | + .inlineDiffByWord(true) | | 613 | + .oldTag(f -> "~") | | 614 | + .newTag(f -> "**") | | 615 | + .build(); | 616 | 616 | List<DiffRow> rows = generator.generateDiffRows( | 617 | 617 | Arrays.asList(original.split("\n")), | 618 | 618 | Arrays.asList(revised.split("\n"))); | 619 | | - | | 619 | + | | 620 | + for (DiffRow diff : rows) { | | 621 | + System.out.println(diff); | | 622 | + } | | 623 | + } | | 624 | + | | 625 | + @Test | | 626 | + public void testCorrectChangeIssue114() throws IOException { | | 627 | + List<String> original = Arrays.asList("A", "B", "C", "D", "E"); | | 628 | + List<String> revised = Arrays.asList("a", "C", "", "E"); | | 629 | + | | 630 | + DiffRowGenerator generator = DiffRowGenerator.create() | | 631 | + .showInlineDiffs(true) | | 632 | + .inlineDiffByWord(true) | | 633 | + .oldTag(f -> "~") | | 634 | + .newTag(f -> "**") | | 635 | + .build(); | | 636 | + List<DiffRow> rows = generator.generateDiffRows(original, revised); | | 637 | + | 620 | 638 | for (DiffRow diff : rows) { | 621 | 639 | System.out.println(diff); | 622 | 640 | } | |
|