Skip to content

Add a (internal-only) CustomIssueRepresentable protocol. #945

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

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Feb 7, 2025

This PR adds a (for now internal-only) protocol that lets us transform arbitrary errors to arbitrary issues (rather than always emitting them as .errorCaught). This protocol replaces the special-casing we were doing for SystemError and APIMisuseError.

This change also causes us to emit an API misuse issue if a developer passes an error of type ExpectationFailedError to Issue.record() as we can reasonably assume that such an error was already recorded correctly as .expectationFailed.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR adds a (for now internal-only) protocol that lets us transform arbitrary
errors to arbitrary issues (rather than always emitting them as `.errorCaught`).
This protocol replaces the special-casing we were doing for `SystemError` and
`APIMisuseError`.

This change also causes us to emit an API misuse issue if a developer passes an
error of type `ExpectationFailedError` to `Issue.record()` as we can reasonably
assume that such an error was already recorded correctly as `.expectationFailed`.
@grynspan grynspan added enhancement New feature or request issue-handling Related to Issue handling within the testing library labels Feb 7, 2025
@grynspan grynspan added this to the Swift 6.x milestone Feb 7, 2025
@grynspan grynspan self-assigned this Feb 7, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Feb 7, 2025

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan merged commit 55d0023 into main Feb 11, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/CustomIssueRepresentable-protocol branch February 11, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request issue-handling Related to Issue handling within the testing library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants