Skip to content

Commit f0021c7

Browse files
committed
Add test case for compound cases.
1 parent 9c1b727 commit f0021c7

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Tests/PrettyPrinterTests/SwitchStmtTests.swift

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,40 @@ public class SwitchStmtTests: PrettyPrintTestCase {
7575
assertPrettyPrintEqual(input: input, expected: expected, linelength: 35)
7676
}
7777

78+
public func testSwitchCompoundCases() {
79+
let input =
80+
"""
81+
switch someChar {
82+
case "a":
83+
print("a")
84+
case "b", "c":
85+
print("bc")
86+
case "d", "e", "f", "g", "h":
87+
print("defgh")
88+
default:
89+
print("default")
90+
}
91+
"""
92+
93+
let expected =
94+
"""
95+
switch someChar {
96+
case "a":
97+
print("a")
98+
case "b", "c":
99+
print("bc")
100+
case "d", "e", "f",
101+
"g", "h":
102+
print("defgh")
103+
default:
104+
print("default")
105+
}
106+
107+
"""
108+
109+
assertPrettyPrintEqual(input: input, expected: expected, linelength: 20)
110+
}
111+
78112
public func testNestedSwitch() {
79113
let input =
80114
"""

0 commit comments

Comments
 (0)