Closed pyrtsa closed 1 year ago
Hey @pyrtsa, thanks for the PR! We actually had this at one point but decided against it because it is possible to get false positives. Since equality depends on the strength of the mirror it is possible for a type to omit some things from its mirror, causing tests to pass on values that are definitely not equal.
However, I could see us still shipping this tool but with a different name. Maybe XCTAssertLossyNoDifference
or something.
Hey @pyrtsa, after chatting with @stephencelis we decided to not accept this PR at this time. It should be possible to define this outside the library (let us know if not), and we think it's just got too many subtleties to be apart of the public API at this time.
I'm going to close for now, but feel free to open a discussion if you want to chat more about it!
Sometimes we only need
Equatable
conformance for the purpose of unit tests. But withCustomDump.diff
, we don't necessarily needEquatable
conformance if we're willing to pay the performance hit of reflection and implicit opening of existentials during tests for a decreased application binary size.The proposed
XCTAssertNoDifference(lhs, rhs)
overload in this PR allows asserting on non-Equatable
values.