BC native tests port to Konan's TestRunner

This commit is contained in:
Pavel Punegov
2017-10-11 15:09:33 +03:00
parent 9b07fd61ce
commit 9d077d7f4f
352 changed files with 1798 additions and 384 deletions
@@ -1,3 +1,5 @@
package codegen.`object`.constructor
class A()
class B(val a:Int)
@@ -1,3 +1,7 @@
package codegen.`object`.constructor0
import kotlin.test.*
class A {
var field0:Int = 0;
constructor(arg0:Int) {
@@ -1,3 +1,7 @@
package codegen.`object`.fields
import kotlin.test.*
private var globalValue = 1
var global:Int
get() = globalValue
@@ -9,7 +13,7 @@ fun globalTest(i:Int):Int {
}
fun main(args:Array<String>) {
@Test fun runTest() {
if (global != 1) throw Error()
if (globalTest(41) != 42) throw Error()
if (global != 42) throw Error()
@@ -1,3 +1,7 @@
package codegen.`object`.fields1
import kotlin.test.*
class B(val a:Int, b:Int) {
constructor(pos:Int):this(1, pos) {}
val pos = b + 1
@@ -7,7 +11,7 @@ fun primaryConstructorCall(a:Int, b:Int) = B(a, b).pos
fun secondaryConstructorCall(a:Int) = B(a).pos
fun main(args:Array<String>) {
@Test fun runTest() {
if (primaryConstructorCall(0xdeadbeef.toInt(), 41) != 42) throw Error()
if (secondaryConstructorCall(41) != 42) throw Error()
}
@@ -1,3 +1,7 @@
package codegen.`object`.fields2
import kotlin.test.*
var global: Int = 0
get() {
println("Get global = $field")
@@ -8,7 +12,7 @@ var global: Int = 0
field = value
}
class Test {
class TestClass {
var member: Int = 0
get() {
println("Get member = $field")
@@ -20,10 +24,10 @@ class Test {
}
}
fun main(args:Array<String>) {
@Test fun runTest() {
global = 1
val test = Test()
val test = TestClass()
test.member = 42
global = test.member
@@ -1,3 +1,7 @@
package codegen.`object`.init0
import kotlin.test.*
class A(a:Int) {
var i:Int = 0
init {
@@ -1,3 +1,7 @@
package codegen.`object`.initialization
import kotlin.test.*
open class A(val a:Int, val b:Int)
open class B(val c:Int, d:Int):A(c, d)
@@ -19,6 +23,6 @@ fun foo(i:Int, j:Int):Int {
return c.c
}
fun main(args:Array<String>) {
@Test fun runTest() {
if (foo(2, 3) != 5) throw Error()
}
@@ -1,4 +1,8 @@
class Test {
package codegen.`object`.initialization1
import kotlin.test.*
class TestClass {
constructor() {
println("constructor1")
}
@@ -14,7 +18,7 @@ class Test {
val f = println("field")
}
fun main(args: Array<String>) {
Test()
Test(1)
@Test fun runTest() {
TestClass()
TestClass(1)
}
@@ -1,9 +1,13 @@
package codegen.`object`.method_call
import kotlin.test.*
class A(val a:Int) {
fun foo(i:Int) = a + i
}
fun fortyTwo() = A(41).foo(1)
fun main(args:Array<String>) {
@Test fun runTest() {
if (fortyTwo() != 42) throw Error()
}