Files
kotlin-fork/js/js.translator/testData/box/main/suspendMainThrows.kt
T
Roman Artemev e242a8b08b Unmute tests
2018-09-17 15:29:19 +03:00

29 lines
424 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1299
// CALL_MAIN
import kotlin.coroutines.*
var callback: () -> Unit = {}
val exception = Exception()
suspend fun main() {
suspendCoroutine<Unit> { cont ->
callback = {
cont.resume(Unit)
}
}
throw exception
}
fun box(): String {
try {
callback()
} catch (e: Exception) {
assertTrue(e === exception)
}
return "OK"
}