Skip to content

Glossary: Swift Beyond the Basics

#expect

Also written: #require, expect, require

Checks in a test. `#expect` records a failure and carries on, while `try #require` stops the test, and also unwraps an optional.

Where the book teaches it

Related terms

Swift Testingfreestanding macro