Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests #5

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions Tests/GRPCProtobufCodeGenTests/ProtobufCodeGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,20 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
internal protocol Hello_World_Greeter_ClientProtocol: Sendable {
/// Sends a greeting.
func sayHello<R>(
request: GRPCCore.ClientRequest.Single<Hello_World_HelloRequest>,
request: GRPCCore.ClientRequest<Hello_World_HelloRequest>,
serializer: some GRPCCore.MessageSerializer<Hello_World_HelloRequest>,
deserializer: some GRPCCore.MessageDeserializer<Hello_World_HelloReply>,
options: GRPCCore.CallOptions,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Hello_World_HelloReply>) async throws -> R
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Hello_World_HelloReply>) async throws -> R
) async throws -> R where R: Sendable
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Hello_World_Greeter.ClientProtocol {
internal func sayHello<R>(
request: GRPCCore.ClientRequest.Single<Hello_World_HelloRequest>,
request: GRPCCore.ClientRequest<Hello_World_HelloRequest>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Hello_World_HelloReply>) async throws -> R = {
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Hello_World_HelloReply>) async throws -> R = {
try $0.message
}
) async throws -> R where R: Sendable {
Expand All @@ -126,11 +126,11 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
_ message: Hello_World_HelloRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Hello_World_HelloReply>) async throws -> Result = {
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Hello_World_HelloReply>) async throws -> Result = {
try $0.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest.Single<Hello_World_HelloRequest>(
let request = GRPCCore.ClientRequest<Hello_World_HelloRequest>(
message: message,
metadata: metadata
)
Expand All @@ -153,11 +153,11 @@ final class ProtobufCodeGeneratorTests: XCTestCase {

/// Sends a greeting.
internal func sayHello<R>(
request: GRPCCore.ClientRequest.Single<Hello_World_HelloRequest>,
request: GRPCCore.ClientRequest<Hello_World_HelloRequest>,
serializer: some GRPCCore.MessageSerializer<Hello_World_HelloRequest>,
deserializer: some GRPCCore.MessageDeserializer<Hello_World_HelloReply>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Hello_World_HelloReply>) async throws -> R = {
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Hello_World_HelloReply>) async throws -> R = {
try $0.message
}
) async throws -> R where R: Sendable {
Expand Down Expand Up @@ -242,9 +242,9 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
public protocol Helloworld_Greeter_StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
/// Sends a greeting.
func sayHello(
request: GRPCCore.ServerRequest.Stream<Helloworld_HelloRequest>,
request: GRPCCore.StreamingServerRequest<Helloworld_HelloRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Helloworld_HelloReply>
) async throws -> GRPCCore.StreamingServerResponse<Helloworld_HelloReply>
}

/// Conformance to `GRPCCore.RegistrableRPCService`.
Expand All @@ -271,23 +271,23 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
public protocol Helloworld_Greeter_ServiceProtocol: Helloworld_Greeter.StreamingServiceProtocol {
/// Sends a greeting.
func sayHello(
request: GRPCCore.ServerRequest.Single<Helloworld_HelloRequest>,
request: GRPCCore.ServerRequest<Helloworld_HelloRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Single<Helloworld_HelloReply>
) async throws -> GRPCCore.ServerResponse<Helloworld_HelloReply>
}

/// Partial conformance to `Helloworld_Greeter_StreamingServiceProtocol`.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Helloworld_Greeter.ServiceProtocol {
public func sayHello(
request: GRPCCore.ServerRequest.Stream<Helloworld_HelloRequest>,
request: GRPCCore.StreamingServerRequest<Helloworld_HelloRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Helloworld_HelloReply> {
) async throws -> GRPCCore.StreamingServerResponse<Helloworld_HelloReply> {
let response = try await self.sayHello(
request: GRPCCore.ServerRequest.Single(stream: request),
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.ServerResponse.Stream(single: response)
return GRPCCore.StreamingServerResponse(single: response)
}
}
"""
Expand Down Expand Up @@ -365,9 +365,9 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
package protocol Greeter_StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
/// Sends a greeting.
func sayHello(
request: GRPCCore.ServerRequest.Stream<HelloRequest>,
request: GRPCCore.StreamingServerRequest<HelloRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<HelloReply>
) async throws -> GRPCCore.StreamingServerResponse<HelloReply>
}

/// Conformance to `GRPCCore.RegistrableRPCService`.
Expand All @@ -394,23 +394,23 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
package protocol Greeter_ServiceProtocol: Greeter.StreamingServiceProtocol {
/// Sends a greeting.
func sayHello(
request: GRPCCore.ServerRequest.Single<HelloRequest>,
request: GRPCCore.ServerRequest<HelloRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Single<HelloReply>
) async throws -> GRPCCore.ServerResponse<HelloReply>
}

/// Partial conformance to `Greeter_StreamingServiceProtocol`.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Greeter.ServiceProtocol {
package func sayHello(
request: GRPCCore.ServerRequest.Stream<HelloRequest>,
request: GRPCCore.StreamingServerRequest<HelloRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<HelloReply> {
) async throws -> GRPCCore.StreamingServerResponse<HelloReply> {
let response = try await self.sayHello(
request: GRPCCore.ServerRequest.Single(stream: request),
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.ServerResponse.Stream(single: response)
return GRPCCore.StreamingServerResponse(single: response)
}
}

Expand All @@ -419,20 +419,20 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
package protocol Greeter_ClientProtocol: Sendable {
/// Sends a greeting.
func sayHello<R>(
request: GRPCCore.ClientRequest.Single<HelloRequest>,
request: GRPCCore.ClientRequest<HelloRequest>,
serializer: some GRPCCore.MessageSerializer<HelloRequest>,
deserializer: some GRPCCore.MessageDeserializer<HelloReply>,
options: GRPCCore.CallOptions,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<HelloReply>) async throws -> R
_ body: @Sendable @escaping (GRPCCore.ClientResponse<HelloReply>) async throws -> R
) async throws -> R where R: Sendable
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Greeter.ClientProtocol {
package func sayHello<R>(
request: GRPCCore.ClientRequest.Single<HelloRequest>,
request: GRPCCore.ClientRequest<HelloRequest>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<HelloReply>) async throws -> R = {
_ body: @Sendable @escaping (GRPCCore.ClientResponse<HelloReply>) async throws -> R = {
try $0.message
}
) async throws -> R where R: Sendable {
Expand All @@ -453,11 +453,11 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
_ message: HelloRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<HelloReply>) async throws -> Result = {
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<HelloReply>) async throws -> Result = {
try $0.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest.Single<HelloRequest>(
let request = GRPCCore.ClientRequest<HelloRequest>(
message: message,
metadata: metadata
)
Expand All @@ -480,11 +480,11 @@ final class ProtobufCodeGeneratorTests: XCTestCase {

/// Sends a greeting.
package func sayHello<R>(
request: GRPCCore.ClientRequest.Single<HelloRequest>,
request: GRPCCore.ClientRequest<HelloRequest>,
serializer: some GRPCCore.MessageSerializer<HelloRequest>,
deserializer: some GRPCCore.MessageDeserializer<HelloReply>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<HelloReply>) async throws -> R = {
_ body: @Sendable @escaping (GRPCCore.ClientResponse<HelloReply>) async throws -> R = {
try $0.message
}
) async throws -> R where R: Sendable {
Expand Down
Loading