Shorthand for multiple #expect in Swift Testing

I suspect this will resolve that issue: [Mini-Vision] Rethinking expectation capture in Swift Testing

For better or for worse, what you're looking for here is not possible in a clean way with expression macros. The closure will be evaluated before macro expansion occurs, so you'll end up with diagnostics about discarded results from the == operator calls. (Insert hand-waving about result builders here.)

It's also not clear here if && or || should be inferred, and it may not be clear to somebody reading your code which one is intended.

1 Like