Is any special step should be taken to mock vararg functions?
motorro opened this issue · 2 comments
motorro commented
Hello!
I'm trying to mock the interface with the function that has a vararg
argument. Is there anything special should be done to do it or is it not supported?
The interface I try to mock:
interface ResourceWrapper {
/**
* Returns a resource string
*/
fun getString(resId: StringResource, vararg args: Any): String
}
Generated file:
internal class MockResourceWrapper(
private val mocker: Mocker,
) : ResourceWrapper {
public override fun getString(resId: StringResource, args: Any): String =
this.mocker.register(this, "getString(dev.icerock.moko.resources.StringResource, kotlin.Any)",
resId, args)
}
The overriden function doesn't have a vararg
modifier so I get a compilation error
SalomonBrys commented
Vararg arguments are not supported yet.
I'll work on those for next release 👍
SalomonBrys commented
Fix released in v1.14.0.