[tests] more cases for enhanced switch statements highlighting tests

This commit is contained in:
Roman Shevchenko
2018-11-13 13:27:30 +01:00
parent c71c39f107
commit 193aa1f2cf
@@ -57,10 +57,15 @@ class EnhancedSwitchStatements {
case "" == "" + "" ? 3 : 0 -> noop();
}
switch (E.valueOf("E1")) {
case E1 -> noop();
}
switch (E.valueOf("E1")) {
case <error descr="Constant expression required">null</error> -> noop();
case <error descr="An enum switch case label must be the unqualified name of an enumeration constant">E.E1</error> -> noop();
case E2 -> noop();
case <error descr="Incompatible types. Found: 'int', required: 'EnhancedSwitchStatements.E'">1</error> -> noop();
}
switch (new Random().nextInt()) {
@@ -73,6 +78,8 @@ class EnhancedSwitchStatements {
case 3, <error descr="Duplicate label '2'">2</error>:
noop(); break;
}
switch (<error descr="Incompatible types. Found: 'java.lang.Object', required: 'char, byte, short, int, Character, Byte, Short, Integer, String, or an enum'">new Object()</error>) { }
}
private static void noop() { }