[Tests] Migrate backend-independent tests from native to compiler/testData.

^KT-65979
This commit is contained in:
Vladimir Sukharev
2024-02-25 18:25:58 +01:00
committed by Space Team
parent dd9332d9e1
commit febac0dd5f
640 changed files with 68168 additions and 6313 deletions
@@ -0,0 +1,9 @@
MODULE main
CLASS AnonymousObjectKt.class
PACKAGE METADATA
PROPERTY getSb()Ljava/lang/StringBuilder;
Property: class.metadata.property.returnType
K1
java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */
K2
java/lang/StringBuilder
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2019 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.
*/
// JVM_ABI_K1_K2_DIFF: KT-63864
// WITH_STDLIB
import kotlin.test.*
val sb = StringBuilder()
interface I {
fun foo()
}
fun test() {
val impl = object : I {
override fun foo() { sb.append("zzz") }
}
val delegating = object: I by impl { }
delegating.foo()
}
fun box(): String {
test()
assertEquals("zzz", sb.toString())
return "OK"
}
@@ -0,0 +1,5 @@
class Foo(val box: String = "OK")
fun box(): String {
return Foo().box
}
@@ -0,0 +1,18 @@
// WITH_STDLIB
import kotlin.test.*
interface Base { val id: Int }
inline class Child(override val id: Int = 1) : Base
interface Base2 { val prop: Base }
class Child2(override val prop: Child) : Base2
fun box(): String {
val x : Base = Child(5)
assertEquals(5, x.id)
val y : Base2 = Child2(Child(5))
assertEquals("Child(id=5)", y.prop.toString())
return "OK"
}
@@ -0,0 +1,21 @@
// WITH_STDLIB
import kotlin.test.*
interface I {
fun foo(): Int
}
class A : I {
override fun foo() = 42
}
fun main(args: Array<String>) {
lateinit var a: I
if (args.size == 0)
a = A()
assertEquals(42, a.foo())
}
fun box(): String {
main(emptyArray())
return "OK"
}