Added link test, checking correct object field layout.

This commit is contained in:
Igor Chevdar
2017-02-28 15:05:30 +03:00
parent f534616e19
commit 889b28ee87
4 changed files with 61 additions and 1 deletions
+7
View File
@@ -613,6 +613,13 @@ task delegatedProperty_local(type: RunKonanTest) {
source = "codegen/delegatedProperty/local.kt"
}
task delegatedProperty_delegatedOverride(type: LinkKonanTest) {
goldValue = "156\nx\n117\n42\n"
source = "codegen/delegatedProperty/delegatedOverride_main.kt"
lib = "codegen/delegatedProperty/delegatedOverride_lib.kt"
}
task array0(type: RunKonanTest) {
goldValue = "5\n6\n7\n8\n9\n10\n11\n12\n13\n"
source = "runtime/collections/array0.kt"
@@ -0,0 +1,23 @@
package a
import kotlin.reflect.KProperty
open class A {
open val x = 42
}
class Delegate {
val f = 117
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
println(p.name)
return f
}
}
open class B: A() {
override val x: Int by Delegate()
fun bar() {
println(super<A>.x)
}
}
@@ -0,0 +1,17 @@
import a.*
open class C: B() {
override val x: Int = 156
fun foo() {
println(x)
println(super<B>.x)
bar()
}
}
fun main(args: Array<String>) {
val c = C()
c.foo()
}
@@ -186,7 +186,7 @@ class RunInteropKonanTest extends KonanTest {
}
@ParallelizableTask
class LinkKonanTest extends KonanTest {
class LinkKonanTestNoStdlib extends KonanTest {
protected String lib
void compileTest(List<String> filesToCompile, String exe) {
@@ -198,6 +198,19 @@ class LinkKonanTest extends KonanTest {
}
}
@ParallelizableTask
class LinkKonanTest extends KonanTest {
protected String lib
void compileTest(List<String> filesToCompile, String exe) {
def libDir = project.file(lib).absolutePath
def libBc = "${libDir}.bc"
runCompiler(lib, libBc, ['-nolink'])
runCompiler(filesToCompile, exe, ['-library', libBc])
}
}
@ParallelizableTask
class RunExternalTestGroup extends RunKonanTest {