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

dev.mokkery.plugin.core.MokkeryConfigApi.kt Maven / Gradle / Ivy

Go to download

Mokkery is a mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.

The newest version!
package dev.mokkery.plugin.core

import dev.mokkery.MockMode
import dev.mokkery.plugin.ALLOW_INDIRECT_SUPER_CALLS
import dev.mokkery.plugin.IGNORE_FINAL_MEMBERS
import dev.mokkery.plugin.IGNORE_INLINE_MEMBERS
import dev.mokkery.plugin.MOCK_MODE_KEY
import dev.mokkery.plugin.VERIFY_MODE_KEY
import dev.mokkery.verify.VerifyMode
import org.jetbrains.kotlin.config.CompilerConfiguration

val TransformerScope.mockMode: MockMode get() = compilerConfig.get(MOCK_MODE_KEY)!!.single()
val TransformerScope.verifyMode: VerifyMode get() = compilerConfig.get(VERIFY_MODE_KEY)!!.single()
val TransformerScope.allowIndirectSuperCalls: Boolean get() = compilerConfig.get(ALLOW_INDIRECT_SUPER_CALLS)!!.single()
val CompilerConfiguration.validationMode: MembersValidationMode get() =  when {
    get(IGNORE_FINAL_MEMBERS)?.singleOrNull() == true -> MembersValidationMode.IgnoreFinal
    get(IGNORE_INLINE_MEMBERS)?.singleOrNull() == true -> MembersValidationMode.IgnoreInline
    else -> MembersValidationMode.Strict
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy