Sorry for bringing this up again, but I also have ...
# coroutines
d
Sorry for bringing this up again, but I also have a hard time wrapping my head around
UnconfinedTestDispatcher
. E.g. when I do this
Copy code
runBlocking(UnconfinedTestDispatcher()) {
    println("first: " + System.currentTimeMillis())
    delay(2000)
    println("second: " + System.currentTimeMillis())
}
in a scratch file, the thing blocks forever and is aborted after 30s, if I replace
runBlocking
with
runTest
it does what it should, i.e. skip the delay. If I wrap the dispatcher in a
TestScope
and `async`/`await` the above block in a
runBlocking
, I again get a 30s timeout. This signals me somehow that this dispatcher is useless for production code, but really can / should only be used in the
runTest
block. I used
TestScope(UnconfinedTestDispatcher())
as coroutine scope and my delays in the prod code are not skipped. I feel I must do something fundamentally wrong.