You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the result of an exit test optional with #expect. (#779)
This PR changes the semantics of `#expect(exitsWith:)` such that it only
returns a value on success, and returns `nil` on failure. This is
consistent with general Swift semantics.
This means that if you have an exit test that fails to exit with the
expected exit condition, you won't get a value back, but that's
intentional now because your test will have already failed. This makes
it easier to reason about properties we add to the result structure in
the future: they'll always be valid if you have an instance of the
structure because you can't get a half-baked instance back by mistake.
This change made me realize that our custom comparison operators on
`ExitCondition` do not compare against `nil` correctly, so I've moved
them to `Optional<ExitCondition>`. (I know @stmontgomery is interested
in revisiting whether they should be operators at all, but let's leave
that discussion for a separate PR or thread.)
I also renamed the structure `ExitTestArtifacts` for two reasons:
1. To get it out from under `ExitTest` so that that type does not need
to be API, and
2. To give it an even uglier name so we are forced to debate what to
call it when the feature comes up for review.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments