Check number of suspensions in crossinline tests
This commit is contained in:
+7
-14
@@ -15,12 +15,15 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
|
||||
val o1 = object: SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
c()
|
||||
}
|
||||
}
|
||||
o1.run()
|
||||
o1.run()
|
||||
}
|
||||
}
|
||||
o.run()
|
||||
o.run()
|
||||
}
|
||||
|
||||
// FILE: inlineSite.kt
|
||||
@@ -31,26 +34,16 @@ 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 {
|
||||
builder {
|
||||
crossinlineMe {
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
suspendHere()
|
||||
StateMachineChecker.suspendHere()
|
||||
StateMachineChecker.suspendHere()
|
||||
}
|
||||
}
|
||||
if (i != 1) return "FAIL $i"
|
||||
StateMachineChecker.check(numberOfSuspensions = 16)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user