-
Notifications
You must be signed in to change notification settings - Fork 86
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
Support Actor Protocol #216
Comments
Thanks for the Issue! |
I hope this feature exists in this OSS! I see three ways to support this:
// 1.
/// @mockable(object: actor)
protocol Hoge: Actor {
var count: Int { get }
}
///
/// @Generated by Mockolo
///
actor HogeMock: Hoge {
init() { }
init(count: Int = 0) {
self.count = count
}
private(set) var countSetCallCount = 0
var count: Int = 0 { didSet { countSetCallCount += 1 } }
} // 2.
/// @mockable
protocol Hoge: Actor {
var count: Int { get }
}
///
/// @Generated by Mockolo
///
actor HogeMock: Hoge {
init() { }
init(count: Int = 0) {
self.count = count
}
private(set) var countSetCallCount = 0
var count: Int = 0 { didSet { countSetCallCount += 1 } }
} // 3.
/// @mockable
protocol Hoge: Fuga {
var count: Int { get }
}
protocol Fuga: Actor {
}
///
/// @Generated by Mockolo
///
actor HogeMock: Hoge {
init() { }
init(count: Int = 0) {
self.count = count
}
private(set) var countSetCallCount = 0
var count: Int = 0 { didSet { countSetCallCount += 1 } }
} I implemented the changes that fulfill "1." and "2." above in my forked branch: master...treastrain:c20f64b140c78b9f05202e661a07c43c15834358 (No test has been added to this yet now.) However, I have yet to come up with a way to achieve "3." Any suggestions? |
@treastrain Thanks for the suggestion! I agree with "2." since only Japanese提案ありがとうございます!
"1." は |
Thanks for your response! The diffs shown in master...treastrain:c20f64b140c78b9f05202e661a07c43c15834358 are a mixture of "1." and "2." but the implementation effort is light < "1." < "2." < heavy.
I see. I will create a pull request for this part in my spare time.
The same could be said here for the already existing annotations
My knowledge of SwiftSyntax is lacking, so a solution using it is not immediately obvious. Japaneseありがとうございます!master...treastrain:c20f64b140c78b9f05202e661a07c43c15834358 で示した差分は "1." と "2." が混ざったものになっていますが、実装工数は 軽 < "1." < "2." < 重 になっています。
わかりました。私の余暇の時間でここの部分の pull request を作成してみたいと思います。
こちらは、すでに存在するアノテーションである
私の SwiftSyntax に対する知識が足りないため、それを用いた解決方法はすぐには分かりません。 |
Thanks, waiting for PR 🙏
Since you are right, it seems that if "3." cannot be realized by any means, "1." may be adopted. Japanese
ありがとうございます。PR お待ちしております 🙏
仰る通りなので、どうしても "3." が実現できない場合は "1." を採用してよさそうです。 |
Thank you! let me say one opinion from my side. 🙏 oh I am sorry. I found globalActor protocol should be mocked with class.
one of example is typealias and AnyActor, DistributedActor. |
Could you support to actor protocol?
I would like to automatically generate an "Actor" compliant protocol as follows.
↓ Generated
Thank you.
The text was updated successfully, but these errors were encountered: