@@ -61,6 +61,17 @@ final class InlayHintTests: XCTestCase {
6161 }
6262 }
6363
64+ private func makeInlayHint( position: Position , kind: InlayHintKind , label: String ) -> InlayHint {
65+ InlayHint (
66+ position: position,
67+ kind: kind,
68+ label: . string( label) ,
69+ textEdits: [
70+ TextEdit ( range: position..< position, newText: label)
71+ ]
72+ )
73+ }
74+
6475 func testEmpty( ) throws {
6576 let text = " "
6677 let hints = try performInlayHintRequest ( text: text)
@@ -74,12 +85,12 @@ final class InlayHintTests: XCTestCase {
7485 """
7586 let hints = try performInlayHintRequest ( text: text)
7687 XCTAssertEqual ( hints, [
77- InlayHint (
88+ makeInlayHint (
7889 position: Position ( line: 0 , utf16index: 5 ) ,
7990 kind: . type,
8091 label: " : Int "
8192 ) ,
82- InlayHint (
93+ makeInlayHint (
8394 position: Position ( line: 1 , utf16index: 5 ) ,
8495 kind: . type,
8596 label: " : String "
@@ -103,12 +114,12 @@ final class InlayHintTests: XCTestCase {
103114 let range = Position ( line: 6 , utf16index: 0 ) ..< Position ( line: 9 , utf16index: 0 )
104115 let hints = try performInlayHintRequest ( text: text, range: range)
105116 XCTAssertEqual ( hints, [
106- InlayHint (
117+ makeInlayHint (
107118 position: Position ( line: 6 , utf16index: 10 ) ,
108119 kind: . type,
109120 label: " : Bool "
110121 ) ,
111- InlayHint (
122+ makeInlayHint (
112123 position: Position ( line: 7 , utf16index: 12 ) ,
113124 kind: . type,
114125 label: " : Int "
@@ -134,27 +145,27 @@ final class InlayHintTests: XCTestCase {
134145 """
135146 let hints = try performInlayHintRequest ( text: text)
136147 XCTAssertEqual ( hints, [
137- InlayHint (
148+ makeInlayHint (
138149 position: Position ( line: 1 , utf16index: 20 ) ,
139150 kind: . type,
140151 label: " : Int "
141152 ) ,
142- InlayHint (
153+ makeInlayHint (
143154 position: Position ( line: 2 , utf16index: 25 ) ,
144155 kind: . type,
145156 label: " : String "
146157 ) ,
147- InlayHint (
158+ makeInlayHint (
148159 position: Position ( line: 6 , utf16index: 20 ) ,
149160 kind: . type,
150161 label: " : String "
151162 ) ,
152- InlayHint (
163+ makeInlayHint (
153164 position: Position ( line: 7 , utf16index: 25 ) ,
154165 kind: . type,
155166 label: " : Int "
156167 ) ,
157- InlayHint (
168+ makeInlayHint (
158169 position: Position ( line: 11 , utf16index: 25 ) ,
159170 kind: . type,
160171 label: " : Double "
@@ -186,22 +197,22 @@ final class InlayHintTests: XCTestCase {
186197 """
187198 let hints = try performInlayHintRequest ( text: text)
188199 XCTAssertEqual ( hints, [
189- InlayHint (
200+ makeInlayHint (
190201 position: Position ( line: 2 , utf16index: 5 ) ,
191202 kind: . type,
192203 label: " : (Int) -> () "
193204 ) ,
194- InlayHint (
205+ makeInlayHint (
195206 position: Position ( line: 3 , utf16index: 31 ) ,
196207 kind: . type,
197208 label: " : String "
198209 ) ,
199- InlayHint (
210+ makeInlayHint (
200211 position: Position ( line: 4 , utf16index: 40 ) ,
201212 kind: . type,
202213 label: " : Double "
203214 ) ,
204- InlayHint (
215+ makeInlayHint (
205216 position: Position ( line: 4 , utf16index: 43 ) ,
206217 kind: . type,
207218 label: " : Double "
0 commit comments