Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix equality comparison of URL AnyCodables #371

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading