aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pretty/resource/after/Switch13.java55
-rw-r--r--test/pretty/resource/after/TextBlocks.java25
-rw-r--r--test/pretty/resource/before/Switch12.java2
-rw-r--r--test/pretty/resource/before/Switch13.java56
-rw-r--r--test/pretty/resource/before/TextBlocks.java24
-rw-r--r--test/transform/resource/after-delombok/WitherLegacyStar.java10
-rw-r--r--test/transform/resource/after-ecj/WitherLegacyStar.java11
-rw-r--r--test/transform/resource/before/WitherLegacyStar.java8
8 files changed, 190 insertions, 1 deletions
diff --git a/test/pretty/resource/after/Switch13.java b/test/pretty/resource/after/Switch13.java
new file mode 100644
index 00000000..363b48dc
--- /dev/null
+++ b/test/pretty/resource/after/Switch13.java
@@ -0,0 +1,55 @@
+public class Switch13 {
+ public void basic() {
+ switch (5) {
+ case 1:
+ case 2:
+ System.out.println("OK");
+ break;
+ default:
+ }
+ }
+
+ public void multiCase() {
+ switch (5) {
+ case 1, 2:
+ System.out.println("OK");
+ default:
+ }
+ }
+
+ public int switchExpr1() {
+ return switch (5) {
+ case 1, 2 -> 0;
+ case 3 -> {
+ yield 10;
+ }
+ default -> 10;
+ } + 10;
+ }
+
+ public int switchExpr2() {
+ return switch (5) {
+ case 1, 2:
+ System.out.println("Hello");
+ case 3:
+ yield 10;
+ default:
+ yield 20;
+ } + 10;
+ }
+
+ public void arrowSwitch() {
+ switch (5) {
+ case 1, 2 -> System.out.println("Hello");
+ case 3 -> {
+ System.out.println("");
+ break;
+ }
+ }
+ }
+
+ public void emptySwitch() {
+ switch (5) {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/pretty/resource/after/TextBlocks.java b/test/pretty/resource/after/TextBlocks.java
new file mode 100644
index 00000000..4d2fc272
--- /dev/null
+++ b/test/pretty/resource/after/TextBlocks.java
@@ -0,0 +1,25 @@
+public class TextBlocks {
+ private String example = """
+ This should not be indented.
+ line 2
+ line 3
+ """;
+
+ private String ex2 = """
+ This should be though.
+ """;
+
+ private String ex3 = "This is a simple\nstring";
+
+ private String ex4 = """
+ """;
+
+ private String bizarroDent = """
+ foo
+ bar""" + "hey" + """
+ weird!""";
+
+ private String stringFolding = "hmmm" + """
+ line1
+ line2""";
+}
diff --git a/test/pretty/resource/before/Switch12.java b/test/pretty/resource/before/Switch12.java
index f1bd8a79..d708f93c 100644
--- a/test/pretty/resource/before/Switch12.java
+++ b/test/pretty/resource/before/Switch12.java
@@ -1,4 +1,4 @@
-// version 12:
+// version 12:12
public class Switch12 {
public void basic() {
switch (5) {
diff --git a/test/pretty/resource/before/Switch13.java b/test/pretty/resource/before/Switch13.java
new file mode 100644
index 00000000..fe590788
--- /dev/null
+++ b/test/pretty/resource/before/Switch13.java
@@ -0,0 +1,56 @@
+// version 13:
+public class Switch13 {
+ public void basic() {
+ switch (5) {
+ case 1:
+ case 2:
+ System.out.println("OK");
+ break;
+ default:
+ }
+ }
+
+ public void multiCase() {
+ switch (5) {
+ case 1, 2:
+ System.out.println("OK");
+ default:
+ }
+ }
+
+ public int switchExpr1() {
+ return switch (5) {
+ case 1, 2 -> 0;
+ case 3 -> {
+ yield 10;
+ }
+ default -> 10;
+ } + 10;
+ }
+
+ public int switchExpr2() {
+ return switch (5) {
+ case 1, 2:
+ System.out.println("Hello");
+ case 3:
+ yield 10;
+ default:
+ yield 20;
+ } + 10;
+ }
+
+ public void arrowSwitch() {
+ switch (5) {
+ case 1, 2 -> System.out.println("Hello");
+ case 3 -> {
+ System.out.println("");
+ break;
+ }
+ }
+ }
+
+ public void emptySwitch() {
+ switch (5) {
+ }
+ }
+}
diff --git a/test/pretty/resource/before/TextBlocks.java b/test/pretty/resource/before/TextBlocks.java
new file mode 100644
index 00000000..247621c0
--- /dev/null
+++ b/test/pretty/resource/before/TextBlocks.java
@@ -0,0 +1,24 @@
+// version 13:
+public class TextBlocks {
+ private String example = """
+ This should not be indented.\nline 2
+ line 3
+ """;
+
+ private String ex2 = """
+ This should be though.
+ """;
+
+ private String ex3 = "This is a simple\nstring";
+
+ private String ex4 = """
+ """;
+
+ private String bizarroDent = """
+ foo\n bar""" + "hey" + """
+ weird!""";
+
+ private String stringFolding = "hmmm" + """
+ line1
+ line2""";
+}
diff --git a/test/transform/resource/after-delombok/WitherLegacyStar.java b/test/transform/resource/after-delombok/WitherLegacyStar.java
new file mode 100644
index 00000000..69da9278
--- /dev/null
+++ b/test/transform/resource/after-delombok/WitherLegacyStar.java
@@ -0,0 +1,10 @@
+class WitherLegacyStar {
+ int i;
+ WitherLegacyStar(int i) {
+ this.i = i;
+ }
+ @java.lang.SuppressWarnings("all")
+ public WitherLegacyStar withI(final int i) {
+ return this.i == i ? this : new WitherLegacyStar(i);
+ }
+}
diff --git a/test/transform/resource/after-ecj/WitherLegacyStar.java b/test/transform/resource/after-ecj/WitherLegacyStar.java
new file mode 100644
index 00000000..7aeaa969
--- /dev/null
+++ b/test/transform/resource/after-ecj/WitherLegacyStar.java
@@ -0,0 +1,11 @@
+import lombok.experimental.*;
+class WitherLegacyStar {
+ @Wither int i;
+ WitherLegacyStar(int i) {
+ super();
+ this.i = i;
+ }
+ public @java.lang.SuppressWarnings("all") WitherLegacyStar withI(final int i) {
+ return ((this.i == i) ? this : new WitherLegacyStar(i));
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/WitherLegacyStar.java b/test/transform/resource/before/WitherLegacyStar.java
new file mode 100644
index 00000000..e1a58ae1
--- /dev/null
+++ b/test/transform/resource/before/WitherLegacyStar.java
@@ -0,0 +1,8 @@
+import lombok.experimental.*;
+class WitherLegacyStar {
+ @Wither int i;
+
+ WitherLegacyStar(int i) {
+ this.i = i;
+ }
+}