[K/N][Tests] Adjust moved tests interfaceCallsNCasts..vector to new infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2023-12-16 23:54:04 +01:00
committed by Space Team
parent 93642020ff
commit bb8a7b6795
163 changed files with 841 additions and 672 deletions
+5 -4
View File
@@ -3,14 +3,15 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda1
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
run {
println("lambda")
sb.append("OK")
}
return sb.toString()
}
fun run(f: () -> Unit) {
@@ -1 +0,0 @@
lambda
+11 -4
View File
@@ -3,19 +3,26 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda10
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
var str = "original"
val lambda = {
println(str)
sb.appendLine(str)
}
lambda()
str = "changed"
lambda()
assertEquals("""
original
changed
""".trimIndent(), sb.toString())
return "OK"
}
@@ -1,2 +0,0 @@
original
changed
+12 -5
View File
@@ -3,18 +3,25 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda11
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val first = "first"
val second = "second"
run {
println(first)
println(second)
sb.appendLine(first)
sb.appendLine(second)
}
assertEquals("""
first
second
""".trimIndent(), sb.toString())
return "OK"
}
fun run(f: () -> Unit) {
@@ -1,2 +0,0 @@
first
second
+12 -5
View File
@@ -3,15 +3,22 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda12
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val lambda = { s1: String, s2: String ->
println(s1)
println(s2)
sb.appendLine(s1)
sb.appendLine(s2)
}
lambda("one", "two")
assertEquals("""
one
two
""".trimIndent(), sb.toString())
return "OK"
}
@@ -1,2 +0,0 @@
one
two
+6 -5
View File
@@ -3,14 +3,15 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda13
import kotlin.test.*
@Test fun runTest() {
apply("foo") {
println(this)
val sb = StringBuilder()
fun box(): String {
apply("OK") {
sb.append(this)
}
return sb.toString()
}
fun apply(str: String, block: String.() -> Unit) {
@@ -1 +0,0 @@
foo
+3 -5
View File
@@ -5,19 +5,17 @@
// FILE: 1.kt
package codegen.lambda.lambda14
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
assertEquals(foo()(), "foo1")
assertEquals(foo(0)(), "foo2")
return "OK"
}
fun foo() = { "foo1" }
// FILE: 2.kt
package codegen.lambda.lambda14
fun foo(ignored: Int) = { "foo2" }
+6 -5
View File
@@ -3,17 +3,18 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda2
import kotlin.test.*
@Test fun runTest() {
main(arrayOf("arg0"))
val sb = StringBuilder()
fun box(): String {
main(arrayOf("OK"))
return sb.toString()
}
fun main(args : Array<String>) {
run {
println(args[0])
sb.append(args[0])
}
}
@@ -1 +0,0 @@
arg0
+6 -5
View File
@@ -3,15 +3,16 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda3
import kotlin.test.*
@Test fun runTest() {
var str = "lambda"
val sb = StringBuilder()
fun box(): String {
var str = "OK"
run {
println(str)
sb.append(str)
}
return sb.toString()
}
fun run(f: () -> Unit) {
@@ -1 +0,0 @@
lambda
+15 -5
View File
@@ -3,21 +3,31 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda4
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val lambda = bar()
lambda()
lambda()
assertEquals("""
1
2
3
3
4
""".trimIndent(), sb.toString())
return "OK"
}
fun bar(): () -> Unit {
var x = Integer(0)
val lambda = {
println(x.toString())
sb.appendLine(x.toString())
x = x + 1
}
@@ -26,7 +36,7 @@ fun bar(): () -> Unit {
lambda()
lambda()
println(x.toString())
sb.appendLine(x.toString())
return lambda
}
@@ -1,5 +0,0 @@
1
2
3
3
4
+7 -4
View File
@@ -3,14 +3,17 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda5
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
foo {
println(it)
sb.append(it)
}
assertEquals("42", sb.toString())
return "OK"
}
fun foo(f: (Int) -> Unit) {
@@ -1 +0,0 @@
42
+12 -5
View File
@@ -3,16 +3,23 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda6
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val str = "captured"
foo {
println(it)
println(str)
sb.appendLine(it)
sb.appendLine(str)
}
assertEquals("""
42
captured
""".trimIndent(), sb.toString())
return "OK"
}
fun foo(f: (Int) -> Unit) {
@@ -1,2 +0,0 @@
42
captured
+3 -4
View File
@@ -3,15 +3,14 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda7
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
val x = foo {
it + 1
}
println(x)
assertEquals(43, x)
return "OK"
}
fun foo(f: (Int) -> Int) = f(42)
@@ -1 +0,0 @@
43
+18 -5
View File
@@ -3,11 +3,11 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda8
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val lambda1 = bar("first")
val lambda2 = bar("second")
@@ -15,14 +15,27 @@ import kotlin.test.*
lambda2()
lambda1()
lambda2()
assertEquals("""
first
0
second
0
first
1
second
1
""".trimIndent(), sb.toString())
return "OK"
}
fun bar(str: String): () -> Unit {
var x = Integer(0)
return {
println(str)
println(x.toString())
sb.appendLine(str)
sb.appendLine(x.toString())
x = x + 1
}
}
@@ -1,8 +0,0 @@
first
0
second
0
first
1
second
1
+18 -5
View File
@@ -3,11 +3,11 @@
* that can be found in the LICENSE file.
*/
package codegen.lambda.lambda9
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val lambdas = ArrayList<() -> Unit>()
for (i in 0..1) {
@@ -15,8 +15,8 @@ import kotlin.test.*
val istr = i.toString()
lambdas.add {
println(istr)
println(x.toString())
sb.appendLine(istr)
sb.appendLine(x.toString())
x = x + 1
}
}
@@ -28,6 +28,19 @@ import kotlin.test.*
lambda2()
lambda1()
lambda2()
assertEquals("""
0
0
1
0
0
1
1
1
""".trimIndent(), sb.toString())
return "OK"
}
class Integer(val value: Int) {
@@ -1,8 +0,0 @@
0
0
1
0
0
1
1
1
@@ -5,6 +5,8 @@ import kotlin.coroutines.*
// https://youtrack.jetbrains.com/issue/KT-49360
class Block(val block: () -> Int)
// The Flow code below is taken from kotlinx.coroutines (some unrelated details removed).
interface FlowCollector<in T> {