diff --git a/Sources/Testing/Testing.docc/exit-testing.md b/Sources/Testing/Testing.docc/exit-testing.md index fc00bf31d..a88136631 100644 --- a/Sources/Testing/Testing.docc/exit-testing.md +++ b/Sources/Testing/Testing.docc/exit-testing.md @@ -107,11 +107,12 @@ func `Customer won't eat food unless it's nutritious`(_ food: Food) async { } ``` -- Note: If you use this macro with a Swift compiler version lower than 6.3, it - doesn't support capturing state. +- Note: If you use ``expect(processExitsWith:observing:_:sourceLocation:performing:)`` + or ``require(processExitsWith:observing:_:sourceLocation:performing:)`` with a + Swift compiler version lower than 6.3, the macro doesn't capture state. -If a captured value is an argument to the current function or is `self`, its -type is inferred at compile time. Otherwise, explicitly specify the type of the +If a captured value is an argument to the current function or is `self`, the +compiler infers the value's type. Otherwise, explicitly specify the type of the value using the `as` operator: ```swift @@ -126,10 +127,14 @@ value using the `as` operator: ``` Every value you capture in an exit test must conform to [`Sendable`](https://developer.apple.com/documentation/swift/sendable) -and [`Codable`](https://developer.apple.com/documentation/swift/codable). Each -value is encoded by the parent process using [`encode(to:)`](https://developer.apple.com/documentation/swift/encodable/encode(to:)) -and is decoded by the child process [`init(from:)`](https://developer.apple.com/documentation/swift/decodable/init(from:)) -before being passed to the exit test body. +and [`Codable`](https://developer.apple.com/documentation/swift/codable). The +testing library passes each value to the exit test body by following this process: + +1. It encodes each value using [`encode(to:)`](https://developer.apple.com/documentation/swift/encodable/encode(to:)) +in the parent process +2. It passes the encoded value to the child process +3. It decodes each value using [`init(from:)`](https://developer.apple.com/documentation/swift/decodable/init(from:)) +in the child process If a captured value's type does not conform to both `Sendable` and `Codable`, or if the value is not explicitly specified in the exit test body's capture list,