From 77a26ba5d5b0518097c3da2ecf0b77226652337c Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Tue, 29 Jul 2025 14:35:51 +0100 Subject: [PATCH 1/3] Avoid passive voice and clarify macro in exit test docs. --- Sources/Testing/Testing.docc/exit-testing.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Sources/Testing/Testing.docc/exit-testing.md b/Sources/Testing/Testing.docc/exit-testing.md index fc00bf31d..ed241ddd6 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 the ``expect(processExitsWith:observing:_:sourceLocation:performing:)`` + macro with a Swift compiler version lower than 6.3, it doesn't support + capturing 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,10 @@ 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 encodes each value using [`encode(to:)`](https://developer.apple.com/documentation/swift/encodable/encode(to:)) +in the parent process, and decodes it using [`init(from:)`](https://developer.apple.com/documentation/swift/decodable/init(from:)) +in the child process, before passing it to the exit test body. 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, From e6c5c82cfe79a3ef1720d8c5ca1a7a47b37e3d23 Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Tue, 29 Jul 2025 15:01:39 +0100 Subject: [PATCH 2/3] Add second option for "this macro". --- Sources/Testing/Testing.docc/exit-testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Testing/Testing.docc/exit-testing.md b/Sources/Testing/Testing.docc/exit-testing.md index ed241ddd6..07d5d86ad 100644 --- a/Sources/Testing/Testing.docc/exit-testing.md +++ b/Sources/Testing/Testing.docc/exit-testing.md @@ -107,9 +107,9 @@ func `Customer won't eat food unless it's nutritious`(_ food: Food) async { } ``` -- Note: If you use the ``expect(processExitsWith:observing:_:sourceLocation:performing:)`` - 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`, the compiler infers the value's type. Otherwise, explicitly specify the type of the From 6459010af4c8e260db6ecdbf35d835046c52fe95 Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Fri, 1 Aug 2025 16:18:13 +0100 Subject: [PATCH 3/3] Replace contested sentence structure with a list --- Sources/Testing/Testing.docc/exit-testing.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Sources/Testing/Testing.docc/exit-testing.md b/Sources/Testing/Testing.docc/exit-testing.md index 07d5d86ad..a88136631 100644 --- a/Sources/Testing/Testing.docc/exit-testing.md +++ b/Sources/Testing/Testing.docc/exit-testing.md @@ -128,9 +128,13 @@ 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). The -testing library encodes each value using [`encode(to:)`](https://developer.apple.com/documentation/swift/encodable/encode(to:)) -in the parent process, and decodes it using [`init(from:)`](https://developer.apple.com/documentation/swift/decodable/init(from:)) -in the child process, before passing it to the exit test body. +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,