Skip to content

Commit

Permalink
Merge pull request #371 from mattpolzin/fix-anycodable-url-equality
Browse files Browse the repository at this point in the history
Fix equality comparison of URL AnyCodables
  • Loading branch information
mattpolzin authored Apr 21, 2024
2 parents d832864 + ad5ebb9 commit d892974
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/OpenAPIKitCore/AnyCodable/AnyCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ extension AnyCodable: Equatable {
return lhs == rhs
case let (lhs as String, rhs as String):
return lhs == rhs
case let (lhs as URL, rhs as URL):
return lhs == rhs
case let (lhs as [String: String], rhs as [String: String]):
return lhs == rhs
case let (lhs as [String: Int], rhs as [String: Int]):
Expand Down
1 change: 1 addition & 0 deletions Tests/AnyCodableTests/AnyCodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class AnyCodableTests: XCTestCase {
XCTAssertEqual(AnyCodable(Float(2)), AnyCodable(Float(2)))
XCTAssertEqual(AnyCodable(Double(2)), AnyCodable(Double(2)))
XCTAssertEqual(AnyCodable("hi"), AnyCodable("hi"))
XCTAssertEqual(AnyCodable(URL(string: "file://./params/name.json")), AnyCodable(URL(string: "file://./params/name.json")))
XCTAssertEqual(AnyCodable(["hi": AnyCodable(2)]), AnyCodable(["hi": AnyCodable(2)]))
XCTAssertEqual(AnyCodable([AnyCodable("hi"), AnyCodable("there")]), AnyCodable([AnyCodable("hi"), AnyCodable("there")]))
XCTAssertEqual(AnyCodable(["hi":1]), AnyCodable(["hi":1]))
Expand Down

0 comments on commit d892974

Please sign in to comment.