blob: 31aa6a52e77f36a379487570e2eef6a053d24b4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
describe("basic switch tests", () => {
test("string case does not match number target", () => {
switch (1 + 2) {
case "3":
expect().fail();
case 3:
return;
case 5:
case 1:
break;
default:
break;
}
expect().fail();
});
test("string concatenation in target", () => {
var a = "foo";
switch (a + "bar") {
case 1:
expect().fail();
case "foobar":
case 2:
return;
}
expect().fail();
});
test("default", () => {
switch (100) {
default:
return;
}
expect().fail();
});
});
|