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

Commite73742c

Browse files
committed
1 parent0545519 commite73742c

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

‎.github/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
changelog:
2+
categories:
3+
-title:Bugs solved
4+
labels:
5+
-"bug"
6+
-title:Changes and new Features
7+
labels:
8+
-"*"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2022 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+
importcom.github.difflib.patch.PatchFailedException;
19+
importjava.io.ByteArrayInputStream;
20+
importjava.io.IOException;
21+
importjava.util.Arrays;
22+
importstaticjava.util.stream.Collectors.joining;
23+
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
24+
importorg.junit.jupiter.api.Disabled;
25+
importorg.junit.jupiter.api.Test;
26+
27+
@Disabled("for next release")
28+
publicclassUnifiedDiffRoundTripNewLineTest {
29+
@Test
30+
publicvoidtestIssue135MissingNoNewLineInPatched()throwsIOException,PatchFailedException {
31+
StringbeforeContent ="rootProject.name =\"sample-repo\"";
32+
StringafterContent ="rootProject.name =\"sample-repo\"\n";
33+
Stringpatch ="diff --git a/settings.gradle b/settings.gradle\n" +
34+
"index ef3b8e2..ab30124 100644\n" +
35+
"--- a/settings.gradle\n" +
36+
"+++ b/settings.gradle\n" +
37+
"@@ -1 +1 @@\n" +
38+
"-rootProject.name =\"sample-repo\"\n" +
39+
"\\ No newline at end of file\n" +
40+
"+rootProject.name =\"sample-repo\"\n";
41+
UnifiedDiffunifiedDiff =UnifiedDiffReader.parseUnifiedDiff(newByteArrayInputStream(patch.getBytes()));
42+
StringunifiedAfterContent =unifiedDiff.getFiles().get(0).getPatch()
43+
.applyTo(Arrays.asList(beforeContent.split("\n"))).stream().collect(joining("\n"));
44+
assertEquals(afterContent,unifiedAfterContent);
45+
}
46+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp