diff options
| author | Theodor Thornhill | 2023-02-06 09:36:08 +0100 |
|---|---|---|
| committer | Theodor Thornhill | 2023-02-10 20:22:31 +0100 |
| commit | dbe7803aa1e8249bd70f67f25f19aedabeb9cc22 (patch) | |
| tree | 337bddde3b095394461d91860958a55438e7642b | |
| parent | 67dea8143f1876598a6ab477c17f34b5b269dc50 (diff) | |
| download | emacs-dbe7803aa1e8249bd70f67f25f19aedabeb9cc22.tar.gz emacs-dbe7803aa1e8249bd70f67f25f19aedabeb9cc22.zip | |
Add more java indentation tests
* test/lisp/progmodes/java-ts-mode-resources/indent.erts: Use default
indent offset, and tweak the indentation examples.
| -rw-r--r-- | test/lisp/progmodes/java-ts-mode-resources/indent.erts | 91 |
1 files 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 c8e0ac71708..4fca74dd2e1 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 @@ | |||
| 1 | Code: | 1 | Code: |
| 2 | (lambda () | 2 | (lambda () |
| 3 | (setq indent-tabs-mode nil) | 3 | (setq indent-tabs-mode nil) |
| 4 | (setq java-ts-mode-indent-offset 2) | 4 | (setq java-ts-mode-indent-offset 4) |
| 5 | (java-ts-mode) | 5 | (java-ts-mode) |
| 6 | (indent-region (point-min) (point-max))) | 6 | (indent-region (point-min) (point-max))) |
| 7 | 7 | ||
| @@ -11,9 +11,9 @@ Name: Basic | |||
| 11 | 11 | ||
| 12 | =-= | 12 | =-= |
| 13 | public class Basic { | 13 | public class Basic { |
| 14 | public void basic() { | 14 | public void basic() { |
| 15 | return; | 15 | return; |
| 16 | } | 16 | } |
| 17 | } | 17 | } |
| 18 | =-=-= | 18 | =-=-= |
| 19 | 19 | ||
| @@ -21,9 +21,9 @@ Name: Empty Line | |||
| 21 | 21 | ||
| 22 | =-= | 22 | =-= |
| 23 | public class EmptyLine { | 23 | public class EmptyLine { |
| 24 | public void emptyLine() { | 24 | public void emptyLine() { |
| 25 | | | 25 | | |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | =-=-= | 28 | =-=-= |
| 29 | 29 | ||
| @@ -31,15 +31,15 @@ Name: Statements | |||
| 31 | 31 | ||
| 32 | =-= | 32 | =-= |
| 33 | if (x) { | 33 | if (x) { |
| 34 | for (var foo : foos) { | 34 | for (var foo : foos) { |
| 35 | | | 35 | | |
| 36 | } | 36 | } |
| 37 | } else if (y) { | 37 | } else if (y) { |
| 38 | for (int i = 0; x < foos.size(); i++) { | 38 | for (int i = 0; x < foos.size(); i++) { |
| 39 | return; | 39 | return; |
| 40 | } | 40 | } |
| 41 | } else { | 41 | } else { |
| 42 | return; | 42 | return; |
| 43 | } | 43 | } |
| 44 | =-=-= | 44 | =-=-= |
| 45 | 45 | ||
| @@ -47,7 +47,66 @@ Name: Field declaration without access modifier (bug#61115) | |||
| 47 | 47 | ||
| 48 | =-= | 48 | =-= |
| 49 | public class T { | 49 | public class T { |
| 50 | @Autowired | 50 | @Autowired |
| 51 | String a; | 51 | String a; |
| 52 | } | ||
| 53 | =-=-= | ||
| 54 | |||
| 55 | Name: Array initializer | ||
| 56 | |||
| 57 | =-= | ||
| 58 | public class Java { | ||
| 59 | void foo() { | ||
| 60 | return new String[]{ | ||
| 61 | "foo", // These | ||
| 62 | "bar" | ||
| 63 | } | ||
| 64 | } | ||
| 65 | } | ||
| 66 | =-=-= | ||
| 67 | |||
| 68 | Name: Advanced bracket matching indentation (bug#61142) | ||
| 69 | |||
| 70 | =-= | ||
| 71 | public class Java { | ||
| 72 | |||
| 73 | public Java( | ||
| 74 | String foo) { | ||
| 75 | this.foo = foo; | ||
| 76 | } | ||
| 77 | |||
| 78 | void foo( | ||
| 79 | String foo) { | ||
| 80 | |||
| 81 | for (var f : rs) | ||
| 82 | return new String[]{ | ||
| 83 | "foo", | ||
| 84 | "bar" | ||
| 85 | }; | ||
| 86 | if (a == 0 | ||
| 87 | && b == 1 | ||
| 88 | && foo) { | ||
| 89 | return 0; | ||
| 90 | } else if (a == 1) { | ||
| 91 | return 1; | ||
| 92 | } else if (true) | ||
| 93 | return 5; | ||
| 94 | else { | ||
| 95 | if (a == 0 | ||
| 96 | && b == 1 | ||
| 97 | && foo) | ||
| 98 | while (true) | ||
| 99 | for ( | ||
| 100 | ;;) | ||
| 101 | if (true) | ||
| 102 | return 5; | ||
| 103 | else if (false) { | ||
| 104 | return 6; | ||
| 105 | } else | ||
| 106 | if (true | ||
| 107 | && false) | ||
| 108 | return 6; | ||
| 109 | } | ||
| 110 | } | ||
| 52 | } | 111 | } |
| 53 | =-=-= | 112 | =-=-= |