472ec72eb9
1. Move tests to their own module 2. Avoid sharing the 'tinyApp' project between tests 3. Clean up option directive handling
42 lines
708 B
Kotlin
Vendored
42 lines
708 B
Kotlin
Vendored
// ATTACH_LIBRARY: coroutines
|
|
|
|
package soSuspendableCallInEndOfFun
|
|
|
|
import forTests.WaitFinish
|
|
import forTests.builder
|
|
import kotlin.coroutines.Continuation
|
|
import kotlin.coroutines.*
|
|
|
|
private fun foo(a: Any) {}
|
|
|
|
val waiter = WaitFinish()
|
|
val suspendWaiter = WaitFinish()
|
|
|
|
fun main(args: Array<String>) {
|
|
builder {
|
|
inFun()
|
|
}
|
|
|
|
suspendWaiter.finish()
|
|
|
|
foo("Main end")
|
|
waiter.waitEnd()
|
|
}
|
|
|
|
suspend fun inFun() {
|
|
foo("Start")
|
|
//Breakpoint!
|
|
run()
|
|
}
|
|
|
|
suspend fun run() {
|
|
suspendCoroutine { cont: Continuation<Unit> ->
|
|
Thread {
|
|
suspendWaiter.waitEnd()
|
|
cont.resume(Unit)
|
|
waiter.finish()
|
|
}.start()
|
|
}
|
|
}
|
|
|
|
// STEP_OVER: 4 |