assertk / Assert / given

given

inline fun given(assertion: (T) -> Unit): Unit

Platform and version requirements: Common

Allows checking the actual value of an assert. This can be used to build your own custom assertions.

fun Assert<Int>.isTen() = given { actual ->
    if (actual == 10) return
    expected("to be 10 but was:${show(actual)}")
}