Git Product home page Git Product logo

Comments (10)

oleksiyp avatar oleksiyp commented on May 14, 2024 1

In version 1.8 it should be fixed. Please check

from mockk.

oleksiyp avatar oleksiyp commented on May 14, 2024

Look like issue is appearing when using interface or abstract class. When using simple class it is passing:

    class Foo {
        fun foo(vararg args: String, otherArg: String) {

        }
        fun foo(args: List<String>, otherArg: String) {
            
        }
    }

I've checked underlying reflection call and seems Kotlin is just not returning correct value. So it is a Kotlin reflection API bug

from mockk.

oleksiyp avatar oleksiyp commented on May 14, 2024

After additional checking, it appears that pure interface is working. So it is related to metadata propagation i.e. while using interface MockK needs to create a proxy subclass and Kotlin metadata is not copied to that subclass.

from mockk.

oleksiyp avatar oleksiyp commented on May 14, 2024

So yes this because of subclassing. issue52 branch fixes it but makes builds 25% slower. This is something to solve additionally.

from mockk.

gildor avatar gildor commented on May 14, 2024

@oleksiyp I cannot verify vararg, method with vararg always fail verification (except verify(exactly = 0), just because of it never called)
Can you confirm, that this is related to this issue or I do something wrong?

from mockk.

oleksiyp avatar oleksiyp commented on May 14, 2024

Very probable that this is related.
Fix/workaround is making MockK slow, so it was not merged.
Some caching to be applied.
Or maybe other ways to fix it.

Right now(one/two weeks) I'm quite free for doing MockK improvements/fixes but focused on Android instrumentation test which is a big feature. Will get back to such not very big things after releasing it.

I desperately need good co-author :-)

from mockk.

oleksiyp avatar oleksiyp commented on May 14, 2024

Seems it was fixed, reopen if it is not

from mockk.

darrenhaken avatar darrenhaken commented on May 14, 2024

What's the fix for this @oleksiyp ? I'm using 1.9 and having trouble mocking a varargs.

from mockk.

oleksiyp avatar oleksiyp commented on May 14, 2024

In version 1.8 it should be fixed. Please check

Please report as a new bug

from mockk.

darrenhaken avatar darrenhaken commented on May 14, 2024

@oleksiyp new issue opened at #224

from mockk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.