diff --git a/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt b/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt index 92cd69f..b998eeb 100644 --- a/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt +++ b/result4k/kotest/src/main/kotlin/dev/forkhandles/result4k/kotest/matchers.kt @@ -19,11 +19,12 @@ fun beSuccess(): Matcher> = object : Matcher> { } @OptIn(ExperimentalContracts::class) -fun Result.shouldBeSuccess() { +fun Result.shouldBeSuccess(): T { contract { returns() implies (this@shouldBeSuccess is Success<*>) } this should beSuccess() + return (this as Success).value } infix fun Result.shouldBeSuccess(block: (T) -> Unit) {