Add macros for enhanced output in Swift Testing #138
Replies: 2 comments 5 replies
-
|
We've wondered about this a little but couldn't really figure out if it would work or not, and given the cost of macros, we decided to spare this library unless we could make a worthwhile case. If you explore the problem a bit more, e.g. some motivating examples and improved outputs, and share your findings, we'd love to hear them! |
Beta Was this translation helpful? Give feedback.
-
|
+1 on better diff output for Swift Testing. I had asked about this in the forum https://forums.swift.org/t/customize-difference-output/81455 I'm not sure if this is necessarily something that should be done in this library, it might be better to make Swift Testing more customizable and allow the usage of libraries like this one. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I didn't see a discussion or ticket for this already, which surprised me. I just found myself suggesting this change in a code review:
My justification was that, for simple values, the advanced diff output of
expectNoDifferenceis not as meaningful (although still nice), and the tradeoff is that the#expectmacro will include the contents of the failing expression (tables.contains("someTableName")) in the failure message in the Xcode console, sidebar, CI, etc.But it's a drag to have to think about which one to use. I'd rather just use
expectNoDifferenceand get the best of both worlds.What about something like
#expectNoDifference(foo, bar)or maybe#customDumpExpect(foo == bar)and#customDumpExpect(foo != bar)? The naming is up for debate, but the idea is that it means you could always use it instead of#expectwithout having to think about which is which. Maybe it could even support all the other operators like>from#expect, just as a passthrough, or even wrap#expectfor non-==cases, and then a project could use a linter to enforce that it always uses the one from this library.Beta Was this translation helpful? Give feedback.
All reactions