blob: 2072a9182b54078b089d915ab400e3816e49aaff [file] [log] [blame]
package kotlinx.coroutines.experimental
import org.junit.Test
class CoroutineExceptionHandlerTest : TestBase() {
@Test
fun testCoroutineExceptionHandlerCreator() = runBlocking {
expect(1)
var coroutineException: Throwable? = null
val handler = CoroutineExceptionHandler { _, ex ->
coroutineException = ex
expect(3)
}
val job = launch(CommonPool + handler) {
throw TestException()
}
expect(2)
job.join()
finish(4)
check(coroutineException is TestException)
}
}
private class TestException: RuntimeException()