Skip to content

Commit ed1f23f

Browse files
committed
Add back generated code gen test availability
1 parent 03caeb3 commit ed1f23f

File tree

5 files changed

+136
-0
lines changed

5 files changed

+136
-0
lines changed

Tests/GRPCCodeGenTests/Internal/Renderer/TextBasedRendererTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ final class Test_TextBasedRenderer: XCTestCase {
734734
]),
735735
renderedBy: { $0.renderAvailability(_:) },
736736
rendersAs: #"""
737+
@available(macOS 12.0, iOS 13.1.2, watchOS 8.1.2, tvOS 15.0.2, *)
737738
"""#
738739
)
739740
}

Tests/GRPCCodeGenTests/Internal/Translator/ClientCodeTranslatorSnippetBasedTests.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
4343
let expectedSwift =
4444
"""
4545
/// Documentation for ServiceA
46+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
4647
public protocol NamespaceA_ServiceA_ClientProtocol: Sendable {
4748
/// Documentation for MethodA
4849
func methodA<R>(
@@ -53,6 +54,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
5354
_ body: @Sendable @escaping (GRPCCore.ClientResponse<NamespaceA_ServiceAResponse>) async throws -> R
5455
) async throws -> R where R: Sendable
5556
}
57+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
5658
extension NamespaceA_ServiceA.ClientProtocol {
5759
public func methodA<R>(
5860
request: GRPCCore.ClientRequest<NamespaceA_ServiceARequest>,
@@ -70,6 +72,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
7072
)
7173
}
7274
}
75+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
7376
extension NamespaceA_ServiceA.ClientProtocol {
7477
/// Documentation for MethodA
7578
public func methodA<Result>(
@@ -92,6 +95,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
9295
}
9396
}
9497
/// Documentation for ServiceA
98+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
9599
public struct NamespaceA_ServiceA_Client: NamespaceA_ServiceA.ClientProtocol {
96100
private let client: GRPCCore.GRPCClient
97101
@@ -146,6 +150,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
146150
let expectedSwift =
147151
"""
148152
/// Documentation for ServiceA
153+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
149154
public protocol NamespaceA_ServiceA_ClientProtocol: Sendable {
150155
/// Documentation for MethodA
151156
func methodA<R>(
@@ -156,6 +161,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
156161
_ body: @Sendable @escaping (GRPCCore.ClientResponse<NamespaceA_ServiceAResponse>) async throws -> R
157162
) async throws -> R where R: Sendable
158163
}
164+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
159165
extension NamespaceA_ServiceA.ClientProtocol {
160166
public func methodA<R>(
161167
request: GRPCCore.StreamingClientRequest<NamespaceA_ServiceARequest>,
@@ -173,6 +179,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
173179
)
174180
}
175181
}
182+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
176183
extension NamespaceA_ServiceA.ClientProtocol {
177184
/// Documentation for MethodA
178185
public func methodA<Result>(
@@ -195,6 +202,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
195202
}
196203
}
197204
/// Documentation for ServiceA
205+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
198206
public struct NamespaceA_ServiceA_Client: NamespaceA_ServiceA.ClientProtocol {
199207
private let client: GRPCCore.GRPCClient
200208
@@ -249,6 +257,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
249257
let expectedSwift =
250258
"""
251259
/// Documentation for ServiceA
260+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
252261
public protocol NamespaceA_ServiceA_ClientProtocol: Sendable {
253262
/// Documentation for MethodA
254263
func methodA<R>(
@@ -259,6 +268,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
259268
_ body: @Sendable @escaping (GRPCCore.StreamingClientResponse<NamespaceA_ServiceAResponse>) async throws -> R
260269
) async throws -> R where R: Sendable
261270
}
271+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
262272
extension NamespaceA_ServiceA.ClientProtocol {
263273
public func methodA<R>(
264274
request: GRPCCore.ClientRequest<NamespaceA_ServiceARequest>,
@@ -274,6 +284,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
274284
)
275285
}
276286
}
287+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
277288
extension NamespaceA_ServiceA.ClientProtocol {
278289
/// Documentation for MethodA
279290
public func methodA<Result>(
@@ -294,6 +305,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
294305
}
295306
}
296307
/// Documentation for ServiceA
308+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
297309
public struct NamespaceA_ServiceA_Client: NamespaceA_ServiceA.ClientProtocol {
298310
private let client: GRPCCore.GRPCClient
299311
@@ -346,6 +358,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
346358
let expectedSwift =
347359
"""
348360
/// Documentation for ServiceA
361+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
349362
public protocol NamespaceA_ServiceA_ClientProtocol: Sendable {
350363
/// Documentation for MethodA
351364
func methodA<R>(
@@ -356,6 +369,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
356369
_ body: @Sendable @escaping (GRPCCore.StreamingClientResponse<NamespaceA_ServiceAResponse>) async throws -> R
357370
) async throws -> R where R: Sendable
358371
}
372+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
359373
extension NamespaceA_ServiceA.ClientProtocol {
360374
public func methodA<R>(
361375
request: GRPCCore.StreamingClientRequest<NamespaceA_ServiceARequest>,
@@ -371,6 +385,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
371385
)
372386
}
373387
}
388+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
374389
extension NamespaceA_ServiceA.ClientProtocol {
375390
/// Documentation for MethodA
376391
public func methodA<Result>(
@@ -391,6 +406,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
391406
}
392407
}
393408
/// Documentation for ServiceA
409+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
394410
public struct NamespaceA_ServiceA_Client: NamespaceA_ServiceA.ClientProtocol {
395411
private let client: GRPCCore.GRPCClient
396412
@@ -451,6 +467,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
451467
let expectedSwift =
452468
"""
453469
/// Documentation for ServiceA
470+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
454471
package protocol NamespaceA_ServiceA_ClientProtocol: Sendable {
455472
/// Documentation for MethodA
456473
func methodA<R>(
@@ -470,6 +487,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
470487
_ body: @Sendable @escaping (GRPCCore.StreamingClientResponse<NamespaceA_ServiceAResponse>) async throws -> R
471488
) async throws -> R where R: Sendable
472489
}
490+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
473491
extension NamespaceA_ServiceA.ClientProtocol {
474492
package func methodA<R>(
475493
request: GRPCCore.StreamingClientRequest<NamespaceA_ServiceARequest>,
@@ -501,6 +519,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
501519
)
502520
}
503521
}
522+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
504523
extension NamespaceA_ServiceA.ClientProtocol {
505524
/// Documentation for MethodA
506525
package func methodA<Result>(
@@ -541,6 +560,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
541560
}
542561
}
543562
/// Documentation for ServiceA
563+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
544564
package struct NamespaceA_ServiceA_Client: NamespaceA_ServiceA.ClientProtocol {
545565
private let client: GRPCCore.GRPCClient
546566
@@ -613,6 +633,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
613633
let expectedSwift =
614634
"""
615635
/// Documentation for ServiceA
636+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
616637
internal protocol ServiceA_ClientProtocol: Sendable {
617638
/// Documentation for MethodA
618639
func methodA<R>(
@@ -623,6 +644,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
623644
_ body: @Sendable @escaping (GRPCCore.ClientResponse<ServiceAResponse>) async throws -> R
624645
) async throws -> R where R: Sendable
625646
}
647+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
626648
extension ServiceA.ClientProtocol {
627649
internal func methodA<R>(
628650
request: GRPCCore.ClientRequest<ServiceARequest>,
@@ -640,6 +662,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
640662
)
641663
}
642664
}
665+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
643666
extension ServiceA.ClientProtocol {
644667
/// Documentation for MethodA
645668
internal func methodA<Result>(
@@ -662,6 +685,7 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
662685
}
663686
}
664687
/// Documentation for ServiceA
688+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
665689
internal struct ServiceA_Client: ServiceA.ClientProtocol {
666690
private let client: GRPCCore.GRPCClient
667691
@@ -722,12 +746,16 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
722746
let expectedSwift =
723747
"""
724748
/// Documentation for ServiceA
749+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
725750
public protocol NamespaceA_ServiceA_ClientProtocol: Sendable {}
751+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
726752
extension NamespaceA_ServiceA.ClientProtocol {
727753
}
754+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
728755
extension NamespaceA_ServiceA.ClientProtocol {
729756
}
730757
/// Documentation for ServiceA
758+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
731759
public struct NamespaceA_ServiceA_Client: NamespaceA_ServiceA.ClientProtocol {
732760
private let client: GRPCCore.GRPCClient
733761
@@ -738,14 +766,18 @@ final class ClientCodeTranslatorSnippetBasedTests: XCTestCase {
738766
/// Documentation for ServiceB
739767
///
740768
/// Line 2
769+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
741770
public protocol ServiceB_ClientProtocol: Sendable {}
771+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
742772
extension ServiceB.ClientProtocol {
743773
}
774+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
744775
extension ServiceB.ClientProtocol {
745776
}
746777
/// Documentation for ServiceB
747778
///
748779
/// Line 2
780+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
749781
public struct ServiceB_Client: ServiceB.ClientProtocol {
750782
private let client: GRPCCore.GRPCClient
751783

Tests/GRPCCodeGenTests/Internal/Translator/IDLToStructuredSwiftTranslatorSnippetBasedTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ final class IDLToStructuredSwiftTranslatorSnippetBasedTests: XCTestCase {
221221
public enum Method {
222222
public static let descriptors: [GRPCCore.MethodDescriptor] = []
223223
}
224+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
224225
public typealias StreamingServiceProtocol = NamespaceA_ServiceA_StreamingServiceProtocol
226+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
225227
public typealias ServiceProtocol = NamespaceA_ServiceA_ServiceProtocol
226228
}
227229
@@ -233,17 +235,22 @@ final class IDLToStructuredSwiftTranslatorSnippetBasedTests: XCTestCase {
233235
}
234236
235237
/// Documentation for AService
238+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
236239
public protocol NamespaceA_ServiceA_StreamingServiceProtocol: GRPCCore.RegistrableRPCService {}
237240
238241
/// Conformance to `GRPCCore.RegistrableRPCService`.
242+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
239243
extension NamespaceA_ServiceA.StreamingServiceProtocol {
244+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
240245
public func registerMethods(with router: inout GRPCCore.RPCRouter) {}
241246
}
242247
243248
/// Documentation for AService
249+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
244250
public protocol NamespaceA_ServiceA_ServiceProtocol: NamespaceA_ServiceA.StreamingServiceProtocol {}
245251
246252
/// Partial conformance to `NamespaceA_ServiceA_StreamingServiceProtocol`.
253+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
247254
extension NamespaceA_ServiceA.ServiceProtocol {
248255
}
249256
"""

0 commit comments

Comments
 (0)