Swift Testing basics

A modern framework, built for this

Apple ships two testing frameworks today: the long-standing XCTest, and the newer Swift Testing β€” a framework designed around modern Swift (macros, async/await, value types) rather than bolted onto Objective-C conventions. Swift Testing is what this module uses.

Three pieces: import Testing at the top of a test file, @Test marking a function as a test (no XCTestCase subclass, no test name prefix β€” just a free function), and #expect(...) making an assertion inside it.