test(KT-47096): add tests for the uncovered behavior.

This commit is contained in:
Artem Kobzar
2021-10-14 14:57:35 +00:00
committed by Space
parent 50ca86838f
commit 99688e5c80
9 changed files with 79 additions and 0 deletions
@@ -0,0 +1,36 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
class TodoItem(var value: String, var completed: Boolean) {
override fun toString(): String {
return "TodoItem(value='$value', completed=$completed)"
}
}
suspend fun getFromApi(): TodoItem {
return TodoItem("Test", false)
}
fun emulateLog(vararg strings: String): String {
return strings[0]
}
fun box(): String {
var stringifiedResult = ""
builder {
stringifiedResult = emulateLog("Result: " + getFromApi())
}
if (stringifiedResult != "Result: TodoItem(value='Test', completed=false)") {
return "Failed: Unexpected result ($stringifiedResult)"
}
return "OK"
}