Check number of suspensions in crossinline tests
This commit is contained in:
+11
-14
@@ -12,8 +12,10 @@ interface SuspendRunnable {
|
||||
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
|
||||
val l: suspend () -> Unit = {
|
||||
c()
|
||||
c()
|
||||
}
|
||||
l()
|
||||
l()
|
||||
}
|
||||
|
||||
// FILE: inlineSite.kt
|
||||
@@ -24,14 +26,7 @@ import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
|
||||
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
|
||||
i++
|
||||
COROUTINE_SUSPENDED
|
||||
c.startCoroutine(CheckStateMachineContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
@@ -45,26 +40,28 @@ fun box(): String {
|
||||
val l : suspend () -> Unit = {
|
||||
val sr = object: SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
StateMachineChecker.suspendHere()
|
||||
StateMachineChecker.suspendHere()
|
||||
}
|
||||
}
|
||||
sr.run()
|
||||
sr.run()
|
||||
}
|
||||
l()
|
||||
l()
|
||||
}
|
||||
}
|
||||
sr.run()
|
||||
sr.run()
|
||||
}
|
||||
l()
|
||||
l()
|
||||
}
|
||||
}
|
||||
sr.run()
|
||||
sr.run()
|
||||
}
|
||||
}
|
||||
if (i != 1) return "FAIL $i"
|
||||
StateMachineChecker.check(numberOfSuspensions = 256)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user