commonMain.KlipManager.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of klip-core Show documentation
Show all versions of klip-core Show documentation
Kotlin Multiplatform test snapshots (klips) manager
package dev.petuska.klip.core
import dev.petuska.klip.api.KlipContext
import dev.petuska.klip.core.domain.Klip
import kotlin.reflect.KType
internal expect object KlipManager {
suspend fun writeKlip(context: KlipContext, klip: Klip)
suspend fun readKlip(context: KlipContext, type: KType): Klip?
}
public suspend fun KlipContext.syncKlip(actual: Klip): Klip {
return if (update) {
actual.also {
KlipManager.writeKlip(this, it)
}
} else {
KlipManager.readKlip(this, actual.type) ?: actual.also {
KlipManager.writeKlip(this, it)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy