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

commonMain.com.zegreatrob.testmints.StandardMintDispatcher.kt Maven / Gradle / Ivy

There is a newer version: 12.1.30
Show newest version
package com.zegreatrob.testmints

import com.zegreatrob.testmints.report.ReporterProvider

interface StandardMintDispatcher : ReporterProvider {

    val setup get() = TestTemplate(this) { it(Unit) }

    fun  testTemplate(wrapper: (TestFunc) -> Unit): TestTemplate = TestTemplate(this, wrapper)

    fun  testTemplate(sharedSetup: () -> SC, sharedTeardown: (SC) -> Unit = {}) = testTemplate { test ->
        sharedSetup()
            .also(test)
            .also(sharedTeardown)
    }

    fun  testTemplate(beforeAll: () -> SC): TestTemplate {
        val lazy by lazy { beforeAll() }
        return testTemplate(wrapper = { it(lazy) })
    }

    fun testTemplateSimple(wrapper: (() -> Unit) -> Unit): TestTemplate =
        testTemplate(wrapper = { wrapper { it(Unit) } })
}

typealias ExerciseFunc = C.() -> R
typealias VerifyFunc = C.(R) -> Any
typealias TeardownFunc = C.(R) -> Unit




© 2015 - 2024 Weber Informatics LLC | Privacy Policy