Closed keithcml closed 1 year ago
You'll need to pass a --mockfiles input option with paths to files that contain mocks of protocols that you inherit (which live in different modules). Please see test examples at https://github.com/uber/mockolo/blob/master/Tests/TestOverloads/OverloadTests.swift - testOverloadInParent, testOverloadInParentAndChild, or any tests that have the mockContent:
parameter; this is used to pass in the file content for the --mockfiles option, and you should be able to see how it's used by stepping through the implementation with a debugger.
thanks @EspressoCup . let me have a try first
For anyone else looking for a solution you have to mock the parent in a separate call to mockolo
, then pass the resulting mock into its subclass/implementor via --mockfiles
/// @mockable
protocol ProtocolB {
func thisIsB()
}
/// @mockable
protocol ProtocolA: ProtocolB {
}
mockolo -srcs "ProtocolB.swift" -d "MockProtocolB.swift"
mockolo -srcs "ProtocolA.swift" --mockfiles "MockProtocolB.swift" -d "Mock ProtocolB.swift"
It works !
It looks fine, so I will close it.
146
@EspressoCup Sorry for disturbing you again.