I'm trying to get the name that a function was defined with
fun aFunction() = Unit
fun functionName(function: () -> Unit) : String {
val functionAsKFunction: KFunction<Unit> = someMiracle(function)
return functionAsKFunction.name
}
assertEquals("aFunction", functionName(::aFunction))
Aucun commentaire:
Enregistrer un commentaire