Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4a83032

Browse files
committed
1 parent983ec68 commit4a83032

File tree

4 files changed

+98
-14
lines changed

4 files changed

+98
-14
lines changed

‎src/main/java/com/github/difflib/unifieddiff/UnifiedDiffParser.java‎renamed to ‎src/main/java/com/github/difflib/unifieddiff/UnifiedDiffReader.java‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
*
3636
* @author Tobias Warneke (t.warneke@gmx.net)
3737
*/
38-
publicfinalclassUnifiedDiffParser {
38+
publicfinalclassUnifiedDiffReader {
3939

4040
staticfinalPatternUNIFIED_DIFF_CHUNK_REGEXP =Pattern.compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@");
4141

42-
privatefinalUnifiedDiffReaderREADER;
42+
privatefinalInternalUnifiedDiffReaderREADER;
4343
privatefinalUnifiedDiffdata =newUnifiedDiff();
4444
privatefinalUnifiedDiffLine[]MAIN_PARSER_RULES =newUnifiedDiffLine[]{
4545
newUnifiedDiffLine(true,"^diff\\s",this::processDiff),
@@ -54,8 +54,8 @@ public final class UnifiedDiffParser {
5454

5555
privateUnifiedDiffFileactualFile;
5656

57-
UnifiedDiffParser(Readerreader) {
58-
this.READER =newUnifiedDiffReader(reader);
57+
UnifiedDiffReader(Readerreader) {
58+
this.READER =newInternalUnifiedDiffReader(reader);
5959
}
6060

6161
// schema = [[/^\s+/, normal], [/^diff\s/, start], [/^new file mode \d+$/, new_file],
@@ -103,10 +103,10 @@ static String[] parseFileNames(String line) {
103103
};
104104
}
105105

106-
privatestaticfinalLoggerLOG =Logger.getLogger(UnifiedDiffParser.class.getName());
106+
privatestaticfinalLoggerLOG =Logger.getLogger(UnifiedDiffReader.class.getName());
107107

108108
publicstaticUnifiedDiffparseUnifiedDiff(InputStreamstream)throwsIOException,UnifiedDiffParserException {
109-
UnifiedDiffParserparser =newUnifiedDiffParser(newBufferedReader(newInputStreamReader(stream)));
109+
UnifiedDiffReaderparser =newUnifiedDiffReader(newBufferedReader(newInputStreamReader(stream)));
110110
returnparser.parse();
111111
}
112112

@@ -244,11 +244,11 @@ public boolean isStopsHeaderParsing() {
244244
}
245245
}
246246

247-
classUnifiedDiffReaderextendsBufferedReader {
247+
classInternalUnifiedDiffReaderextendsBufferedReader {
248248

249249
privateStringlastLine;
250250

251-
publicUnifiedDiffReader(Readerreader) {
251+
publicInternalUnifiedDiffReader(Readerreader) {
252252
super(reader);
253253
}
254254

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2019 java-diff-utils.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
packagecom.github.difflib.unifieddiff;
17+
18+
importjava.io.Writer;
19+
20+
/**
21+
*
22+
* @author Tobias Warneke (t.warneke@gmx.net)
23+
*/
24+
publicclassUnifiedDiffWriter {
25+
26+
publicstaticvoidwrite(UnifiedDiffdiff,Writerwriter) {
27+
28+
}
29+
}

‎src/test/java/com/github/difflib/unifieddiff/UnifiedDiffParserTest.java‎renamed to ‎src/test/java/com/github/difflib/unifieddiff/UnifiedDiffReaderTest.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
*
3232
* @author Tobias Warneke (t.warneke@gmx.net)
3333
*/
34-
publicclassUnifiedDiffParserTest {
34+
publicclassUnifiedDiffReaderTest {
3535

36-
publicUnifiedDiffParserTest() {
36+
publicUnifiedDiffReaderTest() {
3737
}
3838

3939
@BeforeClass
@@ -54,7 +54,7 @@ public void tearDown() {
5454

5555
@Test
5656
publicvoidtestSimpleParse()throwsIOException {
57-
UnifiedDiffdiff =UnifiedDiffParser.parseUnifiedDiff(UnifiedDiffParserTest.class.getResourceAsStream("jsqlparser_patch_1.diff"));
57+
UnifiedDiffdiff =UnifiedDiffReader.parseUnifiedDiff(UnifiedDiffReaderTest.class.getResourceAsStream("jsqlparser_patch_1.diff"));
5858

5959
System.out.println(diff);
6060

@@ -69,13 +69,13 @@ public void testSimpleParse() throws IOException {
6969

7070
@Test
7171
publicvoidtestParseDiffBlock() {
72-
String[]files =UnifiedDiffParser.parseFileNames("diff --git a/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java b/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java");
72+
String[]files =UnifiedDiffReader.parseFileNames("diff --git a/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java b/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java");
7373
assertThat(files).containsExactly("src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java","src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java");
7474
}
7575

7676
@Test
7777
publicvoidtestChunkHeaderParsing() {
78-
Patternpattern =UnifiedDiffParser.UNIFIED_DIFF_CHUNK_REGEXP;
78+
Patternpattern =UnifiedDiffReader.UNIFIED_DIFF_CHUNK_REGEXP;
7979
Matchermatcher =pattern.matcher("@@ -189,6 +189,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */");
8080

8181
assertTrue(matcher.find());
@@ -86,7 +86,7 @@ public void testChunkHeaderParsing() {
8686
@Test
8787
publicvoidtestChunkHeaderParsing2() {
8888
//"^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@.*$"
89-
Patternpattern =UnifiedDiffParser.UNIFIED_DIFF_CHUNK_REGEXP;
89+
Patternpattern =UnifiedDiffReader.UNIFIED_DIFF_CHUNK_REGEXP;
9090
Matchermatcher =pattern.matcher("@@ -189,6 +189,7 @@");
9191

9292
assertTrue(matcher.find());
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2019 java-diff-utils.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
packagecom.github.difflib.unifieddiff;
17+
18+
importorg.junit.After;
19+
importorg.junit.AfterClass;
20+
importorg.junit.Before;
21+
importorg.junit.BeforeClass;
22+
importorg.junit.Test;
23+
24+
/**
25+
*
26+
* @author Tobias Warneke (t.warneke@gmx.net)
27+
*/
28+
publicclassUnifiedDiffWriterTest {
29+
30+
publicUnifiedDiffWriterTest() {
31+
}
32+
33+
@BeforeClass
34+
publicstaticvoidsetUpClass() {
35+
}
36+
37+
@AfterClass
38+
publicstaticvoidtearDownClass() {
39+
}
40+
41+
@Before
42+
publicvoidsetUp() {
43+
}
44+
45+
@After
46+
publicvoidtearDown() {
47+
}
48+
49+
@Test
50+
publicvoidtestSomeMethod() {
51+
// TODO review the generated test code and remove the default call to fail.
52+
fail("The test case is a prototype.");
53+
}
54+
55+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp