Skip to content

Commit 22d8c55

Browse files
cushongoogle-java-format Team
authored andcommitted
Java 14 integration tests
PiperOrigin-RevId: 314566781
1 parent 2ddcfd3 commit 22d8c55

File tree

11 files changed

+100
-102
lines changed

11 files changed

+100
-102
lines changed

core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
@RunWith(Parameterized.class)
4848
public class FormatterIntegrationTest {
4949

50-
private static final ImmutableSet<String> JAVA14_TESTS = ImmutableSet.of("java14", "I477");
50+
private static final ImmutableSet<String> JAVA14_TESTS =
51+
ImmutableSet.of("I477", "Records", "RSLs", "Var", "ExpressionSwitch");
5152

5253
@Parameters(name = "{index}: {0}")
5354
public static Iterable<Object[]> data() throws IOException {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class ExpressionSwitch {
2+
boolean odd(int x) {
3+
return switch (x) {
4+
case 0 -> true;
5+
case 1 -> false;
6+
default -> odd(x - 1);
7+
};
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class ExpressionSwitch {
2+
boolean odd(int x) {
3+
return switch (x) {
4+
case 0 -> true;
5+
case 1 -> false;
6+
default -> odd(x - 1);
7+
};
8+
}
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class RSLs {
2+
String s = """
3+
lorem
4+
ipsum
5+
""";
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class RSLs {
2+
String s = """
3+
lorem
4+
ipsum
5+
""";
6+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class Records {
2+
record R1() {}
3+
4+
private record R2() {}
5+
6+
@Deprecated
7+
private record R3() {}
8+
9+
record R4<T>() {}
10+
11+
record R5<T>(int x) {}
12+
13+
record R6<T>(@Deprecated int x) {}
14+
15+
record R7<T>(@Deprecated int x, int... y) {}
16+
17+
record R8<T>() implements Comparable<R8<T>> {
18+
@Override
19+
public int compareTo(R8<T> other) {
20+
return 0;
21+
}
22+
}
23+
24+
record R9(int x) {
25+
R9(int x) {
26+
this.x = x;
27+
}
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class Records {
2+
record R1() {}
3+
4+
private record R2() {}
5+
6+
@Deprecated
7+
private record R3() {}
8+
9+
record R4<T>() {}
10+
11+
record R5<T>(int x) {}
12+
13+
record R6<T>(@Deprecated int x) {}
14+
15+
record R7<T>(@Deprecated int x, int... y) {}
16+
17+
record R8<T>() implements Comparable<R8<T>> {
18+
@Override
19+
public int compareTo(R8<T> other) {
20+
return 0;
21+
}
22+
}
23+
24+
record R9(int x) {
25+
R9(int x) {
26+
this.x = x;
27+
}
28+
}
29+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Var {
2+
void f() {
3+
for (var x : ImmutableList.of(42)) {}
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Var {
2+
void f() {
3+
for (var x : ImmutableList.of(42)) {}
4+
}
5+
}

core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.input

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)