Minor. Split tests with buildSequence into LV 1.2 and LV 1.3 versions

This commit is contained in:
Ilmir Usmanov
2018-09-17 17:06:48 +03:00
parent 50deac7a26
commit c4038729ea
9 changed files with 117 additions and 40 deletions
@@ -0,0 +1,48 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.2
import helpers.*
import kotlin.coroutines.experimental.*
enum class Foo(vararg expected: String) {
A("start", "A", "end"),
B("start", "BCD", "end"),
C("start", "BCD", "end"),
D("start", "BCD", "end"),
E("start", "E", "end"),
F("start", "end");
val expected = expected.toList()
}
fun box(): String {
for (c in Foo.values()) {
val actual = getSequence(c).toList()
if (actual != c.expected) {
return "FAIL: -- ${c.expected} != $actual"
}
}
return "OK"
}
fun getSequence(a: Foo) =
buildSequence {
yield("start")
when (a) {
Foo.A -> {
yield("A")
}
Foo.B,
Foo.C,
Foo.D-> {
yield("BCD")
}
Foo.E-> {
yield("E")
}
}
yield("end")
}
@@ -2,9 +2,9 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
// LANGUAGE_VERSION: 1.3
import helpers.*
import COROUTINES_PACKAGE.*
import kotlin.coroutines.*
enum class Foo(vararg expected: String) {
A("start", "A", "end"),
@@ -0,0 +1,19 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.2
import helpers.*
import kotlin.coroutines.experimental.*
val f = run {
buildSequence {
if (true) {
yield("OK")
}
}.toList()
}
fun box(): String {
return f[0]
}
@@ -2,9 +2,9 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
// LANGUAGE_VERSION: 1.3
import helpers.*
import COROUTINES_PACKAGE.*
import kotlin.coroutines.*
val f = run {
sequence {