Minor. Split tests with buildSequence into LV 1.2 and LV 1.3 versions
This commit is contained in:
@@ -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
-2
@@ -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"),
|
||||
+19
@@ -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
-2
@@ -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 {
|
||||
Reference in New Issue
Block a user