Quick fix for enum entry delimiter syntax fix, together with a set of tests.
Possible NPE in getNextSiblingIgnoringWhitespace fixed. Some warnings also removed. Last comma is replaced by semicolon. Comments are taken into account.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST,
|
||||
SECOND<caret>,
|
||||
val zzz = 42
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST,
|
||||
SECOND;
|
||||
val zzz = 42
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST SECOND,
|
||||
THIRD
|
||||
FOURTH<caret> FIFTH SIXTH,
|
||||
SEVENTH EIGHTH
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST, SECOND,
|
||||
THIRD,
|
||||
FOURTH, FIFTH, SIXTH,
|
||||
SEVENTH, EIGHTH
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST<caret> SECOND
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST, SECOND
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST<caret>
|
||||
/* The first one */
|
||||
SECOND
|
||||
/* The last one */
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST<caret>,
|
||||
/* The first one */
|
||||
SECOND
|
||||
/* The last one */
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
A B C D<caret> E F G H I J
|
||||
fun foo() = 42
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
A, B, C, D, E, F, G, H, I, J;
|
||||
fun foo() = 42
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum(val z: Int) {
|
||||
A: MyEnum(3)
|
||||
B<caret>: MyEnum(7)
|
||||
C: MyEnum(12)
|
||||
fun foo() = z * 2
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum(val z: Int) {
|
||||
A: MyEnum(3),
|
||||
B: MyEnum(7),
|
||||
C: MyEnum(12);
|
||||
fun foo() = z * 2
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
A {
|
||||
override fun foo(): Int = 13
|
||||
}
|
||||
B C<caret> {
|
||||
override fun foo(): Int = 23
|
||||
}
|
||||
open fun foo(): Int = 42
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
A {
|
||||
override fun foo(): Int = 13
|
||||
},
|
||||
B, C<caret> {
|
||||
override fun foo(): Int = 23
|
||||
};
|
||||
open fun foo(): Int = 42
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum(val z: Int) {
|
||||
A(3) B<caret>(7) C(12)
|
||||
fun foo() = z * 2
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum(val z: Int) {
|
||||
A(3), B(7), C(12);
|
||||
fun foo() = z * 2
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST, SECOND<caret>
|
||||
val zzz = 42
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST, SECOND;
|
||||
val zzz = 42
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST, SECOND<caret>
|
||||
/* The last one*/
|
||||
fun foo() = 1
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Insert lacking comma(s) / semicolon(s)" "true"
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST, SECOND<caret>;
|
||||
/* The last one*/
|
||||
fun foo() = 1
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Insert lacking comma(s) / semicolon(s) in the whole project" "true"
|
||||
|
||||
enum class First {
|
||||
RED GREEN,
|
||||
BLUE
|
||||
}
|
||||
|
||||
enum class Second(val code: Int) {
|
||||
NORTH(2) SOUTH(4),
|
||||
EAST(6) WEST(8)
|
||||
}
|
||||
|
||||
enum class Third {
|
||||
OK {
|
||||
override fun diag(): String = "OK"
|
||||
}
|
||||
ERROR<caret> {
|
||||
override fun diag(): String = "Failed"
|
||||
}
|
||||
|
||||
open fun diag(): String = ""
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Insert lacking comma(s) / semicolon(s) in the whole project" "true"
|
||||
|
||||
enum class First {
|
||||
RED, GREEN,
|
||||
BLUE
|
||||
}
|
||||
|
||||
enum class Second(val code: Int) {
|
||||
NORTH(2), SOUTH(4),
|
||||
EAST(6), WEST(8)
|
||||
}
|
||||
|
||||
enum class Third {
|
||||
OK {
|
||||
override fun diag(): String = "OK"
|
||||
},
|
||||
ERROR {
|
||||
override fun diag(): String = "Failed"
|
||||
};
|
||||
|
||||
open fun diag(): String = ""
|
||||
}
|
||||
Reference in New Issue
Block a user