All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.mockk.InternalPlatformDsl.kt Maven / Gradle / Ivy

There is a newer version: 1.13.13
Show newest version
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