commonMain.io.mockk.InternalPlatformDsl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockk-dsl-jvm Show documentation
Show all versions of mockk-dsl-jvm Show documentation
Java MockK DSL providing API for MockK implementation
package io.mockk
import kotlin.coroutines.Continuation
import kotlin.reflect.KClass
expect object InternalPlatformDsl {
fun identityHashCode(obj: Any): Int
fun runCoroutine(block: suspend () -> T): T
fun Any?.toStr(): String
fun deepEquals(obj1: Any?, obj2: Any?): Boolean
fun unboxChar(value: Any): Any
fun Any.toArray(): Array<*>
fun classForName(name: String): Any
fun dynamicCall(
self: Any,
methodName: String,
args: Array,
anyContinuationGen: () -> Continuation<*>
): Any?
fun dynamicGet(self: Any, name: String): Any?
fun dynamicSet(self: Any, name: String, value: Any?)
fun dynamicSetField(self: Any, name: String, value: Any?)
fun threadLocal(initializer: () -> T): InternalRef
fun counter(): InternalCounter
fun coroutineCall(lambda: suspend () -> T): CoroutineCall
/**
* Normally this simply casts [arg] to `T`
*
* However, if `T` is a `value class` (of type [cls]) this will construct a new instance of the
* value class, and set [arg] as the value.
*/
internal fun boxCast(
cls: KClass<*>,
arg: Any,
): T
}
interface CoroutineCall {
fun callWithContinuation(continuation: Continuation<*>): T
}
interface InternalRef {
val value: T
}
interface InternalCounter {
val value: Long
fun increment(): Long
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy