Closed juyan closed 6 months ago
Hey there, @juyan. Does excluding the MiddleProtocol
on its own do what you need? I'm not against adding support for this case, but I'd refrain from adding more CLI flags if possible.
@MatyasKriz sorry there was something wrong in my example and I fixed it. Please take a look again, hope it makes more sense now.
Hey, in Cuckoo 2.0 the regex exclusion is applied after inheritance is resolved, so it is possible to do the thing you're proposing here. 🙂 Thanks for the issue!
Overview
It looks like the generated mock file will contain mocks for inherited protocols by design. Can we improve the generator to exclude them? Or is there a way to do this that I'm unaware of.
Example
Swift Package "Base":
Swift Package "Middle":
Now run the generator using the following command:
We would get both
MockMiddleProtocol
andMockBaseProtocol
inside the fileMiddleTestMocks.swift
.Expected Behavior
Using the above example, I'm looking for a way to not contain
MockBaseProtocol
insideBaseMiddleMocks
. This can probably be configurable via a new command line argument likesupportGlob
. It indicates the file necessary to generate the correct mocks that contains parent methods but does not generate mock for parent protocols themselves.Looking forward to see other's thoughts. Thanks.