GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — started decompression idea · autoplot/java-diff-utils@04b5c7e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • java-diff-utils/src/test/java/com/github/difflib
    • DiffUtilsTest.java
    • text
      • DiffRowGeneratorTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎java-diff-utils/src/test/java/com/github/difflib/DiffUtilsTest.java‎

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 numberDiff line numberDiff line change
@@ -227,4 +227,12 @@ public void testDiff_ProblemIssue42() {
227227
assertEquals(new Chunk<>(3, Arrays.asList("brown")), delta.getSource());
228228
assertEquals(new Chunk<>(3, Arrays.asList("down")), delta.getTarget());
229229
}
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+
}
230238
}
Collapse file

‎java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java‎

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 numberDiff line numberDiff line change
@@ -600,23 +600,41 @@ public void testLinefeedInStandardTagsWithLineWidthIssue81() {
600600

601601
System.out.println(deltas);
602602
}
603-
603+
604604
@Test
605-
public void testIssue86WrongInlineDiff() throws IOException {
605+
public void testIssue86WrongInlineDiff() throws IOException {
606606
String original = Files.lines(Paths.get("target/test-classes/com/github/difflib/text/issue_86_original.txt")).collect(joining("\n"));
607607
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();
616616
List<DiffRow> rows = generator.generateDiffRows(
617617
Arrays.asList(original.split("\n")),
618618
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+
620638
for (DiffRow diff : rows) {
621639
System.out.println(diff);
622640
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.