Skip to content

Commit f0689e9

Browse files
committed
Fix tests
1 parent f81b88f commit f0689e9

1 file changed

Lines changed: 29 additions & 21 deletions

File tree

Tool/Tests/GitHubCopilotServiceTests/FetchSuggestionsTests.swift

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,32 @@ import XCTest
66
final class FetchSuggestionTests: XCTestCase {
77
func test_process_suggestions_from_server() async throws {
88
struct TestServer: GitHubCopilotLSP {
9-
func sendNotification(_ notif: LanguageServerProtocol.ClientNotification) async throws {
9+
func sendNotification(_: LanguageServerProtocol.ClientNotification) async throws {
1010
fatalError()
1111
}
12-
12+
1313
func sendRequest<E>(_: E) async throws -> E.Response where E: GitHubCopilotRequestType {
1414
return GitHubCopilotRequest.GetCompletionsCycling.Response(completions: [
1515
.init(
16-
id: "uuid",
1716
text: "Hello World\n",
1817
position: .init((0, 0)),
19-
range: .init(start: .init((0, 0)), end: .init((0, 4)))
18+
uuid: "uuid",
19+
range: .init(start: .init((0, 0)), end: .init((0, 4))),
20+
displayText: ""
2021
),
2122
.init(
22-
id: "uuid",
2323
text: " ",
2424
position: .init((0, 0)),
25-
range: .init(start: .init((0, 0)), end: .init((0, 1)))
25+
uuid: "uuid",
26+
range: .init(start: .init((0, 0)), end: .init((0, 1))),
27+
displayText: ""
2628
),
2729
.init(
28-
id: "uuid",
2930
text: " \n",
3031
position: .init((0, 0)),
31-
range: .init(start: .init((0, 0)), end: .init((0, 2)))
32+
uuid: "uuid",
33+
range: .init(start: .init((0, 0)), end: .init((0, 2))),
34+
displayText: ""
3235
),
3336
]) as! E.Response
3437
}
@@ -49,29 +52,32 @@ final class FetchSuggestionTests: XCTestCase {
4952

5053
func test_ignore_empty_suggestions() async throws {
5154
struct TestServer: GitHubCopilotLSP {
52-
func sendNotification(_ notif: LanguageServerProtocol.ClientNotification) async throws {
55+
func sendNotification(_: LanguageServerProtocol.ClientNotification) async throws {
5356
fatalError()
5457
}
55-
58+
5659
func sendRequest<E>(_: E) async throws -> E.Response where E: GitHubCopilotRequestType {
5760
return GitHubCopilotRequest.GetCompletionsCycling.Response(completions: [
5861
.init(
59-
id: "uuid",
6062
text: "Hello World\n",
6163
position: .init((0, 0)),
62-
range: .init(start: .init((0, 0)), end: .init((0, 4)))
64+
uuid: "uuid",
65+
range: .init(start: .init((0, 0)), end: .init((0, 4))),
66+
displayText: ""
6367
),
6468
.init(
65-
id: "uuid",
6669
text: " ",
6770
position: .init((0, 0)),
68-
range: .init(start: .init((0, 0)), end: .init((0, 1)))
71+
uuid: "uuid",
72+
range: .init(start: .init((0, 0)), end: .init((0, 1))),
73+
displayText: ""
6974
),
7075
.init(
71-
id: "uuid",
7276
text: " \n",
7377
position: .init((0, 0)),
74-
range: .init(start: .init((0, 0)), end: .init((0, 2)))
78+
uuid: "uuid",
79+
range: .init(start: .init((0, 0)), end: .init((0, 2))),
80+
displayText: ""
7581
),
7682
]) as! E.Response
7783
}
@@ -99,17 +105,18 @@ final class FetchSuggestionTests: XCTestCase {
99105
}
100106

101107
class TestServer: GitHubCopilotLSP {
102-
func sendNotification(_ notif: LanguageServerProtocol.ClientNotification) async throws {
108+
func sendNotification(_: LanguageServerProtocol.ClientNotification) async throws {
103109
// unimplemented
104110
}
105-
106-
func sendRequest<E>(_ r: E) async throws -> E.Response where E: GitHubCopilotRequestType {
111+
112+
func sendRequest<E>(_: E) async throws -> E.Response where E: GitHubCopilotRequestType {
107113
return GitHubCopilotRequest.GetCompletionsCycling.Response(completions: [
108114
.init(
109-
id: "uuid",
110115
text: "Hello World\n",
111116
position: .init((0, 0)),
112-
range: .init(start: .init((0, 0)), end: .init((0, 4)))
117+
uuid: "uuid",
118+
range: .init(start: .init((0, 0)), end: .init((0, 4))),
119+
displayText: ""
113120
),
114121
]) as! E.Response
115122
}
@@ -130,3 +137,4 @@ final class FetchSuggestionTests: XCTestCase {
130137
XCTAssertEqual(completions.first?.text, "Hello World")
131138
}
132139
}
140+

0 commit comments

Comments
 (0)