Is it possible to customize the output of the difference of a expect/require comparison? When comparing larger structures or collections the current output makes it almost impossible to identify what is actually different.
@grynspan@smontgomery is there currently any way to accomplish this? If not, what would be a good way to enable such customization? I’d be happy to discuss and contribute
On the topic of expectation "diffing", I know this is an incredibly useful feature. Third-party libraries (such as Difference which you mentioned) do a pretty good job in the XCTest space. However, we'd like to eventually incorporate this kind of functionality directly into Swift Testing. Although those of us who maintain the library have talked about it often, and it has come up in Testing Workgroup meetings, I just realized we do not have a GitHub issue formally tracking the feature yet, so I went ahead and filed one here:
If you are inclined to experiment on your own, you might be able to leverage ST-0011: Issue Handling Traits to some benefit, however that's a fairly roundabout way to accomplish this workflow so it's only something I mention as a workaround.
We have a tool called expectNoDifference that is part of a few other tools for nicely printing the internals of complex types. It allows you to assert in both XCTest and Swift Testing that two values are equal, and when they are not a nicely formatted message is printed: