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
Mockingbird site advertises the library as if it supports the Protocols with generic type here https://mockingbirdswift.com/feature-comparison but in reality, it fails for simplest generic protocol.
Example
protocol Mapper{
associatedtype I
associatedtype O
func map(i: I) -> O
}
Generated code
private let mkbGenericStaticMockContext = Mockingbird.GenericStaticMockContext()
// MARK: - Mocked Mapper
public final class MapperMock<I, O>: Mappa.Mapper, Mockingbird.Mock {
typealias MockingbirdSupertype = Mappa.Mapper
public static var mockingbirdContext: Mockingbird.Context { return mkbGenericStaticMockContext.resolve(["MapperMock<I, O>", Swift.ObjectIdentifier(I.self).debugDescription, Swift.ObjectIdentifier(O.self).debugDescription]) }
public let mockingbirdContext = Mockingbird.Context(["generator_version": "0.20.0", "module_name": "Mappa"])
fileprivate init(sourceLocation: Mockingbird.SourceLocation) {
self.mockingbirdContext.sourceLocation = sourceLocation
MapperMock.mockingbirdContext.sourceLocation = sourceLocation
}
// MARK: Mocked `map`(`i`: I)
public func `map`(`i`: I) -> O {
return self.mockingbirdContext.mocking.didInvoke(Mockingbird.SwiftInvocation(selectorName: "`map`(`i`: I) -> O", selectorType: Mockingbird.SelectorType.method, arguments: [Mockingbird.ArgumentMatcher(`i`)], returnType: Swift.ObjectIdentifier((O).self))) {
self.mockingbirdContext.recordInvocation($0)
let mkbImpl = self.mockingbirdContext.stubbing.implementation(for: $0)
if let mkbImpl = mkbImpl as? (I) -> O { return mkbImpl(`i`) }
if let mkbImpl = mkbImpl as? () -> O { return mkbImpl() }
for mkbTargetBox in self.mockingbirdContext.proxy.targets(for: $0) {
switch mkbTargetBox.target {
case .super:
break
case .object:
break
}
}
if let mkbValue = self.mockingbirdContext.stubbing.defaultValueProvider.value.provideValue(for: (O).self) { return mkbValue }
self.mockingbirdContext.stubbing.failTest(for: $0, at: self.mockingbirdContext.sourceLocation)
}
}
public func `map`(`i`: @autoclosure () -> I) -> Mockingbird.Mockable<Mockingbird.FunctionDeclaration, (I) -> O, O> {
return Mockingbird.Mockable<Mockingbird.FunctionDeclaration, (I) -> O, O>(context: self.mockingbirdContext, invocation: Mockingbird.SwiftInvocation(selectorName: "`map`(`i`: I) -> O", selectorType: Mockingbird.SelectorType.method, arguments: [Mockingbird.resolve(`i`)], returnType: Swift.ObjectIdentifier((O).self)))
}
}
public enum Mapper<I, O> {
}
/// Returns a concrete mock of `Mapper`.
public func mock<I, O>(_ type: Mapper<I, O>.Type, file: StaticString = #file, line: UInt = #line) -> MapperMock<I, O> {
return MapperMock<I, O>(sourceLocation: Mockingbird.SourceLocation(file, line))
}
Error
Type 'MapperMock<I, O>' does not conform to protocol 'Mapper'
Environment
Mockingbird version: 0.20.0
Xcode and Swift version: 14.0.1 and 5.7
Package manager: CocoaPods
Unit testing framework: XCTest
The text was updated successfully, but these errors were encountered:
Overview
Mockingbird site advertises the library as if it supports the Protocols with generic type here https://mockingbirdswift.com/feature-comparison but in reality, it fails for simplest generic protocol.
Example
Generated code
Error
Environment
The text was updated successfully, but these errors were encountered: