You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ModuleB
/// @CreateMock
public protocol Bar {
func foo(text: String)
}
// Module C
import ModuleA
import ModuleB
/// @CreateMock
public protocol FooBar: Foo, Bar {}
Generated Mock
public class FooBarMock: FooBar {
public init() { }
public var fooCallCount = 0
public var fooHandler: ((Int) -> ())?
public func foo(num: Int) {
mockFunc(&fooCallCount)("foo", fooHandler?(num), .void)
}
public func foo(text: String) {
mockFunc(&fooCallCount)("foo", fooHandler?(text), .void) // error found here because fooHandler expects an Int, not a string
}
}
Error
error: cannot convert value of type 'String' to expected argument type 'Int'
mockFunc(&fooCallCount)("foo", fooHandler?(text), .void)
The text was updated successfully, but these errors were encountered:
I have exactly the same issue.
A potential solution could be adding a prefix or suffix to the generated mock using something like: /// @mockable(method: postfix = Foo)
Environment
macOS 13.4.1
Swift version 5.8.1
Xcode 14.3.1
v2.0.1
Issue
The following code produces a mock that does not compile successfully
Protocols to Mock
Generated Mock
Error
The text was updated successfully, but these errors were encountered: