# Shorthand for multiple #expect in Swift Testing

**URL:** <https://forums.swift.org/t/shorthand-for-multiple-expect-in-swift-testing/79490>\
**Category:** Swift Testing\
**Created:** [April 24, 2025, 2:32pm UTC](https://forums.swift.org/t/shorthand-for-multiple-expect-in-swift-testing/79490 "2025-04-24T14:32:28Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![grynspan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/grynspan/32/15315_2.png) [@grynspan](https://forums.swift.org/u/grynspan)\
**Post date:** [April 24, 2025, 3:21pm UTC](https://forums.swift.org/t/shorthand-for-multiple-expect-in-swift-testing/79490/6 "2025-04-24T15:21:43Z")

</div>

> [@Jon889](#):
>
> That works, but the problem with that is that if one fails the output is not nearly as nice

I suspect this will resolve that issue: [[Mini-Vision] Rethinking expectation capture in Swift Testing](https://forums.swift.org/t/mini-vision-rethinking-expectation-capture-in-swift-testing/77075)

> [@Jon889](#):
>
> My gut instinct says the block like macro would only accept expression of bools, no statements etc.

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.

---

_[View the full topic](https://forums.swift.org/t/shorthand-for-multiple-expect-in-swift-testing/79490)._
