The hash implementation does not match the equals implementation.
See this test case
|
@Test func hashMatchesEqualityForDifferentOrder() { |
|
let fields1: HTTPFields = [ |
|
.acceptEncoding: "br", |
|
.acceptEncoding: "gzip", |
|
.accept: "*/*", |
|
] |
|
|
|
// Fields with differently named fields in a different order are equal, since the |
|
// relative order of same-named fields is preserved. |
|
let fields2: HTTPFields = [ |
|
.acceptEncoding: "br", |
|
.accept: "*/*", |
|
.acceptEncoding: "gzip", |
|
] |
|
#expect(fields1 == fields2) |
|
|
|
// Equal values must therefore hash equally. |
|
withKnownIssue("HTTPFields.hash(into:) is order sensitive while == is not") { |
|
#expect(fields1.hashValue == fields2.hashValue) |
|
} |
|
} |
The hash implementation does not match the equals implementation.
See this test case
swift-http-types/Tests/HTTPTypesTests/HTTPTypesTests.swift
Lines 142 to 162 in 4b1dd0c