[K/N][tests] Migrate link tests to new testing infra ^KT-61259
This commit is contained in:
committed by
Space Team
parent
588549d1d0
commit
d6a922bc74
@@ -0,0 +1,30 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
package zzz
|
||||
|
||||
open class B {
|
||||
val z by lazy { "qzz" }
|
||||
val x = 117
|
||||
val zzz = "zzz"
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import zzz.*
|
||||
import kotlin.test.*
|
||||
|
||||
class C : B() {
|
||||
val a = "qxx"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
assertEquals("qxx", c.a)
|
||||
assertEquals(117, c.x)
|
||||
assertEquals("zzz", c.zzz)
|
||||
assertEquals("qzz", c.z)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
package a
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
public val sb = StringBuilder()
|
||||
|
||||
open class A {
|
||||
open val x = 42
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
val f = 117
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
sb.appendLine(p.name)
|
||||
return f
|
||||
}
|
||||
}
|
||||
|
||||
open class B: A() {
|
||||
override val x: Int by Delegate()
|
||||
|
||||
fun bar() {
|
||||
sb.appendLine(super<A>.x)
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import a.*
|
||||
import kotlin.test.*
|
||||
|
||||
open class C: B() {
|
||||
override val x: Int = 156
|
||||
|
||||
fun foo() {
|
||||
sb.appendLine(x)
|
||||
|
||||
sb.appendLine(super<B>.x)
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
c.foo()
|
||||
|
||||
assertEquals("""
|
||||
156
|
||||
x
|
||||
117
|
||||
42
|
||||
|
||||
""".trimIndent(), sb.toString())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user