kotest-core / io.kotest.core.spec / autoClose

autoClose

fun <T : AutoCloseable> TestConfiguration.autoClose(closeable: T): T

Closes an AutoCloseable when the spec is completed by registering an afterSpec listener which invokes the AutoCloseable.close method.

fun <T : AutoCloseable> TestConfiguration.autoClose(closeable: Lazy<T>): Lazy<T>

Closes a lazy AutoCloseable when the spec is completed by registering an afterSpec listener which invokes the AutoCloseable.close method.