assertk / assertk / Assert / given

given

(common, jvm) inline fun given(assertion: (T) -> Unit): Unit

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)}")
}