emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dbe7803aa1: Add more java indentation tests


From: Theodor Thornhill
Subject: master dbe7803aa1: Add more java indentation tests
Date: Sat, 11 Feb 2023 01:17:29 -0500 (EST)

branch: master
commit dbe7803aa1e8249bd70f67f25f19aedabeb9cc22
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>

    Add more java indentation tests
    
    * test/lisp/progmodes/java-ts-mode-resources/indent.erts: Use default
    indent offset, and tweak the indentation examples.
---
 .../progmodes/java-ts-mode-resources/indent.erts   | 91 ++++++++++++++++++----
 1 file changed, 75 insertions(+), 16 deletions(-)

diff --git a/test/lisp/progmodes/java-ts-mode-resources/indent.erts 
b/test/lisp/progmodes/java-ts-mode-resources/indent.erts
index c8e0ac7170..4fca74dd2e 100644
--- a/test/lisp/progmodes/java-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/java-ts-mode-resources/indent.erts
@@ -1,7 +1,7 @@
 Code:
   (lambda ()
     (setq indent-tabs-mode nil)
-    (setq java-ts-mode-indent-offset 2)
+    (setq java-ts-mode-indent-offset 4)
     (java-ts-mode)
     (indent-region (point-min) (point-max)))
 
@@ -11,9 +11,9 @@ Name: Basic
 
 =-=
 public class Basic {
-  public void basic() {
-    return;
-  }
+    public void basic() {
+        return;
+    }
 }
 =-=-=
 
@@ -21,9 +21,9 @@ Name: Empty Line
 
 =-=
 public class EmptyLine {
-  public void emptyLine() {
-    |
-  }
+    public void emptyLine() {
+        |
+    }
 }
 =-=-=
 
@@ -31,15 +31,15 @@ Name: Statements
 
 =-=
 if (x) {
-  for (var foo : foos) {
-    |
-  }
+    for (var foo : foos) {
+        |
+    }
 } else if (y) {
-  for (int i = 0; x < foos.size(); i++) {
-    return;
-  }
+    for (int i = 0; x < foos.size(); i++) {
+        return;
+    }
 } else {
-  return;
+    return;
 }
 =-=-=
 
@@ -47,7 +47,66 @@ Name: Field declaration without access modifier (bug#61115)
 
 =-=
 public class T {
-  @Autowired
-  String a;
+    @Autowired
+    String a;
+}
+=-=-=
+
+Name: Array initializer
+
+=-=
+public class Java {
+    void foo() {
+        return new String[]{
+            "foo", // These
+            "bar"
+        }
+    }
+}
+=-=-=
+
+Name: Advanced bracket matching indentation (bug#61142)
+
+=-=
+public class Java {
+
+    public Java(
+        String foo) {
+        this.foo = foo;
+    }
+
+    void foo(
+        String foo) {
+
+        for (var f : rs)
+            return new String[]{
+                "foo",
+                "bar"
+            };
+        if (a == 0
+            && b == 1
+            && foo) {
+            return 0;
+        } else if (a == 1) {
+            return 1;
+        } else if (true)
+            return 5;
+        else {
+            if (a == 0
+                && b == 1
+                && foo)
+                while (true)
+                    for (
+                        ;;)
+                        if (true)
+                            return 5;
+                        else if (false) {
+                            return 6;
+                        } else
+                            if (true
+                                && false)
+                                return 6;
+        }
+    }
 }
 =-=-=



reply via email to

[Prev in Thread] Current Thread [Next in Thread]