Add some helpful operators
This commit is contained in:
parent
68376581a0
commit
a06af14dd9
@ -1,3 +1,7 @@
|
|||||||
|
# v15.3.0
|
||||||
|
|
||||||
|
- Add `==` operators for `SocketAckStatus` and `String`
|
||||||
|
|
||||||
# v15.2.0
|
# v15.2.0
|
||||||
|
|
||||||
- Small fixes.
|
- Small fixes.
|
||||||
|
|||||||
@ -31,6 +31,16 @@ public enum SocketAckStatus : String {
|
|||||||
|
|
||||||
/// The ack timed out.
|
/// The ack timed out.
|
||||||
case noAck = "NO ACK"
|
case noAck = "NO ACK"
|
||||||
|
|
||||||
|
/// Tests whether a string is equal to a given SocketAckStatus
|
||||||
|
public static func == (lhs: String, rhs: SocketAckStatus) -> Bool {
|
||||||
|
return lhs == rhs.rawValue
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Tests whether a string is equal to a given SocketAckStatus
|
||||||
|
public static func == (lhs: SocketAckStatus, rhs: String) -> Bool {
|
||||||
|
return rhs == lhs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct SocketAck : Hashable {
|
private struct SocketAck : Hashable {
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class SocketAckManagerTest : XCTestCase {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(timeoutReason, SocketAckStatus.noAck.rawValue)
|
XCTAssert(timeoutReason == SocketAckStatus.noAck)
|
||||||
|
|
||||||
callbackExpection.fulfill()
|
callbackExpection.fulfill()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user