Added test on suspend conversions

This commit is contained in:
Igor Chevdar
2020-05-13 11:26:09 +05:00
parent 0a3b42d649
commit 2da889ad1a
2 changed files with 33 additions and 0 deletions
+6
View File
@@ -1806,6 +1806,12 @@ task coroutines_functionReference_lambdaAsSuspendLambda(type: KonanLocalTest) {
source = "codegen/coroutines/functionReference_lambdaAsSuspendLambda.kt"
}
standaloneTest('coroutines_suspendConversion') {
goldValue = ""
source = "codegen/coroutines/suspendConversion.kt"
flags = ['-XXLanguage:+SuspendConversion']
}
task AbstractMutableCollection(type: KonanLocalTest) {
expectedExitStatus = 0
source = "runtime/collections/AbstractMutableCollection.kt"
@@ -0,0 +1,27 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
import kotlin.test.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation<Any?> {
companion object : EmptyContinuation()
override fun resumeWith(result: Result<Any?>) { result.getOrThrow() }
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun main() {
var result = 0
val f: () -> Unit = { result = 42 }
builder(f)
assertEquals(42, result)
}