kosi-libs / MocKMP

A mocking processor for Kotlin Multiplatform
https://kosi-libs.org/mockmp
MIT License
183 stars 12 forks source link

How to mock a method defined as expect #72

Closed jorgezim closed 7 months ago

jorgezim commented 9 months ago

Hello, first thanks for this great library.

In my project I have a expect method call logDebug which is defined inside the Platform file and is has an implementation on. the Android side and on the IOS Side. When this method is used inside of the classes I am testing I get a -> Method d in android.util.Log not mocked (running the test on Android)

I wonder if there's a way to mock expect/actual methods and how do it?

Thanks!

SalomonBrys commented 7 months ago

There is none. At the moment, KSP does not support multiplatform well (which is why we have to resort to the JVM sourceset trick). Support of expect/actual is tracked by #18 and might become possible with KSP 2.0, when it relases.