File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -169,5 +169,33 @@ final class InlayHintsTests: XCTestCase {
169169 XCTAssertEqual ( hints, [ ] )
170170 }
171171
172- // TODO: Add test for closure parameters
172+ func testClosureParams( ) {
173+ let text = """
174+ func f(x: Int) {}
175+
176+ let g = { (x: Int) in }
177+ let h: (String) -> String = { x in x }
178+ let i: (Double, Double) -> Double = { (x, y) in
179+ x + y
180+ }
181+ """
182+ let hints = performInlayHintsRequest ( text: text)
183+ XCTAssertEqual ( hints, [
184+ InlayHint (
185+ position: Position ( line: 3 , utf16index: 31 ) ,
186+ category: . type,
187+ label: " String "
188+ ) ,
189+ InlayHint (
190+ position: Position ( line: 4 , utf16index: 40 ) ,
191+ category: . type,
192+ label: " Double "
193+ ) ,
194+ InlayHint (
195+ position: Position ( line: 4 , utf16index: 43 ) ,
196+ category: . type,
197+ label: " Double "
198+ )
199+ ] )
200+ }
173201}
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ extension InlayHintsTests {
9595 // to regenerate.
9696 static let __allTests__InlayHintsTests = [
9797 ( " testBindings " , testBindings) ,
98+ ( " testClosureParams " , testClosureParams) ,
9899 ( " testEmpty " , testEmpty) ,
99100 ( " testExplicitTypeAnnotation " , testExplicitTypeAnnotation) ,
100101 ( " testFields " , testFields) ,
You can’t perform that action at this time.
0 commit comments