Skip to content

Avoid passive voice and clarify macro in exit test docs. #1243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Sources/Testing/Testing.docc/exit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commas are incorrect, at least the way I was taught (circa 1854.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The words "and", and "before", are acting as coordinating conjunctions between independent clauses in this sentence. While you can always find a grammar "rule" that says you should use a comma in the same place that another "rule" says you shouldn't use one, I think the commas separate the independent clauses here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could split the difference and make this a list of steps instead?


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,
Expand Down