Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is any special step should be taken to mock vararg functions? #54

Closed
motorro opened this issue Mar 4, 2023 · 2 comments
Closed

Is any special step should be taken to mock vararg functions? #54

motorro opened this issue Mar 4, 2023 · 2 comments

Comments

@motorro
Copy link

motorro commented Mar 4, 2023

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

@motorro motorro changed the title Is anything special step should be taken to mock vararg functions? Is any special step should be taken to mock vararg functions? Mar 4, 2023
@SalomonBrys
Copy link
Member

Vararg arguments are not supported yet.
I'll work on those for next release 👍

@SalomonBrys
Copy link
Member

Fix released in v1.14.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants