Comments (3)
Hi @nagarro-vijaykumar04,
Thanks for raising an issue!
So basically we have
protocol A {
func protocolAMethod()
}
then we have
protocol B {
func protocolBMethod()
}
and we want to have mock that conforms to both protocols.
Have you tried with typealias?
typealias ProtocolAB = A & B
or new protocol instead?
protocol ProtocolAB: A, B {}
- i didn't tried it out*
i will play with this case latter and let you know
from swiftymocky.
Hi,
Thanks for your swiftly reply!
The scenario mentioned above is same as your last point i.e.:
protocol ProtocolAB: A, B {}
As protocol ProtocolAB
doesn't have the methods of protocols A
& B
as its own definition, while creating mocks for it compiler says, ProtocolABMock
doesn't confirm with protocol A
& protocol B
from swiftymocky.
Hi, I just verified and inheritance seems to work. Added new test to SwiftyMocky, to verify inheritance case for version 1.02 +.
Our test looks like that:
//sourcery: AutoMockable
protocol SimpleProtocolWithMethods {
func simpleMethod()
func simpleMehtodThatReturns() -> Int
func simpleMehtodThatReturns(param: String) -> String
func simpleMehtodThatReturns(optionalParam: String?) -> String?
}
//sourcery: AutoMockable
protocol SimpleProtocolWithProperties {
var property: String { get set }
weak var weakProperty: AnyObject! { get set }
var propertyGetOnly: String { get }
var propertyOptional: Int? { get set }
var propertyImplicit: Int! { get set }
}
//sourcery: AutoMockable
protocol SimpleProtocolThatInheritsOtherProtocols: SimpleProtocolWithMethods, SimpleProtocolWithProperties {
}
Generated mock SimpleProtocolThatInheritsOtherProtocolsMock
adopts both protocols, and seems to be working fine.
It seems that your problem is not related to protocol inheritance. Anyway - if you could, please provide actual A,B and ProtocolAB code that is breaking generation for you, then I will be able to reopen it and fix the issue. You can reach me on SwiftyMocky slack, if you don't want to post your code here
I'm closing it for now.
from swiftymocky.
Related Issues (20)
- Compilation Performance Issues HOT 2
- Mock generation failure for Swift Package when using actor objects in package HOT 3
- Feature Request: View controller and view mocking support.
- Missing parenthesis optional existential type (any ProtocolName) properties
- Mock a protocol in an SPM dependency framework.
- Feature request: Allow partial mocks for testable subclasses
- Stubber with factory behavior
- Invalid redeclaration error in .generated file while using tuples with typealias
- Can't Download CLI tool
- generate command fails on xcode cloud HOT 1
- Use XCTestDynamicOverlay
- _InternalSwiftSyntaxParser is missing again HOT 2
- Issue with ShellOut dependency with SPM HOT 1
- How to add generated file with swiftlint rules in version 4.2.0 with new Mockfile format HOT 1
- There is no fallback data, if no 'Given` method provided. HOT 1
- How to include swift package file in mockfile
- cannot decode object of class (SwiftActor) for key (NS.objects) because no class named "SwiftActor" was found HOT 2
- outdated Sourcery version (1.8.0) doesn't build on macos ventura (apple silicon)
- Conflict with swift-openapi-generator
- Mocked return value is different for different cases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftymocky.