Add test case to check delegation of suspend method

This commit is contained in:
Roman Artemev
2018-05-21 00:11:54 +03:00
committed by Roman Artemev
parent f826a253e3
commit 8862b26bbd
5 changed files with 73 additions and 0 deletions
@@ -0,0 +1,31 @@
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "fail"
interface SuspendInterface {
suspend fun foo(v: String)
}
class Delegate : SuspendInterface {
override suspend fun foo(v: String) {
result = v
}
}
class Decorator(parent: SuspendInterface) : SuspendInterface by parent
fun execute(c: suspend () -> Unit) = c.startCoroutine(EmptyContinuation)
fun box(): String {
execute {
Decorator(Delegate()).foo("OK")
}
return result
}