bamboo
07/19/2016, 4:25 PMimport groovy.lang.Closure
fun <Delegate : Any> closure(action: Delegate.() -> Any): Closure<Any> =
KotlinClosure(action)
class KotlinClosure<in T : Any, V : Any>(val function: T.() -> V) : Closure<V>(null, null) {
fun doCall(it: T): V =
it.function()
}
which should allow you to write something like:
unitTests.all(closure<Test> {
if (name == ‘testDebug’) {
// …
}
})