Skip to content

Fix Dictionary ordering in TestHTTPURLResponse.test_NSCoding #5133

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

Merged
merged 1 commit into from
Nov 6, 2024
Merged
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
3 changes: 2 additions & 1 deletion Tests/Foundation/TestHTTPURLResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ class TestHTTPURLResponse: XCTestCase {

//On macOS unarchived Archived then unarchived `URLResponse` is not equal.
XCTAssertEqual(responseA.statusCode, responseB.statusCode, "Archived then unarchived http url response must be equal.")
XCTAssertEqual(Array(responseA.allHeaderFields.keys), Array(responseB.allHeaderFields.keys), "Archived then unarchived http url response must be equal.")
// Dictionary ordering is unpredictable after encoding/decoding because every Dictionary instance has its own hash table salt. Compare Sets of the keys instead.
XCTAssertEqual(Set(responseA.allHeaderFields.keys), Set(responseB.allHeaderFields.keys), "Archived then unarchived http url response must be equal.")

for key in responseA.allHeaderFields.keys {
XCTAssertEqual(responseA.allHeaderFields[key] as? String, responseB.allHeaderFields[key] as? String, "Archived then unarchived http url response must be equal.")
Expand Down