-
Notifications
You must be signed in to change notification settings - Fork 0
feat: result type and typed throw support #3
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for Result types and Swift 6's typed throws syntax to SwiftMockk, enabling better error handling patterns in mocked protocols.
- Adds convenience DSL methods
returnsSuccess()andreturnsFailure()for stubbing Result-returning methods - Implements full support for Swift 6's typed throws syntax
throws(ErrorType)in protocol methods - Updates swift-syntax dependency from 510.0.0 to 600.0.0 to leverage proper typed throws API support
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/SwiftMockkTests/SwiftMockkTests.swift | Adds comprehensive test coverage for Result type stubbing and typed throws scenarios including sync/async variants |
| Sources/SwiftMockkMacros/MockableMacro.swift | Implements typed throws detection and generates appropriate stub helper calls based on throw type |
| Sources/SwiftMockk/SwiftMockk.swift | Adds typed throws helper functions and Result type handling in dummy value generation |
| Sources/SwiftMockk/DSL/Stubbing.swift | Adds returnsSuccess() and returnsFailure() convenience methods for Result type stubbing |
| README.md | Documents Result type and typed throws features with examples and important usage notes |
| CLAUDE.md | Provides technical implementation details for Result and typed throws support |
| Package.swift | Updates swift-syntax dependency to 600.0.0 for typed throws API support |
| Package.resolved | Reflects swift-syntax version update to 600.0.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Need these since i am a huge fan of result types and typed throws (Good errors make good neighbours)