[lang-ref] ( switch_statement_fallthrough ) ( swift )
@Test func switchStatementFallthrough() {
let cases: [(v: Int, expected: String)] = [
(1, "A"),
(2, "A"),
(3, "B"),
]
for (v, expected) in cases {
var r = ""
switch v {
case 1:
fallthrough
case 2:
r = "A"
default:
r = "B"
}
#expect(r == expected)
}
}