mirror of
https://github.com/java-diff-utils/java-diff-utils.git
synced 2026-03-13 10:11:17 +08:00
This commit is contained in:
@@ -46,7 +46,7 @@ public final class UnifiedDiffReader {
|
||||
new UnifiedDiffLine(true, "^index\\s[\\da-zA-Z]+\\.\\.[\\da-zA-Z]+(\\s(\\d+))?$", this::processIndex),
|
||||
new UnifiedDiffLine(true, "^---\\s", this::processFromFile),
|
||||
new UnifiedDiffLine(true, "^\\+\\+\\+\\s", this::processToFile),
|
||||
new UnifiedDiffLine(false, UNIFIED_DIFF_CHUNK_REGEXP, this::processChunk),
|
||||
new UnifiedDiffLine(true, UNIFIED_DIFF_CHUNK_REGEXP, this::processChunk),
|
||||
new UnifiedDiffLine("^\\s+", this::processNormalLine),
|
||||
new UnifiedDiffLine("^-", this::processDelLine),
|
||||
new UnifiedDiffLine("^+", this::processAddLine)
|
||||
|
||||
@@ -111,4 +111,19 @@ public class UnifiedDiffReaderTest {
|
||||
assertTrue(m.find());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseIssue46() throws IOException {
|
||||
UnifiedDiff diff = UnifiedDiffReader.parseUnifiedDiff(
|
||||
UnifiedDiffReaderTest.class.getResourceAsStream("problem_diff_issue46.diff"));
|
||||
--- comment
|
||||
System.out.println(diff);
|
||||
|
||||
assertThat(diff.getFiles().size()).isEqualTo(1);
|
||||
|
||||
UnifiedDiffFile file1 = diff.getFiles().get(0);
|
||||
assertThat(file1.getFromFile()).isEqualTo("src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt");
|
||||
assertThat(file1.getPatch().getDeltas().size()).isEqualTo(3);
|
||||
|
||||
assertThat(diff.getTail()).isEqualTo("2.17.1.windows.2\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--- a.vhd 2019-04-18 13:49:39.516149751 +0200
|
||||
+++ b.vhd 2019-04-18 11:33:08.372563078 +0200
|
||||
@@ -2819,3 +2819,3 @@
|
||||
--- some comment
|
||||
-bla
|
||||
-bla
|
||||
+
|
||||
+
|
||||
Reference in New Issue
Block a user