-
Notifications
You must be signed in to change notification settings - Fork 81
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
Unable to verify initializer since 0.18.0 #240
Comments
Can you provide an example of how you’re using this initializer in tests? It should still be generating this initializer variant (or at least that was the intention): |
Sorry for the late reply. protocol SomeProtocol: RawRepresentable {
// some requirements
}
class SomeTest: XCTestCase {
func testCreation() {
let object = SomeCreator<SomeProtocolMock<Int>>.create()
verifyRawValueInitCalled(on: object, with: -1)
}
private func verifyRawValueInitCalled<RawValue: Equatable>(on object: SomeProtocolMock<RawValue>, with rawValue: RawValue) {
let invocation: Invocation = Invocation(selectorName: "init?(`rawValue`: RawValue) ", arguments: [ArgumentMatcher(rawValue)], returnType: Swift.ObjectIdentifier((Void).self))
let declaration = Mockingbird.Mockable<Mockingbird.PropertyGetterDeclaration, () -> SomeProtocolMock<RawValue>, SomeProtocolMock<RawValue>>(mock: object, invocation: invocation)
verify(declaration).wasCalled()
}
} It works before 0.18.0, but I only get an empty initializer since 0.18.0. |
Got it, thanks for the code snippet. I removed the initializer invocation recording in 0.18 as there isn’t an official way of calling I’ll have to think a bit about how to design the API for this—it’ll probably end up using a synthetic declaration on the instance similar to the legacy property getters and setters. I can’t guarantee I can prioritize it for the next release though. If you’re interested in adding the feature (should be a medium-sized task) let me know and I can walk you through it. verify(myMock.init(some: arg)).wasCalled() |
I totally agree with you.
I would love to, but I may be active only at weekends and using some time to catch up on the latest implementations. |
Yes, for sure! We’re happy with whatever you’re comfortable contributing. Note that we currently use Slack for coordinating, but let me know if another option works better for you. |
New Issue Checklist
Description
I depend on the implementation below in a special case.
https://github.com/birdrides/mockingbird/blob/13ee8ab4346bf65c51612305a897dffcfab45e5c/Sources/MockingbirdGenerator/Generator/Templates/InitializerMethodTemplate.swift#L76-L82
But it has been deleted by #217.
Do we have to delete it for supporting partial mocks, or it's deleted unintentionally?
The text was updated successfully, but these errors were encountered: