Skip to content

Commit 922a4e8

Browse files
committed
Java: Add failing test
1 parent 3949914 commit 922a4e8

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

java/ql/test/library-tests/guards12/PrintAst.expected

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,22 @@ Test.java:
1919
# 5| 1: [ConstCase] case ...
2020
# 5| -1: [IntegerLiteral] 2
2121
# 5| 0: [StringLiteral] "c"
22-
# 6| 2: [DefaultCase] default
23-
# 6| -1: [IntegerLiteral] 3
22+
# 6| 2: [ConstCase] case ...
23+
# 6| -1: [IntegerLiteral] 2
24+
# 6| 0: [StringLiteral] "d"
25+
# 7| 3: [DefaultCase] default
26+
# 7| -1: [IntegerLiteral] 3
27+
# 9| 1: [SwitchStmt] switch (...)
28+
# 9| -1: [VarAccess] s
29+
# 10| 0: [ConstCase] case ...
30+
# 10| -1: [BlockStmt] { ... }
31+
# 10| 0: [StringLiteral] "a"
32+
# 10| 1: [StringLiteral] "b"
33+
# 11| 1: [ConstCase] case ...
34+
# 11| -1: [BlockStmt] { ... }
35+
# 11| 0: [StringLiteral] "c"
36+
# 12| 2: [ConstCase] case ...
37+
# 12| -1: [BlockStmt] { ... }
38+
# 12| 0: [StringLiteral] "d"
39+
# 13| 3: [DefaultCase] default
40+
# 13| -1: [BlockStmt] { ... }

java/ql/test/library-tests/guards12/Test.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ void foo(String s) {
33
int x = switch(s) {
44
case "a", "b" -> 1;
55
case "c" -> 2;
6+
case "d" -> 2;
67
default -> 3;
78
};
9+
switch (s) {
10+
case "a", "b" -> { }
11+
case "c" -> { }
12+
case "d" -> { }
13+
default -> { }
14+
}
815
}
916
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
| 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 ... |
2+
| 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 ... |

0 commit comments

Comments
 (0)