[utils] Introduce the bind function and use it throughout

This commit is contained in:
Sergej Jaskiewicz
2023-11-22 14:37:09 +01:00
committed by Space Team
parent 93563d7c80
commit f844a86057
24 changed files with 31 additions and 43 deletions
@@ -20,8 +20,6 @@ typealias Constructor<R> = (TestServices) -> R
typealias Constructor2<T, R> = (TestServices, T) -> R
typealias Constructor3<T1, T2, R> = (TestServices, T1, T2) -> R
abstract class TestConfiguration {
abstract val rootDisposable: Disposable
@@ -48,14 +46,6 @@ abstract class TestConfiguration {
// ---------------------------- Utils ----------------------------
fun <T, R> Constructor2<T, R>.bind(value: T): Constructor<R> {
return { this.invoke(it, value) }
}
fun <T1, T2, R> Constructor3<T1, T2, R>.bind(value1: T1, value2: T2): Constructor<R> {
return { this.invoke(it, value1, value2) }
}
fun <R> (() -> R).coerce(): Constructor<R> {
return { this.invoke() }
}
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.test
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.utils.bind
sealed class TestStepBuilder<InputArtifact, OutputArtifact>
where InputArtifact : ResultingArtifact<InputArtifact>,