Add macros for enhanced output in Swift Testing #138
ZevEisenberg
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
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 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
expectNoDifference
is not as meaningful (although still nice), and the tradeoff is that the#expect
macro 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
expectNoDifference
and 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#expect
without 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#expect
for 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