|
|
@@ -17,8 +17,30 @@
|
|
|
import GRPCCore
|
|
|
@_spi(Package) @testable import GRPCHTTP2Core
|
|
|
|
|
|
+// Equatable conformance for these types is 'best effort', this is sufficient for testing but not
|
|
|
+// for general use. As such the conformance is added in the test module and must be declared
|
|
|
+// as a `@retroactive` conformance.
|
|
|
+#if compiler(>=6.0)
|
|
|
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
|
|
-extension Connection.Event: Equatable {
|
|
|
+extension Connection.Event: @retroactive Equatable {}
|
|
|
+@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
|
|
+extension Connection.CloseReason: @retroactive Equatable {}
|
|
|
+
|
|
|
+extension ClientConnectionEvent: @retroactive Equatable {}
|
|
|
+extension ClientConnectionEvent.CloseReason: @retroactive Equatable {}
|
|
|
+
|
|
|
+#else
|
|
|
+@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
|
|
+extension Connection.Event: Equatable {}
|
|
|
+@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
|
|
+extension Connection.CloseReason: Equatable {}
|
|
|
+
|
|
|
+extension ClientConnectionEvent: Equatable {}
|
|
|
+extension ClientConnectionEvent.CloseReason: Equatable {}
|
|
|
+#endif
|
|
|
+
|
|
|
+@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
|
|
+extension Connection.Event {
|
|
|
public static func == (lhs: Connection.Event, rhs: Connection.Event) -> Bool {
|
|
|
switch (lhs, rhs) {
|
|
|
case (.connectSucceeded, .connectSucceeded),
|
|
|
@@ -38,7 +60,7 @@ extension Connection.Event: Equatable {
|
|
|
}
|
|
|
|
|
|
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
|
|
-extension Connection.CloseReason: Equatable {
|
|
|
+extension Connection.CloseReason {
|
|
|
public static func == (lhs: Connection.CloseReason, rhs: Connection.CloseReason) -> Bool {
|
|
|
switch (lhs, rhs) {
|
|
|
case (.idleTimeout, .idleTimeout),
|
|
|
@@ -60,7 +82,7 @@ extension Connection.CloseReason: Equatable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-extension ClientConnectionEvent: Equatable {
|
|
|
+extension ClientConnectionEvent {
|
|
|
public static func == (lhs: ClientConnectionEvent, rhs: ClientConnectionEvent) -> Bool {
|
|
|
switch (lhs, rhs) {
|
|
|
case (.ready, .ready):
|
|
|
@@ -73,7 +95,7 @@ extension ClientConnectionEvent: Equatable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-extension ClientConnectionEvent.CloseReason: Equatable {
|
|
|
+extension ClientConnectionEvent.CloseReason {
|
|
|
public static func == (lhs: Self, rhs: Self) -> Bool {
|
|
|
switch (lhs, rhs) {
|
|
|
case (.goAway(let lhsCode, let lhsMessage), .goAway(let rhsCode, let rhsMessage)):
|