Skip to content

Commit

Permalink
Make sure unused types can accept all possible JSON values
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Oct 1, 2024
1 parent 1f5f818 commit f141d79
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/LanguageServerProtocol/LanguageServerProtocol.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import JSONRPC

public typealias UnusedResult = String?
public typealias UnusedParam = String?
public typealias UnusedResult = LSPAny?
public typealias UnusedParam = LSPAny?

public enum ProtocolError: Error {
case unrecognizedMethod(String)
Expand Down
20 changes: 20 additions & 0 deletions Tests/LanguageServerProtocolTests/ServerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,24 @@ final class ServerTests: XCTestCase {

try await server.shutdown()
}

func testShutdownResponseWithEmptyObject() async throws {
let server = MockServer()

let data = Data("{}".utf8)

await server.sendMockResponse(data)

try await server.shutdown()
}

func testShutdownResponseWithNull() async throws {
let server = MockServer()

let data = Data("null".utf8)

await server.sendMockResponse(data)

try await server.shutdown()
}
}

0 comments on commit f141d79

Please sign in to comment.