Skip to content
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

Generate mock method with Typed Throw #262

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fummicc1
Copy link
Collaborator

@fummicc1 fummicc1 commented Jun 30, 2024

In this pull request, parse typed-throw name from throws clause.

@fummicc1 fummicc1 force-pushed the feature/issue-261-typed-throw branch from 136cdd3 to bbb6de0 Compare June 30, 2024 07:57
@fummicc1 fummicc1 force-pushed the feature/issue-261-typed-throw branch from c5c877f to 725c67d Compare July 15, 2024 01:26
Comment on lines -4 to -13
let funcThrow2 = """
import Foundation
/// \(String.mockAnnotation)
protocol FuncThrow {
func update<T>(arg1: T, arg2: () throws -> T) rethrows -> T
func update<T, U>(arg1: T, arg2: @escaping (U) throws -> ()) throws -> ((T) -> (U))
}
"""

Copy link
Collaborator Author

@fummicc1 fummicc1 Jul 15, 2024

Choose a reason for hiding this comment

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

FYI

This test-fixture is not used and is covered by funcThrow test-fixture. So I deleted it.

)
}
.first
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not sure if splitting by .whitespace is suitable or not. but this code works in added test-cases.

As far as I investigated,

@@ -11,7 +11,7 @@ let package = Package(
.library(name: "MockoloFramework", targets: ["MockoloFramework"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax.git", from: "510.0.1"),
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.0-prerelease-2024-06-12"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to use ThrowsClauseSyntax, I updated swift-syntax.

@fummicc1 fummicc1 marked this pull request as ready for review July 15, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant