Skip to content

Commit 0bf0b91

Browse files
committed
Fix tests
1 parent 719b7ae commit 0bf0b91

2 files changed

Lines changed: 3 additions & 56 deletions

File tree

Core/Tests/ServiceTests/Environment.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ class MockSuggestionService: GitHubCopilotSuggestionServiceType {
5252
cursorPosition: SuggestionModel.CursorPosition,
5353
tabSize: Int,
5454
indentSize: Int,
55-
usesTabsForIndentation: Bool,
56-
ignoreSpaceOnlySuggestions: Bool,
57-
ignoreTrailingNewLinesAndSpaces: Bool
55+
usesTabsForIndentation: Bool
5856
) async throws -> [SuggestionModel.CodeSuggestion] {
5957
completions
6058
}

Tool/Tests/GitHubCopilotServiceTests/FetchSuggestionsTests.swift

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -43,60 +43,11 @@ final class FetchSuggestionTests: XCTestCase {
4343
cursorPosition: .outOfScope,
4444
tabSize: 4,
4545
indentSize: 4,
46-
usesTabsForIndentation: false,
47-
ignoreSpaceOnlySuggestions: false,
48-
ignoreTrailingNewLinesAndSpaces: false
46+
usesTabsForIndentation: false
4947
)
5048
XCTAssertEqual(completions.count, 3)
5149
}
5250

53-
func test_ignore_empty_suggestions() async throws {
54-
struct TestServer: GitHubCopilotLSP {
55-
func sendNotification(_: LanguageServerProtocol.ClientNotification) async throws {
56-
fatalError()
57-
}
58-
59-
func sendRequest<E>(_: E) async throws -> E.Response where E: GitHubCopilotRequestType {
60-
return GitHubCopilotRequest.GetCompletionsCycling.Response(completions: [
61-
.init(
62-
text: "Hello World\n",
63-
position: .init((0, 0)),
64-
uuid: "uuid",
65-
range: .init(start: .init((0, 0)), end: .init((0, 4))),
66-
displayText: ""
67-
),
68-
.init(
69-
text: " ",
70-
position: .init((0, 0)),
71-
uuid: "uuid",
72-
range: .init(start: .init((0, 0)), end: .init((0, 1))),
73-
displayText: ""
74-
),
75-
.init(
76-
text: " \n",
77-
position: .init((0, 0)),
78-
uuid: "uuid",
79-
range: .init(start: .init((0, 0)), end: .init((0, 2))),
80-
displayText: ""
81-
),
82-
]) as! E.Response
83-
}
84-
}
85-
let service = GitHubCopilotSuggestionService(designatedServer: TestServer())
86-
let completions = try await service.getCompletions(
87-
fileURL: .init(fileURLWithPath: "/file.swift"),
88-
content: "",
89-
cursorPosition: .outOfScope,
90-
tabSize: 4,
91-
indentSize: 4,
92-
usesTabsForIndentation: false,
93-
ignoreSpaceOnlySuggestions: true,
94-
ignoreTrailingNewLinesAndSpaces: false
95-
)
96-
XCTAssertEqual(completions.count, 1)
97-
XCTAssertEqual(completions.first?.text, "Hello World\n")
98-
}
99-
10051
func test_if_language_identifier_is_unknown_returns_correctly() async throws {
10152
class TestServer: GitHubCopilotLSP {
10253
func sendNotification(_: LanguageServerProtocol.ClientNotification) async throws {
@@ -123,9 +74,7 @@ final class FetchSuggestionTests: XCTestCase {
12374
cursorPosition: .outOfScope,
12475
tabSize: 4,
12576
indentSize: 4,
126-
usesTabsForIndentation: false,
127-
ignoreSpaceOnlySuggestions: false,
128-
ignoreTrailingNewLinesAndSpaces: true
77+
usesTabsForIndentation: false
12978
)
13079
XCTAssertEqual(completions.count, 1)
13180
XCTAssertEqual(completions.first?.text, "Hello World")

0 commit comments

Comments
 (0)