@@ -61,6 +61,17 @@ final class InlayHintTests: XCTestCase {
61
61
}
62
62
}
63
63
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
+
64
75
func testEmpty( ) throws {
65
76
let text = " "
66
77
let hints = try performInlayHintRequest ( text: text)
@@ -74,12 +85,12 @@ final class InlayHintTests: XCTestCase {
74
85
"""
75
86
let hints = try performInlayHintRequest ( text: text)
76
87
XCTAssertEqual ( hints, [
77
- InlayHint (
88
+ makeInlayHint (
78
89
position: Position ( line: 0 , utf16index: 5 ) ,
79
90
kind: . type,
80
91
label: " : Int "
81
92
) ,
82
- InlayHint (
93
+ makeInlayHint (
83
94
position: Position ( line: 1 , utf16index: 5 ) ,
84
95
kind: . type,
85
96
label: " : String "
@@ -103,12 +114,12 @@ final class InlayHintTests: XCTestCase {
103
114
let range = Position ( line: 6 , utf16index: 0 ) ..< Position ( line: 9 , utf16index: 0 )
104
115
let hints = try performInlayHintRequest ( text: text, range: range)
105
116
XCTAssertEqual ( hints, [
106
- InlayHint (
117
+ makeInlayHint (
107
118
position: Position ( line: 6 , utf16index: 10 ) ,
108
119
kind: . type,
109
120
label: " : Bool "
110
121
) ,
111
- InlayHint (
122
+ makeInlayHint (
112
123
position: Position ( line: 7 , utf16index: 12 ) ,
113
124
kind: . type,
114
125
label: " : Int "
@@ -134,27 +145,27 @@ final class InlayHintTests: XCTestCase {
134
145
"""
135
146
let hints = try performInlayHintRequest ( text: text)
136
147
XCTAssertEqual ( hints, [
137
- InlayHint (
148
+ makeInlayHint (
138
149
position: Position ( line: 1 , utf16index: 20 ) ,
139
150
kind: . type,
140
151
label: " : Int "
141
152
) ,
142
- InlayHint (
153
+ makeInlayHint (
143
154
position: Position ( line: 2 , utf16index: 25 ) ,
144
155
kind: . type,
145
156
label: " : String "
146
157
) ,
147
- InlayHint (
158
+ makeInlayHint (
148
159
position: Position ( line: 6 , utf16index: 20 ) ,
149
160
kind: . type,
150
161
label: " : String "
151
162
) ,
152
- InlayHint (
163
+ makeInlayHint (
153
164
position: Position ( line: 7 , utf16index: 25 ) ,
154
165
kind: . type,
155
166
label: " : Int "
156
167
) ,
157
- InlayHint (
168
+ makeInlayHint (
158
169
position: Position ( line: 11 , utf16index: 25 ) ,
159
170
kind: . type,
160
171
label: " : Double "
@@ -186,22 +197,22 @@ final class InlayHintTests: XCTestCase {
186
197
"""
187
198
let hints = try performInlayHintRequest ( text: text)
188
199
XCTAssertEqual ( hints, [
189
- InlayHint (
200
+ makeInlayHint (
190
201
position: Position ( line: 2 , utf16index: 5 ) ,
191
202
kind: . type,
192
203
label: " : (Int) -> () "
193
204
) ,
194
- InlayHint (
205
+ makeInlayHint (
195
206
position: Position ( line: 3 , utf16index: 31 ) ,
196
207
kind: . type,
197
208
label: " : String "
198
209
) ,
199
- InlayHint (
210
+ makeInlayHint (
200
211
position: Position ( line: 4 , utf16index: 40 ) ,
201
212
kind: . type,
202
213
label: " : Double "
203
214
) ,
204
- InlayHint (
215
+ makeInlayHint (
205
216
position: Position ( line: 4 , utf16index: 43 ) ,
206
217
kind: . type,
207
218
label: " : Double "
0 commit comments