Add some helpful operators

This commit is contained in:
Erik Little 2019-11-25 14:34:11 -05:00
parent 68376581a0
commit a06af14dd9
No known key found for this signature in database
GPG Key ID: 62F837E56F4E9320
3 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,7 @@
# v15.3.0
- Add `==` operators for `SocketAckStatus` and `String`
# v15.2.0
- Small fixes.

View File

@ -31,6 +31,16 @@ public enum SocketAckStatus : String {
/// The ack timed out.
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 {

View File

@ -38,7 +38,7 @@ class SocketAckManagerTest : XCTestCase {
return
}
XCTAssertEqual(timeoutReason, SocketAckStatus.noAck.rawValue)
XCTAssert(timeoutReason == SocketAckStatus.noAck)
callbackExpection.fulfill()
}