@@ -42,7 +42,7 @@ final class InlayHintsTests: XCTestCase {
42
42
) )
43
43
}
44
44
45
- func performInlayHintsRequest( text: String , range: Range < Position > ? = nil ) -> [ InlayHint ] {
45
+ func performInlayHintsRequest( text: String , range: Range < Position > ? = nil ) throws -> [ InlayHint ] {
46
46
let url = URL ( fileURLWithPath: " / \( #function) /a.swift " )
47
47
48
48
sk. send ( DidOpenTextDocumentNotification ( textDocument: TextDocumentItem (
@@ -53,21 +53,26 @@ final class InlayHintsTests: XCTestCase {
53
53
) ) )
54
54
55
55
let request = InlayHintsRequest ( textDocument: TextDocumentIdentifier ( url) , range: range)
56
- return try ! sk. sendSync ( request)
56
+
57
+ do {
58
+ return try sk. sendSync ( request)
59
+ } catch let error as ResponseError where error. message. contains ( " unknown request: source.request.variable.type " ) {
60
+ throw XCTSkip ( " toolchain does not support variable.type request " )
61
+ }
57
62
}
58
63
59
- func testEmpty( ) {
64
+ func testEmpty( ) throws {
60
65
let text = " "
61
- let hints = performInlayHintsRequest ( text: text)
66
+ let hints = try performInlayHintsRequest ( text: text)
62
67
XCTAssertEqual ( hints, [ ] )
63
68
}
64
69
65
- func testBindings( ) {
70
+ func testBindings( ) throws {
66
71
let text = """
67
72
let x = 4
68
73
var y = " test " + " 123 "
69
74
"""
70
- let hints = performInlayHintsRequest ( text: text)
75
+ let hints = try performInlayHintsRequest ( text: text)
71
76
XCTAssertEqual ( hints, [
72
77
InlayHint (
73
78
position: Position ( line: 0 , utf16index: 5 ) ,
@@ -82,7 +87,7 @@ final class InlayHintsTests: XCTestCase {
82
87
] )
83
88
}
84
89
85
- func testRanged( ) {
90
+ func testRanged( ) throws {
86
91
let text = """
87
92
func square(_ x: Double) -> Double {
88
93
let result = x * x
@@ -96,7 +101,7 @@ final class InlayHintsTests: XCTestCase {
96
101
}
97
102
"""
98
103
let range = Position ( line: 6 , utf16index: 0 ) ..< Position ( line: 9 , utf16index: 0 )
99
- let hints = performInlayHintsRequest ( text: text, range: range)
104
+ let hints = try performInlayHintsRequest ( text: text, range: range)
100
105
XCTAssertEqual ( hints, [
101
106
InlayHint (
102
107
position: Position ( line: 6 , utf16index: 10 ) ,
@@ -111,7 +116,7 @@ final class InlayHintsTests: XCTestCase {
111
116
] )
112
117
}
113
118
114
- func testFields( ) {
119
+ func testFields( ) throws {
115
120
let text = """
116
121
class X {
117
122
let instanceMember = 3
@@ -127,7 +132,7 @@ final class InlayHintsTests: XCTestCase {
127
132
static let staticMember = 3.0
128
133
}
129
134
"""
130
- let hints = performInlayHintsRequest ( text: text)
135
+ let hints = try performInlayHintsRequest ( text: text)
131
136
XCTAssertEqual ( hints, [
132
137
InlayHint (
133
138
position: Position ( line: 1 , utf16index: 20 ) ,
@@ -157,19 +162,19 @@ final class InlayHintsTests: XCTestCase {
157
162
] )
158
163
}
159
164
160
- func testExplicitTypeAnnotation( ) {
165
+ func testExplicitTypeAnnotation( ) throws {
161
166
let text = """
162
167
let x: String = " abc "
163
168
164
169
struct X {
165
170
var y: Int = 34
166
171
}
167
172
"""
168
- let hints = performInlayHintsRequest ( text: text)
173
+ let hints = try performInlayHintsRequest ( text: text)
169
174
XCTAssertEqual ( hints, [ ] )
170
175
}
171
176
172
- func testClosureParams( ) {
177
+ func testClosureParams( ) throws {
173
178
let text = """
174
179
func f(x: Int) {}
175
180
@@ -179,7 +184,7 @@ final class InlayHintsTests: XCTestCase {
179
184
x + y
180
185
}
181
186
"""
182
- let hints = performInlayHintsRequest ( text: text)
187
+ let hints = try performInlayHintsRequest ( text: text)
183
188
XCTAssertEqual ( hints, [
184
189
InlayHint (
185
190
position: Position ( line: 2 , utf16index: 5 ) ,
0 commit comments