20 lines
326 B
Kotlin
Vendored
20 lines
326 B
Kotlin
Vendored
fun test(): String {
|
|
var exception: Throwable? = null
|
|
val f = {
|
|
exception = IllegalStateException("OK")
|
|
}
|
|
f()
|
|
|
|
if (exception != null) {
|
|
throw exception!!
|
|
} else {
|
|
return "Fail"
|
|
}
|
|
}
|
|
|
|
fun box(): String = try {
|
|
test()
|
|
} catch (e: IllegalStateException) {
|
|
e.message!!
|
|
}
|