Java: Add failing test

This commit is contained in:
Anders Schack-Mulligen
2023-09-28 14:15:56 +02:00
parent 39499142a6
commit 922a4e8ddf
3 changed files with 27 additions and 2 deletions

View File

@@ -19,5 +19,22 @@ Test.java:
# 5| 1: [ConstCase] case ...
# 5| -1: [IntegerLiteral] 2
# 5| 0: [StringLiteral] "c"
# 6| 2: [DefaultCase] default
# 6| -1: [IntegerLiteral] 3
# 6| 2: [ConstCase] case ...
# 6| -1: [IntegerLiteral] 2
# 6| 0: [StringLiteral] "d"
# 7| 3: [DefaultCase] default
# 7| -1: [IntegerLiteral] 3
# 9| 1: [SwitchStmt] switch (...)
# 9| -1: [VarAccess] s
# 10| 0: [ConstCase] case ...
# 10| -1: [BlockStmt] { ... }
# 10| 0: [StringLiteral] "a"
# 10| 1: [StringLiteral] "b"
# 11| 1: [ConstCase] case ...
# 11| -1: [BlockStmt] { ... }
# 11| 0: [StringLiteral] "c"
# 12| 2: [ConstCase] case ...
# 12| -1: [BlockStmt] { ... }
# 12| 0: [StringLiteral] "d"
# 13| 3: [DefaultCase] default
# 13| -1: [BlockStmt] { ... }

View File

@@ -3,7 +3,14 @@ class Test {
int x = switch(s) {
case "a", "b" -> 1;
case "c" -> 2;
case "d" -> 2;
default -> 3;
};
switch (s) {
case "a", "b" -> { }
case "c" -> { }
case "d" -> { }
default -> { }
}
}
}

View File

@@ -1 +1,2 @@
| Test.java:5:7:5:17 | case ... | Test.java:3:20:3:20 | s | Test.java:5:12:5:14 | "c" | true | true | Test.java:5:7:5:17 | case ... |
| Test.java:6:7:6:17 | case ... | Test.java:3:20:3:20 | s | Test.java:6:12:6:14 | "d" | true | true | Test.java:6:7:6:17 | case ... |