Skip to content

Commit 5b0618e

Browse files
committed
spotlessApply
1 parent 875e4a7 commit 5b0618e

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

lib/src/main/java/com/diffplug/spotless/LineEnding.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public Policy createPolicy() {
5151
/** {@code \r\n} */
5252
WINDOWS,
5353
/** {@code \n} */
54-
UNIX,
54+
UNIX,
5555
/** {@code \r} */
5656
MAC_CLASSIC,
5757
/** preserve the line ending of the first line (no matter which format) */
Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*
2+
* Copyright 2024 DiffPlug
3+
*
24
* Licensed under the Apache License, Version 2.0 (the "License");
35
* you may not use this file except in compliance with the License.
46
* You may obtain a copy of the License at
@@ -22,27 +24,27 @@
2224

2325
class LineEndingTest {
2426

25-
@Test
26-
void testGetEndingFor() throws IOException {
27-
assertLineEnding("\r", "\r");
28-
assertLineEnding("\r", "Test\r");
29-
assertLineEnding("\r", "Test\rTest2\n");
30-
31-
assertLineEnding("\n", "Test");
32-
33-
assertLineEnding("\r\n", "\r\n");
34-
assertLineEnding("\r\n", "Test\r\n");
35-
assertLineEnding("\r\n", "Test\r\nTest2\n");
36-
37-
assertLineEnding("\n", "\n");
38-
assertLineEnding("\n", "Test\n");
39-
assertLineEnding("\n", "Test\nTest2\r");
40-
assertLineEnding("\n", "\n\t");
41-
}
42-
43-
static void assertLineEnding(String ending, String input) throws IOException {
44-
try (Reader reader = new StringReader(input)) {
45-
Assertions.assertEquals(ending, LineEnding.PreserveLineEndingPolicy.getEndingFor(reader));
46-
}
47-
}
27+
@Test
28+
void testGetEndingFor() throws IOException {
29+
assertLineEnding("\r", "\r");
30+
assertLineEnding("\r", "Test\r");
31+
assertLineEnding("\r", "Test\rTest2\n");
32+
33+
assertLineEnding("\n", "Test");
34+
35+
assertLineEnding("\r\n", "\r\n");
36+
assertLineEnding("\r\n", "Test\r\n");
37+
assertLineEnding("\r\n", "Test\r\nTest2\n");
38+
39+
assertLineEnding("\n", "\n");
40+
assertLineEnding("\n", "Test\n");
41+
assertLineEnding("\n", "Test\nTest2\r");
42+
assertLineEnding("\n", "\n\t");
43+
}
44+
45+
static void assertLineEnding(String ending, String input) throws IOException {
46+
try (Reader reader = new StringReader(input)) {
47+
Assertions.assertEquals(ending, LineEnding.PreserveLineEndingPolicy.getEndingFor(reader));
48+
}
49+
}
4850
}

0 commit comments

Comments
 (0)