Minor. Use coroutine test helpers for inline/diagnostics tests
It should help with decreasing test data copy-pasting when testing against release / pre-release coroutines
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
// FILE: test.kt
|
||||
// COMMON_COROUTINES_TEST
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
|
||||
import COROUTINES_PACKAGE.*
|
||||
import helpers.*
|
||||
|
||||
// Block is allowed to be called inside the body of owner inline function
|
||||
// suspend calls possible inside lambda matching to the parameter
|
||||
@@ -13,17 +15,7 @@ suspend inline fun test(c: () -> Unit) {
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(object: Continuation<Unit> {
|
||||
override val context: CoroutineContext
|
||||
get() = EmptyCoroutineContext
|
||||
|
||||
override fun resume(value: Unit) {
|
||||
}
|
||||
|
||||
override fun resumeWithException(exception: Throwable) {
|
||||
throw exception
|
||||
}
|
||||
})
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
inline fun transform(crossinline c: suspend () -> Unit) {
|
||||
@@ -34,6 +26,7 @@ inline fun transform(crossinline c: suspend () -> Unit) {
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
import COROUTINES_PACKAGE.*
|
||||
import helpers.*
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user