MakeAWishFoundation / SwiftyMocky

Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.03k stars 104 forks source link

[Feature Request] mock actor protocols #317

Open DwayneCoussement opened 2 years ago

DwayneCoussement commented 2 years ago

Hi,

We are using actors that implement a protocol and we ran into a problem while generating mocks.

We have the following protocol

protocol AwesomeProtocol: Actor {
   func test()
}

Notice if we generate mocks now, the generated code will be invalid Swift code:

open class AwesomeProtocolMock: AwesomeProtocol, Mock {
///  code for classes
}

Expected in this case would be:

public actor AwesomeProtocolMock: AwesomeProtocol, Mock {
///  code for actors
}

Would be cool to have these features as well.

Dwayne

choulepoka commented 2 years ago

There is also another use case, if you have a class / method that is annotated with @MainActor, the code gets generated with the annotation, but internal mock code does not support actors, so you get a bunch of errors

vadimkrutovlv commented 1 year ago

Hi,

Any news on this? It would be really great to get Actor protocol supported.