@@ -66,6 +66,52 @@ final class UseLetInEveryBoundCaseVariableTests: LintOrFormatRuleTestCase {
66
66
)
67
67
}
68
68
69
+ func testSwitchMultipleCases( ) {
70
+ assertFormatting (
71
+ UseLetInEveryBoundCaseVariable . self,
72
+ input: """
73
+ switch (start.representation, end.representation) {
74
+ case 1️⃣let (.element(element), .separator(next: separator)):
75
+ return 2 * base.distance(from: element, to: separator) - 1
76
+ case 2️⃣let (.separator(next: separator), .element(element)):
77
+ return 2 * base.distance(from: separator, to: element) + 1
78
+ case 3️⃣let (.element(start), .element(end)),
79
+ 4️⃣let (.separator(start), .separator(end)):
80
+ return 2 * base.distance(from: start, to: end)
81
+ }
82
+ """ ,
83
+ expected: """
84
+ switch (start.representation, end.representation) {
85
+ case (.element(let element), .separator(next: let separator)):
86
+ return 2 * base.distance(from: element, to: separator) - 1
87
+ case (.separator(next: let separator), .element(let element)):
88
+ return 2 * base.distance(from: separator, to: element) + 1
89
+ case (.element(let start), .element(let end)),
90
+ (.separator(let start), .separator(let end)):
91
+ return 2 * base.distance(from: start, to: end)
92
+ }
93
+ """ ,
94
+ findings: [
95
+ FindingSpec (
96
+ " 1️⃣ " ,
97
+ message: " move this 'let' keyword inside the 'case' pattern, before each of the bound variables "
98
+ ) ,
99
+ FindingSpec (
100
+ " 2️⃣ " ,
101
+ message: " move this 'let' keyword inside the 'case' pattern, before each of the bound variables "
102
+ ) ,
103
+ FindingSpec (
104
+ " 3️⃣ " ,
105
+ message: " move this 'let' keyword inside the 'case' pattern, before each of the bound variables "
106
+ ) ,
107
+ FindingSpec (
108
+ " 4️⃣ " ,
109
+ message: " move this 'let' keyword inside the 'case' pattern, before each of the bound variables "
110
+ ) ,
111
+ ]
112
+ )
113
+ }
114
+
69
115
func testIfCase( ) {
70
116
assertFormatting (
71
117
UseLetInEveryBoundCaseVariable . self,
0 commit comments