diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 5cb5c542009..9b79082d0fb 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -252,6 +252,18 @@ task sum2(type: RunKonanTest) { source = "codegen/function/sum_imm.kt" } +task sum_func(type: RunKonanTest) { + source = "codegen/function/sum_func.kt" +} + +task sum_mixed(type: RunKonanTest) { + source = "codegen/function/sum_mixed.kt" +} + +task sum_illy(type: RunKonanTest) { + source = "codegen/function/sum_silly.kt" +} + task function_defaults(type: RunKonanTest) { source = "codegen/function/defaults.kt" } @@ -1173,6 +1185,10 @@ task cycle_do(type: RunKonanTest) { source = "codegen/cycles/cycle_do.kt" } +task cycle_for(type: RunKonanTest) { + source = "codegen/cycles/cycle_for.kt" +} + task abstract_super(type: RunKonanTest) { source = "datagen/rtti/abstract_super.kt" } @@ -1774,11 +1790,24 @@ task memory_throw_cleanup(type: RunKonanTest) { source = "runtime/memory/throw_cleanup.kt" } +task memory_escape0(type: RunKonanTest) { + source = "runtime/memory/escape1.kt" +} + task memory_escape1(type: RunKonanTest) { goldValue = "zzz\n" source = "runtime/memory/escape1.kt" } +task memory_cycles0(type: RunKonanTest) { + goldValue = "42\n" + source = "runtime/memory/cycles0.kt" +} + +task memory_basic0(type: RunKonanTest) { + source = "runtime/memory/cycles0.kt" +} + task memory_escape2(type: RunKonanTest) { goldValue = "zzz\n" source = "runtime/memory/escape2.kt" diff --git a/backend.native/tests/codegen/basics/array_to_any.kt b/backend.native/tests/codegen/basics/array_to_any.kt index e56ab313351..2d1df1c99bc 100644 --- a/backend.native/tests/codegen/basics/array_to_any.kt +++ b/backend.native/tests/codegen/basics/array_to_any.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.array_to_any + +import kotlin.test.* + +@Test +fun runTest() { foo().hashCode() } diff --git a/backend.native/tests/codegen/basics/canonical_name.kt b/backend.native/tests/codegen/basics/canonical_name.kt index 95afe1d11b3..3f8d94b250f 100644 --- a/backend.native/tests/codegen/basics/canonical_name.kt +++ b/backend.native/tests/codegen/basics/canonical_name.kt @@ -1,3 +1,7 @@ +package codegen.basics.canonical_name + +import kotlin.test.* + interface I { fun foo(a: U): T fun qux(a: T): U @@ -24,10 +28,7 @@ fun baz(i: I, u: U, v:V) { //-----------------------------------------------------------------------------// -fun main(args: Array) { +@Test +fun runTest() { baz(A(), A1(), A2()) -} - - - - +} \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/cast_null.kt b/backend.native/tests/codegen/basics/cast_null.kt index cb76a559f78..f84bfc94c33 100644 --- a/backend.native/tests/codegen/basics/cast_null.kt +++ b/backend.native/tests/codegen/basics/cast_null.kt @@ -1,15 +1,20 @@ -fun main(args: Array) { +package codegen.basics.cast_null + +import kotlin.test.* + +@Test +fun runTest() { testCast(null, false) testCastToNullable(null, true) - testCastToNullable(Test(), true) + testCastToNullable(TestKlass(), true) testCastToNullable("", false) - testCastNotNullableToNullable(Test(), true) + testCastNotNullableToNullable(TestKlass(), true) testCastNotNullableToNullable("", false) println("Ok") } -class Test +class TestKlass fun ensure(b: Boolean) { if (!b) { @@ -19,7 +24,7 @@ fun ensure(b: Boolean) { fun testCast(x: Any?, expectSuccess: Boolean) { try { - x as Test + x as TestKlass } catch (e: Throwable) { ensure(!expectSuccess) return @@ -29,7 +34,7 @@ fun testCast(x: Any?, expectSuccess: Boolean) { fun testCastToNullable(x: Any?, expectSuccess: Boolean) { try { - x as Test? + x as TestKlass? } catch (e: Throwable) { ensure(!expectSuccess) return @@ -39,7 +44,7 @@ fun testCastToNullable(x: Any?, expectSuccess: Boolean) { fun testCastNotNullableToNullable(x: Any, expectSuccess: Boolean) { try { - x as Test? + x as TestKlass? } catch (e: Throwable) { ensure(!expectSuccess) return diff --git a/backend.native/tests/codegen/basics/cast_simple.kt b/backend.native/tests/codegen/basics/cast_simple.kt index defae46bf8f..554a9414106 100644 --- a/backend.native/tests/codegen/basics/cast_simple.kt +++ b/backend.native/tests/codegen/basics/cast_simple.kt @@ -1,3 +1,7 @@ +package codegen.basics.cast_simple + +import kotlin.test.* + open class A() {} class B(): A() {} @@ -9,6 +13,7 @@ fun castTest(): Boolean { return true } -fun main(args: Array) { +@Test +fun runTest() { if (!castTest()) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/check_type.kt b/backend.native/tests/codegen/basics/check_type.kt index 1a89a880c8b..a5c1906194c 100644 --- a/backend.native/tests/codegen/basics/check_type.kt +++ b/backend.native/tests/codegen/basics/check_type.kt @@ -1,3 +1,7 @@ +package codegen.basics + +import kotlin.test.* + interface I class A() : I {} class B() {} @@ -28,8 +32,8 @@ fun isTypeOfInterface(a: Any) : Boolean { //-----------------------------------------------------------------------------// -fun main(args: Array) { - +@Test +fun runTest() { println(isTypeOf(A())) println(isTypeOf(null)) println(isTypeNullableOf(A())) diff --git a/backend.native/tests/codegen/basics/concatenation.kt b/backend.native/tests/codegen/basics/concatenation.kt index 2e94249adf0..0420b8b34a6 100644 --- a/backend.native/tests/codegen/basics/concatenation.kt +++ b/backend.native/tests/codegen/basics/concatenation.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.concatenation + +import kotlin.test.* + +@Test +fun runTest() { val s = "world" val i = 1 println("Hello $s $i ${2*i}") @@ -6,5 +11,4 @@ fun main(args: Array) { for (item in listOf("a", "b")) { println("Hello, $item") } -} - +} \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/expression_as_statement.kt b/backend.native/tests/codegen/basics/expression_as_statement.kt index 562d4fb485f..f30c46acc19 100644 --- a/backend.native/tests/codegen/basics/expression_as_statement.kt +++ b/backend.native/tests/codegen/basics/expression_as_statement.kt @@ -1,8 +1,13 @@ +package codegen.basics.expression_as_statement + +import kotlin.test.* + fun foo() { Any() as String } -fun main(args: Array) { +@Test +fun runTest() { try { foo() } catch (e: Throwable) { diff --git a/backend.native/tests/codegen/basics/local_variable.kt b/backend.native/tests/codegen/basics/local_variable.kt index b40e97d2026..0fc39decb70 100644 --- a/backend.native/tests/codegen/basics/local_variable.kt +++ b/backend.native/tests/codegen/basics/local_variable.kt @@ -1,9 +1,14 @@ +package codegen.basics.local_variable + +import kotlin.test.* + fun local_variable(a: Int) : Int { var b = 0 b = a + 11 return b } -fun main(args: Array) { +@Test +fun runTest() { if (local_variable(3) != 14) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/null_check.kt b/backend.native/tests/codegen/basics/null_check.kt index e393bfc391b..b04b8191cb0 100644 --- a/backend.native/tests/codegen/basics/null_check.kt +++ b/backend.native/tests/codegen/basics/null_check.kt @@ -1,3 +1,7 @@ +package codegen.basics.null_check + +import kotlin.test.* + //--- Test "eqeq" -------------------------------------------------------------// fun check_eqeq(a: Any?) = a == null @@ -22,7 +26,8 @@ fun null_check_eqeqeq2() : Boolean { return check_eqeqeq(null) } -fun main(args: Array) { +@Test +fun runTest() { if (null_check_eqeq1()) throw Error() if (!null_check_eqeq2()) throw Error() if (null_check_eqeqeq1()) throw Error() diff --git a/backend.native/tests/codegen/basics/safe_cast.kt b/backend.native/tests/codegen/basics/safe_cast.kt index 4231058162b..39fb369c5e3 100644 --- a/backend.native/tests/codegen/basics/safe_cast.kt +++ b/backend.native/tests/codegen/basics/safe_cast.kt @@ -1,3 +1,7 @@ +package codegen.basics.safe_cast + +import kotlin.test.* + open class A class B : A() class C @@ -14,8 +18,8 @@ fun safe_cast_negative(): Boolean { return foo(c) == null } - -fun main(args: Array) { +@Test +fun runTest() { val safeCastPositive = safe_cast_positive().toString() val safeCastNegative = safe_cast_negative().toString() println("safe_cast_positive: " + safeCastPositive) diff --git a/backend.native/tests/codegen/basics/spread_operator_0.kt b/backend.native/tests/codegen/basics/spread_operator_0.kt index 078c2a6fbdc..a8bb6501b10 100644 --- a/backend.native/tests/codegen/basics/spread_operator_0.kt +++ b/backend.native/tests/codegen/basics/spread_operator_0.kt @@ -1,4 +1,9 @@ -fun main(arg:Array) { +package codegen.basics.spread_operator_0 + +import kotlin.test.* + +@Test +fun runTest() { val list0 = _arrayOf("K", "o", "t", "l", "i", "n") val list1 = _arrayOf("l", "a","n", "g", "u", "a", "g", "e") val list = foo(list0, list1) diff --git a/backend.native/tests/codegen/basics/superFunCall.kt b/backend.native/tests/codegen/basics/superFunCall.kt index d524ccf961a..d8a4703983c 100644 --- a/backend.native/tests/codegen/basics/superFunCall.kt +++ b/backend.native/tests/codegen/basics/superFunCall.kt @@ -1,3 +1,7 @@ +package codegen.basics.superFunCall + +import kotlin.test.* + open class C { open fun f() = "" } @@ -13,7 +17,8 @@ class C3: C2() { override fun f() = super.f() + "" } -fun main(args: Array) { +@Test +fun runTest() { println(C1().f()) println(C3().f()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/superGetterCall.kt b/backend.native/tests/codegen/basics/superGetterCall.kt index 63dfd9b09f4..b82b056f88f 100644 --- a/backend.native/tests/codegen/basics/superGetterCall.kt +++ b/backend.native/tests/codegen/basics/superGetterCall.kt @@ -1,3 +1,7 @@ +package codegen.basics.superGetterCall + +import kotlin.test.* + open class C { open val p1 = "" } @@ -13,7 +17,8 @@ class C3: C2() { override val p1 = super.p1 + "" } -fun main(args: Array) { +@Test +fun runTest() { println(C1().p1) println(C3().p1) } \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/superSetterCall.kt b/backend.native/tests/codegen/basics/superSetterCall.kt index 215852a1d91..7a55a76bcaa 100644 --- a/backend.native/tests/codegen/basics/superSetterCall.kt +++ b/backend.native/tests/codegen/basics/superSetterCall.kt @@ -1,3 +1,7 @@ +package codegen.basics.superSetterCall + +import kotlin.test.* + open class C { open var p2 = "" set(value) { field = "" + value } @@ -22,7 +26,8 @@ class C3: C2() { } } -fun main(args: Array) { +@Test +fun runTest() { val c1 = C1() val c3 = C3() c1.p2 = "zzz" diff --git a/backend.native/tests/codegen/basics/typealias1.kt b/backend.native/tests/codegen/basics/typealias1.kt index b7d93d724ff..cd9eca07df4 100644 --- a/backend.native/tests/codegen/basics/typealias1.kt +++ b/backend.native/tests/codegen/basics/typealias1.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.typealias1 + +import kotlin.test.* + +@Test +fun runTest() { println(Bar(42).x) } diff --git a/backend.native/tests/codegen/basics/unchecked_cast1.kt b/backend.native/tests/codegen/basics/unchecked_cast1.kt index 1cb92d6b866..39d4bf7ec9f 100644 --- a/backend.native/tests/codegen/basics/unchecked_cast1.kt +++ b/backend.native/tests/codegen/basics/unchecked_cast1.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.unchecked_cast1 + +import kotlin.test.* + +@Test +fun runTest() { foo("17") bar("17") foo(42) diff --git a/backend.native/tests/codegen/basics/unchecked_cast2.kt b/backend.native/tests/codegen/basics/unchecked_cast2.kt index ffde9b02e41..3e2159884b6 100644 --- a/backend.native/tests/codegen/basics/unchecked_cast2.kt +++ b/backend.native/tests/codegen/basics/unchecked_cast2.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.unchecked_cast2 + +import kotlin.test.* + +@Test +fun runTest() { try { val x = cast(Any()) println(x.length) diff --git a/backend.native/tests/codegen/basics/unchecked_cast3.kt b/backend.native/tests/codegen/basics/unchecked_cast3.kt index 82a514d2226..392d0403524 100644 --- a/backend.native/tests/codegen/basics/unchecked_cast3.kt +++ b/backend.native/tests/codegen/basics/unchecked_cast3.kt @@ -1,12 +1,17 @@ -fun main(args: Array) { - testCast(Test(), true) - testCast(null, false) - testCastToNullable(null, true) +package codegen.basics.unchecked_cast3 + +import kotlin.test.* + +@Test +fun runTest() { + testCast(TestKlass(), true) + testCast(null, false) + testCastToNullable(null, true) println("Ok") } -class Test +class TestKlass fun ensure(b: Boolean) { if (!b) { diff --git a/backend.native/tests/codegen/basics/unit1.kt b/backend.native/tests/codegen/basics/unit1.kt index 689c239a79a..e41f71c4aae 100644 --- a/backend.native/tests/codegen/basics/unit1.kt +++ b/backend.native/tests/codegen/basics/unit1.kt @@ -1,3 +1,8 @@ -fun main(args: Array) { +package codegen.basics.unit1 + +import kotlin.test.* + +@Test +fun runTest() { println(println("First").toString()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/unit2.kt b/backend.native/tests/codegen/basics/unit2.kt index 67f7efaabde..463171c57e5 100644 --- a/backend.native/tests/codegen/basics/unit2.kt +++ b/backend.native/tests/codegen/basics/unit2.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.unit2 + +import kotlin.test.* + +@Test +fun runTest() { val x = foo() println(x.toString()) } diff --git a/backend.native/tests/codegen/basics/unit3.kt b/backend.native/tests/codegen/basics/unit3.kt index 5a2a673a50c..368e8528967 100644 --- a/backend.native/tests/codegen/basics/unit3.kt +++ b/backend.native/tests/codegen/basics/unit3.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.unit3 + +import kotlin.test.* + +@Test +fun runTest() { foo(Unit) } diff --git a/backend.native/tests/codegen/basics/unit4.kt b/backend.native/tests/codegen/basics/unit4.kt index 6ca7f6ee4e8..ee1fe05e6ff 100644 --- a/backend.native/tests/codegen/basics/unit4.kt +++ b/backend.native/tests/codegen/basics/unit4.kt @@ -1,4 +1,9 @@ -fun main(args: Array) { +package codegen.basics.unit4 + +import kotlin.test.* + +@Test +fun runTest() { for (x in 0 .. 8) { foo(x, Unit) } diff --git a/backend.native/tests/codegen/boxing/boxing0.kt b/backend.native/tests/codegen/boxing/boxing0.kt index 6b29115005f..f62a8b7ecb6 100644 --- a/backend.native/tests/codegen/boxing/boxing0.kt +++ b/backend.native/tests/codegen/boxing/boxing0.kt @@ -1,9 +1,12 @@ +package codegen.boxing.boxing0 + +import kotlin.test.* class Box(t: T) { var value = t } -fun main(args: Array) { +@Test fun runTest() { val box: Box = Box(17) println(box.value) } diff --git a/backend.native/tests/codegen/boxing/boxing1.kt b/backend.native/tests/codegen/boxing/boxing1.kt index 57b11e6b185..4275c2a7df1 100644 --- a/backend.native/tests/codegen/boxing/boxing1.kt +++ b/backend.native/tests/codegen/boxing/boxing1.kt @@ -1,8 +1,12 @@ +package codegen.boxing.boxing1 + +import kotlin.test.* + fun foo(arg: Any) { println(arg.toString()) } -fun main(args: Array) { +@Test fun runTest() { foo(1) foo(false) foo("Hello") diff --git a/backend.native/tests/codegen/boxing/boxing10.kt b/backend.native/tests/codegen/boxing/boxing10.kt index 38969157078..e0ee1318c54 100644 --- a/backend.native/tests/codegen/boxing/boxing10.kt +++ b/backend.native/tests/codegen/boxing/boxing10.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.boxing.boxing10 + +import kotlin.test.* + +@Test fun runTest() { val FALSE: Boolean? = false if (FALSE != null) { diff --git a/backend.native/tests/codegen/boxing/boxing11.kt b/backend.native/tests/codegen/boxing/boxing11.kt index c61e4bfb315..42999c989f3 100644 --- a/backend.native/tests/codegen/boxing/boxing11.kt +++ b/backend.native/tests/codegen/boxing/boxing11.kt @@ -1,3 +1,7 @@ +package codegen.boxing.boxing11 + +import kotlin.test.* + fun printInt(x: Int) = println(x) class Foo(val value: Int?) { @@ -6,7 +10,7 @@ class Foo(val value: Int?) { } } -fun main(args: Array) { +@Test fun runTest() { Foo(17).foo() Foo(null).foo() } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing12.kt b/backend.native/tests/codegen/boxing/boxing12.kt index 631b01202b0..951df9f2889 100644 --- a/backend.native/tests/codegen/boxing/boxing12.kt +++ b/backend.native/tests/codegen/boxing/boxing12.kt @@ -1,7 +1,11 @@ +package codegen.boxing.boxing12 + +import kotlin.test.* + fun foo(x: Number) { println(x.toByte()) } -fun main(args: Array) { +@Test fun runTest() { foo(18) } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing13.kt b/backend.native/tests/codegen/boxing/boxing13.kt index 7dd6d62e927..5f0c8305a87 100644 --- a/backend.native/tests/codegen/boxing/boxing13.kt +++ b/backend.native/tests/codegen/boxing/boxing13.kt @@ -1,9 +1,13 @@ +package codegen.boxing.boxing13 + +import kotlin.test.* + fun is42(x: Any?) { println(x == 42) println(42 == x) } -fun main(args: Array) { +@Test fun runTest() { is42(16) is42(42) is42("42") diff --git a/backend.native/tests/codegen/boxing/boxing14.kt b/backend.native/tests/codegen/boxing/boxing14.kt index 0cf6ae3ff59..dbb862a33ff 100644 --- a/backend.native/tests/codegen/boxing/boxing14.kt +++ b/backend.native/tests/codegen/boxing/boxing14.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.boxing.boxing14 + +import kotlin.test.* + +@Test fun runTest() { 42.println() } diff --git a/backend.native/tests/codegen/boxing/boxing15.kt b/backend.native/tests/codegen/boxing/boxing15.kt index f9a27c90931..31ef800e69e 100644 --- a/backend.native/tests/codegen/boxing/boxing15.kt +++ b/backend.native/tests/codegen/boxing/boxing15.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.boxing.boxing15 + +import kotlin.test.* + +@Test fun runTest() { println(foo(17)) } diff --git a/backend.native/tests/codegen/boxing/boxing2.kt b/backend.native/tests/codegen/boxing/boxing2.kt index eba3ae6c41b..c86cde51005 100644 --- a/backend.native/tests/codegen/boxing/boxing2.kt +++ b/backend.native/tests/codegen/boxing/boxing2.kt @@ -1,3 +1,7 @@ +package codegen.boxing.boxing2 + +import kotlin.test.* + fun printInt(x: Int) = println(x) fun printBoolean(x: Boolean) = println(x) @@ -10,7 +14,7 @@ fun foo(arg: Any) { println("other") } -fun main(args: Array) { +@Test fun runTest() { foo(1) foo(true) foo("Hello") diff --git a/backend.native/tests/codegen/boxing/boxing3.kt b/backend.native/tests/codegen/boxing/boxing3.kt index c478a0b6875..f062e5e56b8 100644 --- a/backend.native/tests/codegen/boxing/boxing3.kt +++ b/backend.native/tests/codegen/boxing/boxing3.kt @@ -1,3 +1,7 @@ +package codegen.boxing.boxing3 + +import kotlin.test.* + fun printInt(x: Int) = println(x) fun foo(arg: Int?) { @@ -5,6 +9,6 @@ fun foo(arg: Int?) { printInt(arg) } -fun main(args: Array) { +@Test fun runTest() { foo(42) } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing4.kt b/backend.native/tests/codegen/boxing/boxing4.kt index 0874d210e66..f45becbe938 100644 --- a/backend.native/tests/codegen/boxing/boxing4.kt +++ b/backend.native/tests/codegen/boxing/boxing4.kt @@ -1,3 +1,7 @@ +package codegen.boxing.boxing4 + +import kotlin.test.* + fun printInt(x: Int) = println(x) fun foo(arg: Any?) { @@ -5,6 +9,6 @@ fun foo(arg: Any?) { printInt(arg) } -fun main(args: Array) { +@Test fun runTest() { foo(16) } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing5.kt b/backend.native/tests/codegen/boxing/boxing5.kt index 1efc3114287..bc69d1f74c8 100644 --- a/backend.native/tests/codegen/boxing/boxing5.kt +++ b/backend.native/tests/codegen/boxing/boxing5.kt @@ -1,10 +1,14 @@ +package codegen.boxing.boxing5 + +import kotlin.test.* + fun printInt(x: Int) = println(x) fun foo(arg: Int?) { printInt(arg ?: 16) } -fun main(args: Array) { +@Test fun runTest() { foo(null) foo(42) } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing6.kt b/backend.native/tests/codegen/boxing/boxing6.kt index 7d0a4d47115..0b13df597d3 100644 --- a/backend.native/tests/codegen/boxing/boxing6.kt +++ b/backend.native/tests/codegen/boxing/boxing6.kt @@ -1,10 +1,14 @@ +package codegen.boxing.boxing6 + +import kotlin.test.* + fun printInt(x: Int) = println(x) fun foo(arg: Any) { printInt(arg as? Int ?: 16) } -fun main(args: Array) { +@Test fun runTest() { foo(42) foo("Hello") } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing7.kt b/backend.native/tests/codegen/boxing/boxing7.kt index 4230eb31fb8..0e9df8b53fe 100644 --- a/backend.native/tests/codegen/boxing/boxing7.kt +++ b/backend.native/tests/codegen/boxing/boxing7.kt @@ -1,3 +1,7 @@ +package codegen.boxing.boxing7 + +import kotlin.test.* + fun printInt(x: Int) = println(x) fun foo(arg: Any) { @@ -9,7 +13,7 @@ fun foo(arg: Any) { printInt(argAsInt) } -fun main(args: Array) { +@Test fun runTest() { foo(1) foo("Hello") } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing8.kt b/backend.native/tests/codegen/boxing/boxing8.kt index e176cadf932..ad2d4b26f0a 100644 --- a/backend.native/tests/codegen/boxing/boxing8.kt +++ b/backend.native/tests/codegen/boxing/boxing8.kt @@ -1,9 +1,13 @@ +package codegen.boxing.boxing8 + +import kotlin.test.* + fun foo(vararg args: Any?) { for (arg in args) { println(arg.toString()) } } -fun main(args: Array) { +@Test fun runTest() { foo(1, null, true, "Hello") } \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing9.kt b/backend.native/tests/codegen/boxing/boxing9.kt index 32fb9aa9e37..164a9e6ea5e 100644 --- a/backend.native/tests/codegen/boxing/boxing9.kt +++ b/backend.native/tests/codegen/boxing/boxing9.kt @@ -1,3 +1,7 @@ +package codegen.boxing.boxing9 + +import kotlin.test.* + fun foo(vararg args: Any?) { for (arg in args) { println(arg.toString()) @@ -8,6 +12,6 @@ fun bar(vararg args: Any?) { foo(1, *args, 2, *args, 3) } -fun main(args: Array) { +@Test fun runTest() { bar(null, true, "Hello") } \ No newline at end of file diff --git a/backend.native/tests/codegen/branching/advanced_when2.kt b/backend.native/tests/codegen/branching/advanced_when2.kt index 5074f16d72d..c0fea6e5cfc 100644 --- a/backend.native/tests/codegen/branching/advanced_when2.kt +++ b/backend.native/tests/codegen/branching/advanced_when2.kt @@ -1,3 +1,7 @@ +package codegen.boxing.advanced_when2 + +import kotlin.test.* + fun advanced_when2(i: Int): Int { var value = 1 when (i) { @@ -9,6 +13,6 @@ fun advanced_when2(i: Int): Int { return value } -fun main(args: Array) { +@Test fun runTest() { if (advanced_when2(10) != 42) throw Error() } diff --git a/backend.native/tests/codegen/branching/advanced_when5.kt b/backend.native/tests/codegen/branching/advanced_when5.kt index 224430f75b4..97b703a0c32 100644 --- a/backend.native/tests/codegen/branching/advanced_when5.kt +++ b/backend.native/tests/codegen/branching/advanced_when5.kt @@ -1,3 +1,7 @@ +package codegen.boxing.advanced_when5 + +import kotlin.test.* + fun advanced_when5(i: Int): Int { when (i) { 0 -> { val v = 42; return v} @@ -9,6 +13,6 @@ fun advanced_when5(i: Int): Int { } } -fun main(args: Array) { +@Test fun runTest() { if (advanced_when5(5) != 24) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/branching/if_else.kt b/backend.native/tests/codegen/branching/if_else.kt index 216f4dd6305..2213ee3dde3 100644 --- a/backend.native/tests/codegen/branching/if_else.kt +++ b/backend.native/tests/codegen/branching/if_else.kt @@ -1,8 +1,12 @@ +package codegen.boxing.if_else + +import kotlin.test.* + fun if_else(b: Boolean): Int { if (b) return 42 else return 24 } -fun main(args: Array) { +@Test fun runTest() { if (if_else(false) != 24) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/branching/when2.kt b/backend.native/tests/codegen/branching/when2.kt index e641f7a6aa3..1e8d1169112 100644 --- a/backend.native/tests/codegen/branching/when2.kt +++ b/backend.native/tests/codegen/branching/when2.kt @@ -1,3 +1,7 @@ +package codegen.boxing.when2 + +import kotlin.test.* + fun when2(i: Int): Int { when (i) { 0 -> return 42 @@ -5,6 +9,6 @@ fun when2(i: Int): Int { } } -fun main(args: Array) { +@Test fun runTest() { if (when2(0) != 42) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/branching/when4.kt b/backend.native/tests/codegen/branching/when4.kt index 3b666bdb80c..aec44a82aec 100644 --- a/backend.native/tests/codegen/branching/when4.kt +++ b/backend.native/tests/codegen/branching/when4.kt @@ -1,3 +1,7 @@ +package codegen.boxing.when4 + +import kotlin.test.* + fun when5(i: Int): Int { when (i) { 0 -> return 42 diff --git a/backend.native/tests/codegen/branching/when5.kt b/backend.native/tests/codegen/branching/when5.kt index a311e99e41b..f0b6abc2cd4 100644 --- a/backend.native/tests/codegen/branching/when5.kt +++ b/backend.native/tests/codegen/branching/when5.kt @@ -1,3 +1,7 @@ +package codegen.boxing.when5 + +import kotlin.test.* + fun when5(i: Int): Int { when (i) { 0 -> return 42 @@ -9,6 +13,6 @@ fun when5(i: Int): Int { } } -fun main(args: Array) { +@Test fun runTest() { if (when5(2) != 3) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/branching/when6.kt b/backend.native/tests/codegen/branching/when6.kt index ca3524332b7..3fb6c81dafe 100644 --- a/backend.native/tests/codegen/branching/when6.kt +++ b/backend.native/tests/codegen/branching/when6.kt @@ -1,6 +1,10 @@ +package codegen.boxing.when6 + +import kotlin.test.* + fun foo() { } -fun main(args: Array) { +@Test fun runTest() { if (true) foo() else foo() } \ No newline at end of file diff --git a/backend.native/tests/codegen/branching/when7.kt b/backend.native/tests/codegen/branching/when7.kt index 26351a53c65..dfa8bc4201f 100644 --- a/backend.native/tests/codegen/branching/when7.kt +++ b/backend.native/tests/codegen/branching/when7.kt @@ -1,3 +1,11 @@ +package codegen.boxing.when7 + +import kotlin.test.* + +@Test fun runTest() { + main(emptyArray()) +} + fun main(args: Array) { val b = args.size < 1 val x = if (b) Any() else throw Error() diff --git a/backend.native/tests/codegen/branching/when8.kt b/backend.native/tests/codegen/branching/when8.kt index 998a421f7cc..c5d1abd2bcb 100644 --- a/backend.native/tests/codegen/branching/when8.kt +++ b/backend.native/tests/codegen/branching/when8.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.boxing.when8 + +import kotlin.test.* + +@Test fun runTest() { when (true) { true -> println("true") false -> println("false") diff --git a/backend.native/tests/codegen/branching/when9.kt b/backend.native/tests/codegen/branching/when9.kt index 02ad49de4c8..f7dcdbdbe9a 100644 --- a/backend.native/tests/codegen/branching/when9.kt +++ b/backend.native/tests/codegen/branching/when9.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.boxing.when9 + +import kotlin.test.* + +@Test fun runTest() { foo(0) println("Ok") } diff --git a/backend.native/tests/codegen/branching/when_through.kt b/backend.native/tests/codegen/branching/when_through.kt index 5b071074177..17953acda12 100644 --- a/backend.native/tests/codegen/branching/when_through.kt +++ b/backend.native/tests/codegen/branching/when_through.kt @@ -1,3 +1,7 @@ +package codegen.boxing.when_through + +import kotlin.test.* + fun when_through(i: Int): Int { var value = 1 when (i) { @@ -9,6 +13,6 @@ fun when_through(i: Int): Int { return value } -fun main(args: Array) { +@Test fun runTest() { if (when_through(2) != 1) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/bridges/linkTest_lib.kt b/backend.native/tests/codegen/bridges/linkTest_lib.kt index 3df1d13e0e4..9dbb36d9f43 100644 --- a/backend.native/tests/codegen/bridges/linkTest_lib.kt +++ b/backend.native/tests/codegen/bridges/linkTest_lib.kt @@ -1,4 +1,4 @@ -package a +package codegen.bridges.linkTest.a interface A { fun foo(): T diff --git a/backend.native/tests/codegen/bridges/linkTest_main.kt b/backend.native/tests/codegen/bridges/linkTest_main.kt index 38c4dabf20a..d2e992c6967 100644 --- a/backend.native/tests/codegen/bridges/linkTest_main.kt +++ b/backend.native/tests/codegen/bridges/linkTest_main.kt @@ -1,8 +1,11 @@ -import a.* +package codegen.bridges.linkTest_main + +import kotlin.test.* +import codegen.bridges.linkTest.a.* class B: C() -fun main(args: Array) { +@Test fun runTest() { val b = B() println(b.foo()) val c: C = b diff --git a/backend.native/tests/codegen/bridges/test0.kt b/backend.native/tests/codegen/bridges/test0.kt index c228fab2f0a..b0a9d88edb6 100644 --- a/backend.native/tests/codegen/bridges/test0.kt +++ b/backend.native/tests/codegen/bridges/test0.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test0 + +import kotlin.test.* + // vtable call open class A { open fun foo(): Any = "A" @@ -7,7 +11,7 @@ open class C : A() { override fun foo(): Int = 42 } -fun main(args: Array) { +@Test fun runTest() { val c = C() val a: A = c println(c.foo().toString()) diff --git a/backend.native/tests/codegen/bridges/test1.kt b/backend.native/tests/codegen/bridges/test1.kt index ac1c87e9d58..066c7439f8e 100644 --- a/backend.native/tests/codegen/bridges/test1.kt +++ b/backend.native/tests/codegen/bridges/test1.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test1 + +import kotlin.test.* + // interface call, bridge overridden interface Z1 { fun foo(x: Int) : Any @@ -11,7 +15,7 @@ open class B : A() { override fun foo(x: Int) : Int = 42 } -fun main(args: Array) { +@Test fun runTest() { val z1: A = B() println((z1.foo(1) + 1000).toString()) } diff --git a/backend.native/tests/codegen/bridges/test10.kt b/backend.native/tests/codegen/bridges/test10.kt index b8eec342a19..48471d04856 100644 --- a/backend.native/tests/codegen/bridges/test10.kt +++ b/backend.native/tests/codegen/bridges/test10.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test10 + +import kotlin.test.* + open class A { open fun foo(x: T) { println(x.toString()) @@ -19,7 +23,7 @@ fun zzz(a: A) { a.foo(42) } -fun main(args: Array) { +@Test fun runTest() { val b = B() zzz(b) val a = A() diff --git a/backend.native/tests/codegen/bridges/test11.kt b/backend.native/tests/codegen/bridges/test11.kt index 2ca66389333..79ed6e01c4b 100644 --- a/backend.native/tests/codegen/bridges/test11.kt +++ b/backend.native/tests/codegen/bridges/test11.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test11 + +import kotlin.test.* + interface I { fun foo(x: Int) } @@ -10,7 +14,7 @@ class B : A(), I { override fun foo(x: Int) = println(x) } -fun main(args: Array) { +@Test fun runTest() { val b = B() val a: A = b val c: I = b diff --git a/backend.native/tests/codegen/bridges/test12.kt b/backend.native/tests/codegen/bridges/test12.kt index 5bb43bdb29c..9004ad208a6 100644 --- a/backend.native/tests/codegen/bridges/test12.kt +++ b/backend.native/tests/codegen/bridges/test12.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test12 + +import kotlin.test.* + abstract class A { abstract fun foo(x: T) } @@ -18,7 +22,7 @@ fun foo(arg: A) { arg.foo(42) } -fun main(args: Array) { +@Test fun runTest() { foo(B()) foo(C()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/bridges/test13.kt b/backend.native/tests/codegen/bridges/test13.kt index 76bc2b1af14..4dcab8b1cd6 100644 --- a/backend.native/tests/codegen/bridges/test13.kt +++ b/backend.native/tests/codegen/bridges/test13.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test13 + +import kotlin.test.* + open class A { open fun T.foo() { println(this.toString()) diff --git a/backend.native/tests/codegen/bridges/test14.kt b/backend.native/tests/codegen/bridges/test14.kt index 26d94b08a75..a99f773f88c 100644 --- a/backend.native/tests/codegen/bridges/test14.kt +++ b/backend.native/tests/codegen/bridges/test14.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test14 + +import kotlin.test.* + open class A { open fun foo(x: T, y: U) { println(x.toString()) @@ -26,7 +30,7 @@ fun zzz(a: A) { a.foo(42, 56) } -fun main(args: Array) { +@Test fun runTest() { val b = B() zzz(b) val a = A() diff --git a/backend.native/tests/codegen/bridges/test15.kt b/backend.native/tests/codegen/bridges/test15.kt index a29e6f9a958..eb7d8cac4c6 100644 --- a/backend.native/tests/codegen/bridges/test15.kt +++ b/backend.native/tests/codegen/bridges/test15.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test15 + +import kotlin.test.* + // non-generic interface, generic impl, vtable call + interface call open class A { open var size: T = 56 as T @@ -30,6 +34,6 @@ fun box(): String { return "OK" } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/bridges/test16.kt b/backend.native/tests/codegen/bridges/test16.kt index 7a9aa8219cf..b8a392174ea 100644 --- a/backend.native/tests/codegen/bridges/test16.kt +++ b/backend.native/tests/codegen/bridges/test16.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test16 + +import kotlin.test.* + interface A { fun foo(): String } @@ -12,7 +16,7 @@ open class B: C() { fun bar(c: C) = c.foo() -fun main(args: Array) { +@Test fun runTest() { val b = B() val c: C = b println(bar(b)) diff --git a/backend.native/tests/codegen/bridges/test17.kt b/backend.native/tests/codegen/bridges/test17.kt index 5da698965a7..ea3ab720202 100644 --- a/backend.native/tests/codegen/bridges/test17.kt +++ b/backend.native/tests/codegen/bridges/test17.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test17 + +import kotlin.test.* + // abstract bridge interface A { fun foo(): T @@ -13,7 +17,7 @@ class D: C() { } } -fun main(args: Array) { +@Test fun runTest() { val d = D() val c: C = d val b: B = d diff --git a/backend.native/tests/codegen/bridges/test18.kt b/backend.native/tests/codegen/bridges/test18.kt index 90f5b0e5640..d63895eaefe 100644 --- a/backend.native/tests/codegen/bridges/test18.kt +++ b/backend.native/tests/codegen/bridges/test18.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test18 + +import kotlin.test.* + // overriden function returns Unit open class A { open fun foo(): Any = 42 @@ -7,7 +11,7 @@ open class B: A() { override fun foo(): Unit { } } -fun main(args: Array) { +@Test fun runTest() { val a: A = B() println(a.foo()) } diff --git a/backend.native/tests/codegen/bridges/test2.kt b/backend.native/tests/codegen/bridges/test2.kt index 4d505c1f86c..3eed0c4f9fb 100644 --- a/backend.native/tests/codegen/bridges/test2.kt +++ b/backend.native/tests/codegen/bridges/test2.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test2 + +import kotlin.test.* + // vtable call, bridge inherited open class A { open fun foo(): Any = "A" @@ -9,7 +13,7 @@ open class C : A() { open class D: C() -fun main(args: Array) { +@Test fun runTest() { val c = D() val a: A = c println(c.foo().toString()) diff --git a/backend.native/tests/codegen/bridges/test3.kt b/backend.native/tests/codegen/bridges/test3.kt index 94623b31de5..e9985dd9b1a 100644 --- a/backend.native/tests/codegen/bridges/test3.kt +++ b/backend.native/tests/codegen/bridges/test3.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test3 + +import kotlin.test.* + // non-generic interface, generic impl, non-virtual call + interface call open class A { var size: T = 56 as T @@ -25,6 +29,6 @@ fun box(): String { return "OK" } -fun main(args: Array) { +@Test fun runTest() { println(box()) } diff --git a/backend.native/tests/codegen/bridges/test4.kt b/backend.native/tests/codegen/bridges/test4.kt index 4f79d18deb0..20e27f91267 100644 --- a/backend.native/tests/codegen/bridges/test4.kt +++ b/backend.native/tests/codegen/bridges/test4.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test4 + +import kotlin.test.* + // vtable call + interface call interface Z { fun foo(): Any @@ -13,7 +17,7 @@ open class A { open class B: A(), Z, Y -fun main(args: Array) { +@Test fun runTest() { val z: Z = B() val y: Y = z as Y println(z.foo().toString()) diff --git a/backend.native/tests/codegen/bridges/test5.kt b/backend.native/tests/codegen/bridges/test5.kt index a20acc36b84..25ee9ee343e 100644 --- a/backend.native/tests/codegen/bridges/test5.kt +++ b/backend.native/tests/codegen/bridges/test5.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test5 + +import kotlin.test.* + // non-generic interface, generic impl, vtable call + interface call open class A { open var size: T = 56 as T @@ -25,6 +29,6 @@ fun box(): String { return "OK" } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/bridges/test6.kt b/backend.native/tests/codegen/bridges/test6.kt index 59e1fef952d..5fbdb87942d 100644 --- a/backend.native/tests/codegen/bridges/test6.kt +++ b/backend.native/tests/codegen/bridges/test6.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test6 + +import kotlin.test.* + // vtable call + interface call interface Z { fun foo(): Any @@ -17,7 +21,7 @@ open class C : A() { open class D: C(), Y, Z -fun main(args: Array) { +@Test fun runTest() { val d = D() val y: Y = d val z: Z = d diff --git a/backend.native/tests/codegen/bridges/test7.kt b/backend.native/tests/codegen/bridges/test7.kt index a6cea1eb0aa..c8084947576 100644 --- a/backend.native/tests/codegen/bridges/test7.kt +++ b/backend.native/tests/codegen/bridges/test7.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test7 + +import kotlin.test.* + // generic interface, non-generic impl, vtable call + interface call open class A { open var size: Int = 56 @@ -25,6 +29,6 @@ fun box(): String { return "OK" } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/bridges/test8.kt b/backend.native/tests/codegen/bridges/test8.kt index 993febf2dae..0e2a7d92e76 100644 --- a/backend.native/tests/codegen/bridges/test8.kt +++ b/backend.native/tests/codegen/bridges/test8.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test8 + +import kotlin.test.* + // generic interface, non-generic impl, non-virtual call + interface call open class A { var size: Int = 56 @@ -25,6 +29,6 @@ fun box(): String { return "OK" } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/bridges/test9.kt b/backend.native/tests/codegen/bridges/test9.kt index e50453174c6..1a88ec19706 100644 --- a/backend.native/tests/codegen/bridges/test9.kt +++ b/backend.native/tests/codegen/bridges/test9.kt @@ -1,3 +1,7 @@ +package codegen.bridges.test9 + +import kotlin.test.* + // abstract class vtable call abstract class A { abstract fun foo(): String @@ -22,6 +26,6 @@ fun box(): String { } } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/classDelegation/generic.kt b/backend.native/tests/codegen/classDelegation/generic.kt index 106e2a5af99..2d026ef8183 100644 --- a/backend.native/tests/codegen/classDelegation/generic.kt +++ b/backend.native/tests/codegen/classDelegation/generic.kt @@ -1,3 +1,7 @@ +package codegen.classDelegation.generic + +import kotlin.test.* + open class Content() { override fun toString() = "OK" } @@ -16,6 +20,6 @@ class ContentBoxDelegate() : ContentBox by (Impl as ContentBox().get().toString() -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/classDelegation/method.kt b/backend.native/tests/codegen/classDelegation/method.kt index 214c697b35c..235eb8f6ff8 100644 --- a/backend.native/tests/codegen/classDelegation/method.kt +++ b/backend.native/tests/codegen/classDelegation/method.kt @@ -1,3 +1,7 @@ +package codegen.classDelegation.method + +import kotlin.test.* + interface A { fun foo(): T } @@ -14,6 +18,6 @@ fun box(): String { return c.foo() + a.foo() } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/classDelegation/property.kt b/backend.native/tests/codegen/classDelegation/property.kt index bd6be7e2e49..3eb0d01b10e 100644 --- a/backend.native/tests/codegen/classDelegation/property.kt +++ b/backend.native/tests/codegen/classDelegation/property.kt @@ -1,3 +1,7 @@ +package codegen.classDelegation.property + +import kotlin.test.* + interface A { val x: Int } @@ -14,6 +18,6 @@ fun box(): String { return q.x.toString() + a.x.toString() } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/classDelegation/withBridge.kt b/backend.native/tests/codegen/classDelegation/withBridge.kt index 1e0fc393050..ba163900fd8 100644 --- a/backend.native/tests/codegen/classDelegation/withBridge.kt +++ b/backend.native/tests/codegen/classDelegation/withBridge.kt @@ -1,3 +1,7 @@ +package codegen.classDelegation.withBridge + +import kotlin.test.* + interface A { fun foo(t: T): String } @@ -23,6 +27,6 @@ fun box(): String { } } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/controlflow/break.kt b/backend.native/tests/codegen/controlflow/break.kt index 8564f03f0cd..62b02d5098a 100644 --- a/backend.native/tests/codegen/controlflow/break.kt +++ b/backend.native/tests/codegen/controlflow/break.kt @@ -1,3 +1,7 @@ +package codegen.controlflow.`break` + +import kotlin.test.* + fun foo() { var i = 0 l1@while (true) { @@ -45,7 +49,7 @@ fun qux() { } } -fun main(args: Array) { +@Test fun runTest() { foo() bar() qux() diff --git a/backend.native/tests/codegen/controlflow/break1.kt b/backend.native/tests/codegen/controlflow/break1.kt index 88ca3ec83ee..6ad116d4038 100644 --- a/backend.native/tests/codegen/controlflow/break1.kt +++ b/backend.native/tests/codegen/controlflow/break1.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.break1 + +import kotlin.test.* + +@Test fun runTest() { loop@ while (true) { println("Body") break diff --git a/backend.native/tests/codegen/controlflow/for_loops.kt b/backend.native/tests/codegen/controlflow/for_loops.kt index 3b424afc533..abd162f6bb8 100644 --- a/backend.native/tests/codegen/controlflow/for_loops.kt +++ b/backend.native/tests/codegen/controlflow/for_loops.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.for_loops + +import kotlin.test.* + +@Test fun runTest() { // Simple loops for (i in 0..4) { diff --git a/backend.native/tests/codegen/controlflow/for_loops_call_order.kt b/backend.native/tests/codegen/controlflow/for_loops_call_order.kt index 12f0a6b07c7..aeee44d1796 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_call_order.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_call_order.kt @@ -1,9 +1,13 @@ +package codegen.controlflow.for_loops_call_order + +import kotlin.test.* + fun f1(): Int { print("1"); return 0 } fun f2(): Int { print("2"); return 6 } fun f3(): Int { print("3"); return 2 } fun f4(): Int { print("4"); return 3 } -fun main(args: Array) { +@Test fun runTest() { for (i in f1()..f2() step f3() step f4()) { }; println() for (i in f1() until f2() step f3() step f4()) {}; println() for (i in f2() downTo f1() step f3() step f4()) {}; println() diff --git a/backend.native/tests/codegen/controlflow/for_loops_coroutines.kt b/backend.native/tests/codegen/controlflow/for_loops_coroutines.kt index 140f069bec8..ddf3ee60c54 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_coroutines.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_coroutines.kt @@ -1,6 +1,10 @@ +package codegen.controlflow.for_loops_coroutines + +import kotlin.test.* + import kotlin.coroutines.experimental.* -fun main(args: Array) { +@Test fun runTest() { val sq = buildSequence { for (i in 0..6 step 2) { print("before: $i ") diff --git a/backend.native/tests/codegen/controlflow/for_loops_empty_range.kt b/backend.native/tests/codegen/controlflow/for_loops_empty_range.kt index 2b78406ae8a..c15a1030773 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_empty_range.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_empty_range.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.for_loops_empty_range + +import kotlin.test.* + +@Test fun runTest() { // Simple loops for (i in 4..0) { print(i) } for (i in 4 until 0) { print(i) } diff --git a/backend.native/tests/codegen/controlflow/for_loops_errors.kt b/backend.native/tests/codegen/controlflow/for_loops_errors.kt index 5023fdda249..8c4f308b858 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_errors.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_errors.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.for_loops_errors + +import kotlin.test.* + +@Test fun runTest() { // Negative step. try { for (i in 0 .. 4 step -2) print(i); println() diff --git a/backend.native/tests/codegen/controlflow/for_loops_nested.kt b/backend.native/tests/codegen/controlflow/for_loops_nested.kt index 9548d87e761..cdfd0528495 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_nested.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_nested.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.for_loops_nested + +import kotlin.test.* + +@Test fun runTest() { // Simple for (i in 0..2) { for (j in 0..2) { diff --git a/backend.native/tests/codegen/controlflow/for_loops_overflow.kt b/backend.native/tests/codegen/controlflow/for_loops_overflow.kt index 688a978a11a..baba8238fa9 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_overflow.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_overflow.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.for_loops_overflow + +import kotlin.test.* + +@Test fun runTest() { for (i in Int.MAX_VALUE - 1 .. Int.MAX_VALUE) { print(i); print(' ') }; println() for (i in Int.MAX_VALUE - 1 until Int.MAX_VALUE) { print(i); print(' ') }; println() for (i in Int.MIN_VALUE + 1 downTo Int.MIN_VALUE) { print(i); print(' ') }; println() diff --git a/backend.native/tests/codegen/controlflow/for_loops_types.kt b/backend.native/tests/codegen/controlflow/for_loops_types.kt index 943706daff7..e1b54f1515a 100644 --- a/backend.native/tests/codegen/controlflow/for_loops_types.kt +++ b/backend.native/tests/codegen/controlflow/for_loops_types.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.for_loops_types + +import kotlin.test.* + +@Test fun runTest() { for (i in 0.toByte() .. 4.toByte()) print(i); println() for (i in 0.toByte() .. 4.toShort()) print(i); println() for (i in 0.toByte() .. 4.toInt()) print(i); println() diff --git a/backend.native/tests/codegen/controlflow/unreachable1.kt b/backend.native/tests/codegen/controlflow/unreachable1.kt index 63032ff8950..1f70ac38a65 100644 --- a/backend.native/tests/codegen/controlflow/unreachable1.kt +++ b/backend.native/tests/codegen/controlflow/unreachable1.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.controlflow.unreachable1 + +import kotlin.test.* + +@Test fun runTest() { println(foo()) } diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally1.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally1.kt index bab264a3993..62b8b9db00b 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally1.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally2.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally2.kt index ea07c1c3de2..9b3af544ac6 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally2.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally2.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally2 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally3.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally3.kt index 69de84b4935..5cce005c1b4 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally3.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally3.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally3 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally4.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally4.kt index 7b6c4ca709f..ce628743c22 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally4.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally4.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally4 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally5.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally5.kt index 7959629e369..4aea23fffac 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally5.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally5.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally5 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally6.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally6.kt index 126e5975eb7..eaa125c30f3 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally6.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally6.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally6 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_finally7.kt b/backend.native/tests/codegen/coroutines/controlFlow_finally7.kt index de4b9fcb137..32edb245142 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_finally7.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_finally7.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_finally7 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -38,7 +42,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_if1.kt b/backend.native/tests/codegen/coroutines/controlFlow_if1.kt index 1cc96abd2a8..c6f0f7ce2dc 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_if1.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_if1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_if1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_if2.kt b/backend.native/tests/codegen/coroutines/controlFlow_if2.kt index 9ee2feadc5a..a296ffbfdb2 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_if2.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_if2.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_if2 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_inline1.kt b/backend.native/tests/codegen/coroutines/controlFlow_inline1.kt index a21e93077c2..59deae37108 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_inline1.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_inline1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_inline1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -21,7 +25,7 @@ inline suspend fun inline_s2(): Int { return 42 } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_inline2.kt b/backend.native/tests/codegen/coroutines/controlFlow_inline2.kt index b31935883f4..1c17e540d96 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_inline2.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_inline2.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_inline2 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -22,7 +26,7 @@ inline suspend fun inline_s2(): Int { return x } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_inline3.kt b/backend.native/tests/codegen/coroutines/controlFlow_inline3.kt index fb2cfb70513..71e802c451e 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_inline3.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_inline3.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_inline3 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -35,7 +39,7 @@ inline suspend fun inline_s2(): Int { return x } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch1.kt b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch1.kt index 29e7828cedc..9864d513077 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch1.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_tryCatch1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch2.kt b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch2.kt index 291453cf780..a7ee9d951f4 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch2.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch2.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_tryCatch2 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +36,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch3.kt b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch3.kt index bcc84ca968c..43f21f07726 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch3.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch3.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_tryCatch3 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -38,7 +42,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch4.kt b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch4.kt index a87aa67c7d8..38f7a25e49d 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch4.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch4.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_tryCatch4 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -38,7 +42,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch5.kt b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch5.kt index 3d82c0c945f..8a094d789d1 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_tryCatch5.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_tryCatch5.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_tryCatch5 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -38,7 +42,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_while1.kt b/backend.native/tests/codegen/coroutines/controlFlow_while1.kt index 847cfd14491..5e687a98f5c 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_while1.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_while1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_while1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -44,7 +48,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/controlFlow_while2.kt b/backend.native/tests/codegen/coroutines/controlFlow_while2.kt index c8d085fb70c..29b9da722d2 100644 --- a/backend.native/tests/codegen/coroutines/controlFlow_while2.kt +++ b/backend.native/tests/codegen/coroutines/controlFlow_while2.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.controlFlow_while2 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -44,7 +48,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/correctOrder1.kt b/backend.native/tests/codegen/coroutines/correctOrder1.kt index c98946e8287..c37379bfa30 100644 --- a/backend.native/tests/codegen/coroutines/correctOrder1.kt +++ b/backend.native/tests/codegen/coroutines/correctOrder1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.correctOrder1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -27,7 +31,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/degenerate1.kt b/backend.native/tests/codegen/coroutines/degenerate1.kt index 98b729b12de..db9203aad40 100644 --- a/backend.native/tests/codegen/coroutines/degenerate1.kt +++ b/backend.native/tests/codegen/coroutines/degenerate1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.degenerate1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -15,7 +19,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { builder { s1() } diff --git a/backend.native/tests/codegen/coroutines/degenerate2.kt b/backend.native/tests/codegen/coroutines/degenerate2.kt index b5f4d4f91b9..20c0ca6faed 100644 --- a/backend.native/tests/codegen/coroutines/degenerate2.kt +++ b/backend.native/tests/codegen/coroutines/degenerate2.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.degenerate2 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -22,7 +26,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { builder { s2() } diff --git a/backend.native/tests/codegen/coroutines/returnsUnit1.kt b/backend.native/tests/codegen/coroutines/returnsUnit1.kt index 41fe6e70499..6dd74705d57 100644 --- a/backend.native/tests/codegen/coroutines/returnsUnit1.kt +++ b/backend.native/tests/codegen/coroutines/returnsUnit1.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.returnsUnit1 + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -26,7 +30,7 @@ suspend fun s3(x: Int) { inline_s2(x) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/simple.kt b/backend.native/tests/codegen/coroutines/simple.kt index f0d4dd92c9f..70156a3e259 100644 --- a/backend.native/tests/codegen/coroutines/simple.kt +++ b/backend.native/tests/codegen/coroutines/simple.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.simple + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -16,7 +20,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/coroutines/withReceiver.kt b/backend.native/tests/codegen/coroutines/withReceiver.kt index b8b9f81dd1d..a41bbb4a60a 100644 --- a/backend.native/tests/codegen/coroutines/withReceiver.kt +++ b/backend.native/tests/codegen/coroutines/withReceiver.kt @@ -1,3 +1,7 @@ +package codegen.coroutines.withReceiver + +import kotlin.test.* + import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -18,7 +22,7 @@ fun builder(c: suspend Controller.() -> Unit) { c.startCoroutine(Controller(), EmptyContinuation) } -fun main(args: Array) { +@Test fun runTest() { var result = 0 builder { diff --git a/backend.native/tests/codegen/cycles/cycle.kt b/backend.native/tests/codegen/cycles/cycle.kt index 86193c99986..b526061c034 100644 --- a/backend.native/tests/codegen/cycles/cycle.kt +++ b/backend.native/tests/codegen/cycles/cycle.kt @@ -1,3 +1,7 @@ +package codegen.cycles.cycle + +import kotlin.test.* + fun cycle(cnt: Int): Int { var sum = 1 while (sum == cnt) { @@ -6,7 +10,7 @@ fun cycle(cnt: Int): Int { return sum } -fun main(args: Array) { +@Test fun runTest() { if (cycle(1) != 2) throw Error() if (cycle(0) != 1) throw Error() } diff --git a/backend.native/tests/codegen/cycles/cycle_do.kt b/backend.native/tests/codegen/cycles/cycle_do.kt index 3a25766bab1..29630b535e8 100644 --- a/backend.native/tests/codegen/cycles/cycle_do.kt +++ b/backend.native/tests/codegen/cycles/cycle_do.kt @@ -1,3 +1,7 @@ +package codegen.cycles.cycle_do + +import kotlin.test.* + fun cycle_do(cnt: Int): Int { var sum = 1 do { @@ -6,7 +10,7 @@ fun cycle_do(cnt: Int): Int { return sum } -fun main(args: Array) { +@Test fun runTest() { if (cycle_do(3) != 5) throw Error() if (cycle_do(0) != 3) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/cycles/cycle_for.kt b/backend.native/tests/codegen/cycles/cycle_for.kt index 738169fcbed..1f5a976fcb6 100644 --- a/backend.native/tests/codegen/cycles/cycle_for.kt +++ b/backend.native/tests/codegen/cycles/cycle_for.kt @@ -1,3 +1,7 @@ +package codegen.cycles.cycle_for + +import kotlin.test.* + fun cycle_for(arr: Array) : Int { var sum = 0 for (i in arr) { @@ -5,3 +9,7 @@ fun cycle_for(arr: Array) : Int { } return sum } + +@Test fun main() { + if (cycle_for(Array(4, init = { it })) != 6) throw Error() +} \ No newline at end of file diff --git a/backend.native/tests/codegen/dataflow/scope1.kt b/backend.native/tests/codegen/dataflow/scope1.kt index f14eb27cf86..23257faafba 100644 --- a/backend.native/tests/codegen/dataflow/scope1.kt +++ b/backend.native/tests/codegen/dataflow/scope1.kt @@ -1,6 +1,10 @@ +package codegen.dataflow.scope1 + +import kotlin.test.* + var b = true -fun main(args: Array) { +@Test fun runTest() { var x = 1 if (b) { var x = 2 diff --git a/backend.native/tests/codegen/dataflow/uninitialized_val.kt b/backend.native/tests/codegen/dataflow/uninitialized_val.kt index bc963690258..d8edfceba8e 100644 --- a/backend.native/tests/codegen/dataflow/uninitialized_val.kt +++ b/backend.native/tests/codegen/dataflow/uninitialized_val.kt @@ -1,3 +1,7 @@ +package codegen.dataflow.uninitialized_val + +import kotlin.test.* + fun foo(b: Boolean): Int { val x: Int if (b) { @@ -9,7 +13,7 @@ fun foo(b: Boolean): Int { return x } -fun main(args: Array) { +@Test fun runTest() { val uninitializedUnused: Int println(foo(true)) diff --git a/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt b/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt index 0aceea0ffdd..432224e40ec 100644 --- a/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt +++ b/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt @@ -1,4 +1,4 @@ -package a +package codegen.delegatedProperty.delegatedOverride.a import kotlin.reflect.KProperty diff --git a/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt b/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt index ba4fadc4e25..1692cb5174e 100644 --- a/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt +++ b/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt @@ -1,4 +1,8 @@ -import a.* +package codegen.delegatedProperty.delegatedOverride_main + +import kotlin.test.* + +import codegen.delegatedProperty.delegatedOverride.a.* open class C: B() { override val x: Int = 156 @@ -11,7 +15,7 @@ open class C: B() { } } -fun main(args: Array) { +@Test fun runTest() { val c = C() c.foo() } diff --git a/backend.native/tests/codegen/delegatedProperty/lazy.kt b/backend.native/tests/codegen/delegatedProperty/lazy.kt index 6fe68e92fce..2157013a37e 100644 --- a/backend.native/tests/codegen/delegatedProperty/lazy.kt +++ b/backend.native/tests/codegen/delegatedProperty/lazy.kt @@ -1,9 +1,13 @@ +package codegen.delegatedProperty.lazy + +import kotlin.test.* + val lazyValue: String by lazy { println("computed!") "Hello" } -fun main(args: Array) { +@Test fun runTest() { println(lazyValue) println(lazyValue) } \ No newline at end of file diff --git a/backend.native/tests/codegen/delegatedProperty/local.kt b/backend.native/tests/codegen/delegatedProperty/local.kt index f80c389e7ce..f1da2b2d77f 100644 --- a/backend.native/tests/codegen/delegatedProperty/local.kt +++ b/backend.native/tests/codegen/delegatedProperty/local.kt @@ -1,3 +1,7 @@ +package codegen.delegatedProperty.local + +import kotlin.test.* + import kotlin.reflect.KProperty fun foo(): Int { @@ -13,6 +17,6 @@ fun foo(): Int { return x } -fun main(args: Array) { +@Test fun runTest() { println(foo()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/delegatedProperty/map.kt b/backend.native/tests/codegen/delegatedProperty/map.kt index 6bd335ab010..76f76ff51bb 100644 --- a/backend.native/tests/codegen/delegatedProperty/map.kt +++ b/backend.native/tests/codegen/delegatedProperty/map.kt @@ -1,9 +1,13 @@ +package codegen.delegatedProperty.map + +import kotlin.test.* + class User(val map: Map) { val name: String by map val age: Int by map } -fun main(args: Array) { +@Test fun runTest() { val user = User(mapOf( "name" to "John Doe", "age" to 25 diff --git a/backend.native/tests/codegen/delegatedProperty/observable.kt b/backend.native/tests/codegen/delegatedProperty/observable.kt index c209bc5da2f..6291b8b3543 100644 --- a/backend.native/tests/codegen/delegatedProperty/observable.kt +++ b/backend.native/tests/codegen/delegatedProperty/observable.kt @@ -1,3 +1,7 @@ +package codegen.delegatedProperty.observable + +import kotlin.test.* + import kotlin.properties.Delegates class User { @@ -7,7 +11,7 @@ class User { } } -fun main(args: Array) { +@Test fun runTest() { val user = User() user.name = "first" user.name = "second" diff --git a/backend.native/tests/codegen/delegatedProperty/packageLevel.kt b/backend.native/tests/codegen/delegatedProperty/packageLevel.kt index 78002766016..da77b4afbac 100644 --- a/backend.native/tests/codegen/delegatedProperty/packageLevel.kt +++ b/backend.native/tests/codegen/delegatedProperty/packageLevel.kt @@ -1,3 +1,7 @@ +package codegen.delegatedProperty.packageLevel + +import kotlin.test.* + import kotlin.reflect.KProperty class Delegate { @@ -9,6 +13,6 @@ class Delegate { val x: Int by Delegate() -fun main(args: Array) { +@Test fun runTest() { println(x) } \ No newline at end of file diff --git a/backend.native/tests/codegen/delegatedProperty/simpleVal.kt b/backend.native/tests/codegen/delegatedProperty/simpleVal.kt index efa491997fe..3a4d9dcf878 100644 --- a/backend.native/tests/codegen/delegatedProperty/simpleVal.kt +++ b/backend.native/tests/codegen/delegatedProperty/simpleVal.kt @@ -1,3 +1,7 @@ +package codegen.delegatedProperty.simpleVal + +import kotlin.test.* + import kotlin.reflect.KProperty class Delegate { @@ -11,6 +15,6 @@ class C { val x: Int by Delegate() } -fun main(args: Array) { +@Test fun runTest() { println(C().x) } \ No newline at end of file diff --git a/backend.native/tests/codegen/delegatedProperty/simpleVar.kt b/backend.native/tests/codegen/delegatedProperty/simpleVar.kt index 4e934e1b7a4..df62c185ec0 100644 --- a/backend.native/tests/codegen/delegatedProperty/simpleVar.kt +++ b/backend.native/tests/codegen/delegatedProperty/simpleVar.kt @@ -1,3 +1,7 @@ +package codegen.delegatedProperty.simpleVar + +import kotlin.test.* + import kotlin.reflect.KProperty class Delegate { @@ -18,7 +22,7 @@ class C { var x: Int by Delegate() } -fun main(args: Array) { +@Test fun runTest() { val c = C() println(c.x) c.x = 117 diff --git a/backend.native/tests/codegen/enum/companionObject.kt b/backend.native/tests/codegen/enum/companionObject.kt index 3aef194b852..19c130d4b07 100644 --- a/backend.native/tests/codegen/enum/companionObject.kt +++ b/backend.native/tests/codegen/enum/companionObject.kt @@ -1,3 +1,7 @@ +package codegen.enum.companionObject + +import kotlin.test.* + enum class Game { ROCK, PAPER, @@ -21,4 +25,4 @@ fun box(): String { return "OK" } -fun main(args: Array) = println(box()) \ No newline at end of file +@Test fun runTest() = println(box()) \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/interfaceCallNoEntryClass.kt b/backend.native/tests/codegen/enum/interfaceCallNoEntryClass.kt index a340c7afb9f..048aa023da9 100644 --- a/backend.native/tests/codegen/enum/interfaceCallNoEntryClass.kt +++ b/backend.native/tests/codegen/enum/interfaceCallNoEntryClass.kt @@ -1,3 +1,7 @@ +package codegen.enum.interfaceCallNoEntryClass + +import kotlin.test.* + interface A { fun foo(): String } @@ -12,7 +16,7 @@ enum class Zzz(val zzz: String, val x: Int) : A { } } -fun main(args: Array) { +@Test fun runTest() { println(Zzz.Z3.foo()) val a: A = Zzz.Z3 println(a.foo()) diff --git a/backend.native/tests/codegen/enum/interfaceCallWithEntryClass.kt b/backend.native/tests/codegen/enum/interfaceCallWithEntryClass.kt index bc64cf70ae1..a04f5d63085 100644 --- a/backend.native/tests/codegen/enum/interfaceCallWithEntryClass.kt +++ b/backend.native/tests/codegen/enum/interfaceCallWithEntryClass.kt @@ -1,3 +1,7 @@ +package codegen.enum.interfaceCallWithEntryClass + +import kotlin.test.* + interface A { fun f(): String } @@ -14,7 +18,7 @@ enum class Zzz: A { override fun f() = "" } -fun main(args: Array) { +@Test fun runTest() { println(Zzz.Z1.f() + Zzz.Z2.f()) val a1: A = Zzz.Z1 val a2: A = Zzz.Z2 diff --git a/backend.native/tests/codegen/enum/linkTest_lib.kt b/backend.native/tests/codegen/enum/linkTest_lib.kt index 3653236c9cd..baa41c46be2 100644 --- a/backend.native/tests/codegen/enum/linkTest_lib.kt +++ b/backend.native/tests/codegen/enum/linkTest_lib.kt @@ -1,4 +1,4 @@ -package a +package codegen.enum.linkTest.a enum class A(val x: Int) { Z1(42), diff --git a/backend.native/tests/codegen/enum/linkTest_main.kt b/backend.native/tests/codegen/enum/linkTest_main.kt index cb4be8e436a..0790e8d7cfb 100644 --- a/backend.native/tests/codegen/enum/linkTest_main.kt +++ b/backend.native/tests/codegen/enum/linkTest_main.kt @@ -1,6 +1,10 @@ -import a.* +package codegen.enum.linkTest_main -fun main(args: Array) { +import kotlin.test.* + +import codegen.enum.linkTest.a.* + +@Test fun runTest() { println(A.Z1.x) println(A.valueOf("Z2").x) println(A.values()[2].x) diff --git a/backend.native/tests/codegen/enum/test0.kt b/backend.native/tests/codegen/enum/test0.kt index ff525debbc8..bf68ebd04a0 100644 --- a/backend.native/tests/codegen/enum/test0.kt +++ b/backend.native/tests/codegen/enum/test0.kt @@ -1,9 +1,13 @@ +package codegen.enum.test0 + +import kotlin.test.* + val TOP_LEVEL = 5 enum class MyEnum(value: Int) { VALUE(TOP_LEVEL) } -fun main(args: Array) { +@Test fun runTest() { println(MyEnum.VALUE.toString()) } diff --git a/backend.native/tests/codegen/enum/test1.kt b/backend.native/tests/codegen/enum/test1.kt index b9638bbb3bc..75b1f701994 100644 --- a/backend.native/tests/codegen/enum/test1.kt +++ b/backend.native/tests/codegen/enum/test1.kt @@ -1,8 +1,12 @@ +package codegen.enum.test1 + +import kotlin.test.* + enum class Zzz(val zzz: String, val x: Int) { Z1("z1", 1), Z2("z2", 2) } -fun main(args: Array) { +@Test fun runTest() { println(Zzz.Z1.zzz + Zzz.Z2.x) } \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/vCallNoEntryClass.kt b/backend.native/tests/codegen/enum/vCallNoEntryClass.kt index ebfc475e302..fb03c066e8c 100644 --- a/backend.native/tests/codegen/enum/vCallNoEntryClass.kt +++ b/backend.native/tests/codegen/enum/vCallNoEntryClass.kt @@ -1,3 +1,7 @@ +package codegen.enum.vCallNoEntryClass + +import kotlin.test.* + enum class Zzz(val zzz: String, val x: Int) { Z1("z1", 1), Z2("z2", 2), @@ -8,6 +12,6 @@ enum class Zzz(val zzz: String, val x: Int) { } } -fun main(args: Array) { +@Test fun runTest() { println(Zzz.Z3.toString()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/vCallWithEntryClass.kt b/backend.native/tests/codegen/enum/vCallWithEntryClass.kt index c3b509f2258..e1abe023565 100644 --- a/backend.native/tests/codegen/enum/vCallWithEntryClass.kt +++ b/backend.native/tests/codegen/enum/vCallWithEntryClass.kt @@ -1,3 +1,7 @@ +package codegen.enum.vCallWithEntryClass + +import kotlin.test.* + enum class Zzz { Z1 { override fun f() = "z1" @@ -10,6 +14,6 @@ enum class Zzz { open fun f() = "" } -fun main(args: Array) { +@Test fun runTest() { println(Zzz.Z1.f() + Zzz.Z2.f()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/valueOf.kt b/backend.native/tests/codegen/enum/valueOf.kt index e8b6c2d5e9c..2da8befd9fa 100644 --- a/backend.native/tests/codegen/enum/valueOf.kt +++ b/backend.native/tests/codegen/enum/valueOf.kt @@ -1,10 +1,14 @@ +package codegen.enum.valueOf + +import kotlin.test.* + enum class E { E3, E1, E2 } -fun main(args: Array) { +@Test fun runTest() { println(E.valueOf("E1").toString()) println(E.valueOf("E2").toString()) println(E.valueOf("E3").toString()) diff --git a/backend.native/tests/codegen/enum/values.kt b/backend.native/tests/codegen/enum/values.kt index 99b0540adc9..f9494bc6a16 100644 --- a/backend.native/tests/codegen/enum/values.kt +++ b/backend.native/tests/codegen/enum/values.kt @@ -1,10 +1,14 @@ +package codegen.enum.values + +import kotlin.test.* + enum class E { E3, E1, E2 } -fun main(args: Array) { +@Test fun runTest() { println(E.values()[0].toString()) println(E.values()[1].toString()) println(E.values()[2].toString()) diff --git a/backend.native/tests/codegen/function/arithmetic.kt b/backend.native/tests/codegen/function/arithmetic.kt index d38909dfac8..e70887e771e 100644 --- a/backend.native/tests/codegen/function/arithmetic.kt +++ b/backend.native/tests/codegen/function/arithmetic.kt @@ -1,10 +1,14 @@ +package codegen.function.arithmetic + +import kotlin.test.* + fun square(a:Int):Int = a * a fun sumOfSquares(a:Int, b:Int):Int = square(a) + square(b) fun diffOfSquares(a:Int, b:Int):Int = square(a) - square(b) fun mod(a:Int,b:Int):Int = a / b fun remainder(a:Int, b:Int):Int = a % b -fun main(args:Array) { +@Test fun runTest() { if (square(2) != 4) throw Error() if (sumOfSquares(2, 4) != 20) throw Error() if (diffOfSquares(2, 4) != -12) throw Error() diff --git a/backend.native/tests/codegen/function/boolean.kt b/backend.native/tests/codegen/function/boolean.kt index 328890fcb54..c005f6f415a 100644 --- a/backend.native/tests/codegen/function/boolean.kt +++ b/backend.native/tests/codegen/function/boolean.kt @@ -1,5 +1,9 @@ +package codegen.function.boolean + +import kotlin.test.* + fun bool_yes(): Boolean = true -fun main(args: Array) { +@Test fun runTest() { if (!bool_yes()) throw Error() } diff --git a/backend.native/tests/codegen/function/defaults.kt b/backend.native/tests/codegen/function/defaults.kt index a4562f3ddc5..d74dfe315fb 100644 --- a/backend.native/tests/codegen/function/defaults.kt +++ b/backend.native/tests/codegen/function/defaults.kt @@ -1,3 +1,7 @@ +package codegen.function.defaults + +import kotlin.test.* + /** * Created by minamoto on 12/26/16. */ @@ -14,9 +18,8 @@ open class A(val a:Int) { val one = A(1) val magic = A(42) } - - } + // FUN public fun foo(a: defaults.A = ...): kotlin.Int // a: EXPRESSION_BODY // CALL '(): A' type=defaults.A origin=GET_PROPERTY @@ -40,7 +43,7 @@ fun foo(a: A = A.magic, b:Int = 0xdeadbeef.toInt()) = a.a fun bar(a:A, inc:Int = 0) = A(a.a + inc) -fun main(args:Array) { +@Test fun runTest() { // if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ // arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ @@ -92,6 +95,3 @@ fun main(args:Array) { } println("all tests passed") } - - - diff --git a/backend.native/tests/codegen/function/defaults1.kt b/backend.native/tests/codegen/function/defaults1.kt index d8b2a04ab63..da07d32a9ab 100644 --- a/backend.native/tests/codegen/function/defaults1.kt +++ b/backend.native/tests/codegen/function/defaults1.kt @@ -1,6 +1,10 @@ +package codegen.function.defaults1 + +import kotlin.test.* + fun foo(x:Int = 0, y:Int = x + 1, z:Int = x + y + 1) = x + y + z -fun main(arg:Array) { +@Test fun runTest() { val v = foo() if (v != 3) { println("test failed $v expected 3") diff --git a/backend.native/tests/codegen/function/defaults10.kt b/backend.native/tests/codegen/function/defaults10.kt index 3e65f80aa88..bfcf5294f40 100644 --- a/backend.native/tests/codegen/function/defaults10.kt +++ b/backend.native/tests/codegen/function/defaults10.kt @@ -1,7 +1,11 @@ +package codegen.function.defaults10 + +import kotlin.test.* + enum class A(one: Int, val two: Int = one) { FOO(42) } -fun main(args: Array) { +@Test fun runTest() { println(A.FOO.two) } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/defaults2.kt b/backend.native/tests/codegen/function/defaults2.kt index 8f6830471dc..ed8741d2544 100644 --- a/backend.native/tests/codegen/function/defaults2.kt +++ b/backend.native/tests/codegen/function/defaults2.kt @@ -1,7 +1,11 @@ +package codegen.function.defaults2 + +import kotlin.test.* + fun Int.foo(inc0:Int, inc:Int = 0) = this + inc0 + inc -fun main(arg:Array) { +@Test fun runTest() { val v = 42.foo(0) if (v != 42) { println("test failed v:$v expected:42") diff --git a/backend.native/tests/codegen/function/defaults3.kt b/backend.native/tests/codegen/function/defaults3.kt index 9be86df16f0..4baf5c8e715 100644 --- a/backend.native/tests/codegen/function/defaults3.kt +++ b/backend.native/tests/codegen/function/defaults3.kt @@ -1,7 +1,11 @@ +package codegen.function.defaults3 + +import kotlin.test.* + fun foo(a:Int = 2, b:String = "Hello", c:Int = 4):String = "$b-$c$a" fun foo(a:Int = 3, b:Int = a + 1, c:Int = a + b) = a + b + c -fun main(arg:Array){ +@Test fun runTest() { val a = foo(b="Universe") if (a != "Universe-42") throw Error() diff --git a/backend.native/tests/codegen/function/defaults4.kt b/backend.native/tests/codegen/function/defaults4.kt index 96625b8b1e9..48815415551 100644 --- a/backend.native/tests/codegen/function/defaults4.kt +++ b/backend.native/tests/codegen/function/defaults4.kt @@ -1,3 +1,7 @@ +package codegen.function.defaults4 + +import kotlin.test.* + open class A { open fun foo(x: Int = 42) = println(x) } @@ -8,6 +12,6 @@ class C : B() { override fun foo(x: Int) = println(x + 1) } -fun main(args: Array) { +@Test fun runTest() { C().foo() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/defaults5.kt b/backend.native/tests/codegen/function/defaults5.kt index cd57c59a36f..19759018cbe 100644 --- a/backend.native/tests/codegen/function/defaults5.kt +++ b/backend.native/tests/codegen/function/defaults5.kt @@ -1,14 +1,18 @@ -class Test(val x: Int) { +package codegen.function.defaults5 + +import kotlin.test.* + +class TestClass(val x: Int) { fun foo(y: Int = x) { println(y) } } -fun Test.bar(y: Int = x) { +fun TestClass.bar(y: Int = x) { println(y) } -fun main(args: Array) { - Test(5).foo() - Test(6).bar() +@Test fun runTest() { + TestClass(5).foo() + TestClass(6).bar() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/defaults6.kt b/backend.native/tests/codegen/function/defaults6.kt index ed579700552..f3820acc8f2 100644 --- a/backend.native/tests/codegen/function/defaults6.kt +++ b/backend.native/tests/codegen/function/defaults6.kt @@ -1,6 +1,10 @@ +package codegen.function.defaults6 + +import kotlin.test.* + open class Foo(val x: Int = 42) class Bar : Foo() -fun main(args: Array) { +@Test fun runTest() { println(Bar().x) } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/defaults7.kt b/backend.native/tests/codegen/function/defaults7.kt index 71d2491e01c..d162fe1ed1f 100644 --- a/backend.native/tests/codegen/function/defaults7.kt +++ b/backend.native/tests/codegen/function/defaults7.kt @@ -1,3 +1,7 @@ +package codegen.function.defaults7 + +import kotlin.test.* + /** * Test fails with code generation: * Call parameter type does not match function signature! @@ -11,6 +15,6 @@ fun foo(a : T, b : Int = 42){ println(b) } -fun main(args : Array) { +@Test fun runTest() { foo(1) } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/defaults8.kt b/backend.native/tests/codegen/function/defaults8.kt index b03ef4d538c..35338f5a769 100644 --- a/backend.native/tests/codegen/function/defaults8.kt +++ b/backend.native/tests/codegen/function/defaults8.kt @@ -1,3 +1,7 @@ +package codegen.function.defaults8 + +import kotlin.test.* + class Foo { fun test(x: Int = 1) = x } @@ -6,6 +10,6 @@ class Bar { fun test(x: Int = 2) = x } -fun main(args : Array) { +@Test fun runTest() { println(Bar().test()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/defaults9.kt b/backend.native/tests/codegen/function/defaults9.kt index 3116acfc78b..985f318cb05 100644 --- a/backend.native/tests/codegen/function/defaults9.kt +++ b/backend.native/tests/codegen/function/defaults9.kt @@ -1,7 +1,11 @@ +package codegen.function.defaults9 + +import kotlin.test.* + class Foo { inner class Bar(x: Int, val y: Int = 1) { constructor() : this(42) } } -fun main(arg:Array) = println(Foo().Bar().y) +@Test fun runTest() = println(Foo().Bar().y) diff --git a/backend.native/tests/codegen/function/eqeq.kt b/backend.native/tests/codegen/function/eqeq.kt index 0e4c6c627bf..8968db1bdf4 100644 --- a/backend.native/tests/codegen/function/eqeq.kt +++ b/backend.native/tests/codegen/function/eqeq.kt @@ -1,3 +1,7 @@ +package codegen.function.eqeq + +import kotlin.test.* + fun eqeqB (a:Byte, b:Byte ) = a == b fun eqeqS (a:Short, b:Short ) = a == b fun eqeqI (a:Int, b:Int ) = a == b @@ -26,7 +30,7 @@ fun neF (a:Float, b:Float ) = a != b fun helloString() = "Hello" fun goodbyeString() = "Goodbye" -fun main(args: Array) { +@Test fun runTest() { if (!eqeqB(3 , 3 )) throw Error() if (!eqeqS(3 , 3 )) throw Error() if (!eqeqI(3 , 3 )) throw Error() diff --git a/backend.native/tests/codegen/function/intrinsic.kt b/backend.native/tests/codegen/function/intrinsic.kt index cafcbf80824..cdef2a012c2 100644 --- a/backend.native/tests/codegen/function/intrinsic.kt +++ b/backend.native/tests/codegen/function/intrinsic.kt @@ -1,3 +1,6 @@ +package codegen.function.intrinsic + +import kotlin.test.* // This code fails to link when bultins are taken from the // frontend generated module, instead of our library. @@ -10,6 +13,6 @@ fun intrinsic(b: Int): Int { return sum } -fun main(args: Array) { +@Test fun runTest() { if (intrinsic(3) != 4) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/localFunction.kt b/backend.native/tests/codegen/function/localFunction.kt index 41c74aefd04..6d01e5142fc 100644 --- a/backend.native/tests/codegen/function/localFunction.kt +++ b/backend.native/tests/codegen/function/localFunction.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.function.localFunction + +import kotlin.test.* + +@Test fun runTest() { val x = 1 fun local0() = println(x) fun local1() { diff --git a/backend.native/tests/codegen/function/localFunction2.kt b/backend.native/tests/codegen/function/localFunction2.kt index 3a0b76b5da4..162ee897178 100644 --- a/backend.native/tests/codegen/function/localFunction2.kt +++ b/backend.native/tests/codegen/function/localFunction2.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.function.localFunction2 + +import kotlin.test.* + +@Test fun runTest() { var a = 0 fun local() { class A { diff --git a/backend.native/tests/codegen/function/localFunction3.kt b/backend.native/tests/codegen/function/localFunction3.kt index 5ff19aa6c3c..5027e760dd1 100644 --- a/backend.native/tests/codegen/function/localFunction3.kt +++ b/backend.native/tests/codegen/function/localFunction3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.function.localFunction3 + +import kotlin.test.* + +@Test fun runTest() { fun bar() { fun local1() { bar() diff --git a/backend.native/tests/codegen/function/minus_eq.kt b/backend.native/tests/codegen/function/minus_eq.kt index f1979d81f14..00c15ed09a7 100644 --- a/backend.native/tests/codegen/function/minus_eq.kt +++ b/backend.native/tests/codegen/function/minus_eq.kt @@ -1,9 +1,13 @@ +package codegen.function.minus_eq + +import kotlin.test.* + fun minus_eq(a: Int): Int { var b = 11 b -= a return b } -fun main(args: Array) { +@Test fun runTest() { if (minus_eq(23) != -12) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/named.kt b/backend.native/tests/codegen/function/named.kt index 00d18ab29c4..3e8b1fd3e69 100644 --- a/backend.native/tests/codegen/function/named.kt +++ b/backend.native/tests/codegen/function/named.kt @@ -1,5 +1,10 @@ +package codegen.function.named + +import kotlin.test.* + fun foo(a:Int, b:Int) = a - b -fun main(args:Array) { + +@Test fun runTest() { if (foo(b = 24, a = 42) != 18) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/plus_eq.kt b/backend.native/tests/codegen/function/plus_eq.kt index 670f60b5712..617588d017b 100644 --- a/backend.native/tests/codegen/function/plus_eq.kt +++ b/backend.native/tests/codegen/function/plus_eq.kt @@ -1,9 +1,13 @@ +package codegen.function.plus_eq + +import kotlin.test.* + fun plus_eq(a: Int): Int { var b = 11 b += a return b } -fun main(args: Array) { +@Test fun runTest() { if (plus_eq(3) != 14) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/sum.kt b/backend.native/tests/codegen/function/sum.kt index 8e6ca12321b..6ee3db52552 100644 --- a/backend.native/tests/codegen/function/sum.kt +++ b/backend.native/tests/codegen/function/sum.kt @@ -1,3 +1,7 @@ +package codegen.function.sum + +import kotlin.test.* + fun sumIB(a:Int, b:Byte ) = a + b fun sumIS(a:Int, b:Short ) = a + b fun sumII(a:Int, b:Int ) = a + b @@ -7,7 +11,7 @@ fun sumID(a:Int, b:Double) = a + b fun modID(a:Int, b:Double) = a % b -fun main(args:Array) { +@Test fun runTest() { if (sumIB(2, 3) != 5) throw Error() if (sumIS(2, 3) != 5) throw Error() if (sumII(2, 3) != 5) throw Error() diff --git a/backend.native/tests/codegen/function/sum_3const.kt b/backend.native/tests/codegen/function/sum_3const.kt index 3e5e7bd34e0..8086b6bc2e7 100644 --- a/backend.native/tests/codegen/function/sum_3const.kt +++ b/backend.native/tests/codegen/function/sum_3const.kt @@ -1,6 +1,10 @@ +package codegen.function.sum_3const + +import kotlin.test.* + fun sum3():Int = sum(1, 2, 33) fun sum(a:Int, b:Int, c:Int): Int = a + b + c -fun main(args: Array) { +@Test fun runTest() { if (sum3() != 36) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/sum_foo_bar.kt b/backend.native/tests/codegen/function/sum_foo_bar.kt index ebfa4fe52de..0945389cc40 100644 --- a/backend.native/tests/codegen/function/sum_foo_bar.kt +++ b/backend.native/tests/codegen/function/sum_foo_bar.kt @@ -1,8 +1,12 @@ +package codegen.function.sum_foo_bar + +import kotlin.test.* + fun foo(a:Int):Int = a fun bar(a:Int):Int = a fun sumFooBar(a:Int, b:Int):Int = foo(a) + bar(b) -fun main(args:Array) { +@Test fun runTest() { if (sumFooBar(2, 3) != 5) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/sum_func.kt b/backend.native/tests/codegen/function/sum_func.kt index 24a5ca9713a..8dbeaf11523 100644 --- a/backend.native/tests/codegen/function/sum_func.kt +++ b/backend.native/tests/codegen/function/sum_func.kt @@ -1,3 +1,9 @@ +package codegen.function.sum_func + +import kotlin.test.* + fun foo():Int = 1 //fun bar():Int = 2 -//fun sum():Int = foo() + bar() \ No newline at end of file +//fun sum():Int = foo() + bar() + +// FIXME: has no checks \ No newline at end of file diff --git a/backend.native/tests/codegen/function/sum_imm.kt b/backend.native/tests/codegen/function/sum_imm.kt index da63baabfbf..d06fb0fa18c 100644 --- a/backend.native/tests/codegen/function/sum_imm.kt +++ b/backend.native/tests/codegen/function/sum_imm.kt @@ -1,5 +1,9 @@ +package codegen.function.sum_imm + +import kotlin.test.* + fun sum(a:Int): Int = a + 33 -fun main(args:Array) { +@Test fun runTest() { if (sum(2) != 35) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/function/sum_mixed.kt b/backend.native/tests/codegen/function/sum_mixed.kt index 66d23047854..80d1c71aeff 100644 --- a/backend.native/tests/codegen/function/sum_mixed.kt +++ b/backend.native/tests/codegen/function/sum_mixed.kt @@ -1 +1,6 @@ +package codegen.function.sum_mixed + +import kotlin.test.* + +// FIXME: has no checks fun sum(a:Float, b:Int) = a + b \ No newline at end of file diff --git a/backend.native/tests/codegen/function/sum_silly.kt b/backend.native/tests/codegen/function/sum_silly.kt index 89087067188..6c225f6772c 100644 --- a/backend.native/tests/codegen/function/sum_silly.kt +++ b/backend.native/tests/codegen/function/sum_silly.kt @@ -1,3 +1,9 @@ +package codegen.function.sum_silly + +import kotlin.test.* + +// FIXME: has no checks + fun sum(a:Int, b:Int):Int { var c:Int c = a + b diff --git a/backend.native/tests/codegen/initializers/correctOrder1.kt b/backend.native/tests/codegen/initializers/correctOrder1.kt index fd7645f3d05..6e75711a5e0 100644 --- a/backend.native/tests/codegen/initializers/correctOrder1.kt +++ b/backend.native/tests/codegen/initializers/correctOrder1.kt @@ -1,4 +1,8 @@ -class Test { +package codegen.initializers.correctOrder1 + +import kotlin.test.* + +class TestClass { val x: Int init { @@ -8,6 +12,6 @@ class Test { val y = x } -fun main(args: Array) { - println(Test().y) +@Test fun runTest() { + println(TestClass().y) } \ No newline at end of file diff --git a/backend.native/tests/codegen/initializers/correctOrder2.kt b/backend.native/tests/codegen/initializers/correctOrder2.kt index ddf63ade9a0..988b689ae0f 100644 --- a/backend.native/tests/codegen/initializers/correctOrder2.kt +++ b/backend.native/tests/codegen/initializers/correctOrder2.kt @@ -1,4 +1,8 @@ -class Test { +package codegen.initializers.correctOrder2 + +import kotlin.test.* + +class TestClass { val x: Int val y = 42 @@ -8,6 +12,6 @@ class Test { } } -fun main(args: Array) { - println(Test().x) +@Test fun runTest() { + println(TestClass().x) } \ No newline at end of file diff --git a/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt b/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt index 04a3e5e7349..e8621e0d1ce 100644 --- a/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt +++ b/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt @@ -1,3 +1,3 @@ -package a +package codegen.inline.defaultArgs_linkTest.a inline fun foo(x: Int, y: Int = 117) = x + y \ No newline at end of file diff --git a/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt b/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt index 19a3db05739..9fe0f656610 100644 --- a/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt +++ b/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt @@ -1,6 +1,10 @@ -import a.* +package codegen.inline.defaultArgs_linkTest_main -fun main(args: Array) { +import kotlin.test.* + +import codegen.inline.defaultArgs_linkTest.a.* + +@Test fun runTest() { println(foo(5)) println(foo(5, 42)) } \ No newline at end of file diff --git a/backend.native/tests/codegen/inline/inline0.kt b/backend.native/tests/codegen/inline/inline0.kt index c1284b1a0d4..cc615a19d16 100644 --- a/backend.native/tests/codegen/inline/inline0.kt +++ b/backend.native/tests/codegen/inline/inline0.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline0 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i1: Int, j1: Int): Int { return i1 + j1 @@ -7,7 +11,7 @@ fun bar(i: Int, j: Int): Int { return i + foo(i, j) } -fun main(args: Array) { +@Test fun runTest() { println(bar(41, 2).toString()) } diff --git a/backend.native/tests/codegen/inline/inline1.kt b/backend.native/tests/codegen/inline/inline1.kt index 36b23aee79d..fe5b41c8448 100644 --- a/backend.native/tests/codegen/inline/inline1.kt +++ b/backend.native/tests/codegen/inline/inline1.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline1 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(s4: String, s5: String): String { return s4 + s5 @@ -7,7 +11,7 @@ fun bar(s1: String, s2: String, s3: String): String { return s1 + foo(s2, s3) } -fun main(args: Array) { +@Test fun runTest() { println(bar("Hello ", "wor", "ld")) } diff --git a/backend.native/tests/codegen/inline/inline10.kt b/backend.native/tests/codegen/inline/inline10.kt index f19f5dd8f76..33b5a0fa248 100644 --- a/backend.native/tests/codegen/inline/inline10.kt +++ b/backend.native/tests/codegen/inline/inline10.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline10 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i2: Int, body: () -> Int): Int { return i2 + body() @@ -7,6 +11,6 @@ fun bar(i1: Int): Int { return foo(i1) { 1 } } -fun main(args: Array) { +@Test fun runTest() { println(bar(1).toString()) } diff --git a/backend.native/tests/codegen/inline/inline11.kt b/backend.native/tests/codegen/inline/inline11.kt index d64e6c4eaaf..9667a5c2e11 100644 --- a/backend.native/tests/codegen/inline/inline11.kt +++ b/backend.native/tests/codegen/inline/inline11.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline11 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo (i2: Any): Boolean { return i2 is T @@ -7,6 +11,6 @@ fun bar(i1: Int): Boolean { return foo(i1) } -fun main(args: Array) { +@Test fun runTest() { println(bar(1).toString()) } diff --git a/backend.native/tests/codegen/inline/inline12.kt b/backend.native/tests/codegen/inline/inline12.kt index fe12d04c822..680fdd50eb7 100644 --- a/backend.native/tests/codegen/inline/inline12.kt +++ b/backend.native/tests/codegen/inline/inline12.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline12 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo (): Boolean { return Any() is Any @@ -7,6 +11,6 @@ fun bar(i1: Int): Boolean { return foo() } -fun main(args: Array) { +@Test fun runTest() { println(bar(1).toString()) } diff --git a/backend.native/tests/codegen/inline/inline13.kt b/backend.native/tests/codegen/inline/inline13.kt index 5770496d1f2..b1c94d33043 100644 --- a/backend.native/tests/codegen/inline/inline13.kt +++ b/backend.native/tests/codegen/inline/inline13.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline13 + +import kotlin.test.* + open class A() class B() : A() @@ -10,6 +14,6 @@ fun bar(): Boolean { return foo>(B()) } -fun main(args: Array) { +@Test fun runTest() { println(bar().toString()) } diff --git a/backend.native/tests/codegen/inline/inline14.kt b/backend.native/tests/codegen/inline/inline14.kt index 16dd9c96c99..5b26da79d09 100644 --- a/backend.native/tests/codegen/inline/inline14.kt +++ b/backend.native/tests/codegen/inline/inline14.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline14 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo3(i3: Int): Int { return i3 + 3 @@ -17,6 +21,6 @@ fun bar(i0: Int): Int { return foo1(i0) + foo3(i0) } -fun main(args: Array) { +@Test fun runTest() { println(bar(2).toString()) } diff --git a/backend.native/tests/codegen/inline/inline15.kt b/backend.native/tests/codegen/inline/inline15.kt index 3891f0d3102..7290ad131af 100644 --- a/backend.native/tests/codegen/inline/inline15.kt +++ b/backend.native/tests/codegen/inline/inline15.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline15 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo2(i1: Int): Int { return i1 + 1 @@ -12,6 +16,6 @@ fun bar(i0: Int): Int { return foo1(i0) { foo2(it) + 1 } } -fun main(args: Array) { +@Test fun runTest() { println(bar(2).toString()) } diff --git a/backend.native/tests/codegen/inline/inline16.kt b/backend.native/tests/codegen/inline/inline16.kt index 9c5255ea714..635d98a0d97 100644 --- a/backend.native/tests/codegen/inline/inline16.kt +++ b/backend.native/tests/codegen/inline/inline16.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline16 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun > foo(destination: C, predicate: (T) -> Boolean): C { for (element in destination) { @@ -12,6 +16,6 @@ fun bar(): Boolean { return result.isEmpty() } -fun main(args: Array) { +@Test fun runTest() { println(bar().toString()) } diff --git a/backend.native/tests/codegen/inline/inline17.kt b/backend.native/tests/codegen/inline/inline17.kt index f4ece564bd1..1529c543fa2 100644 --- a/backend.native/tests/codegen/inline/inline17.kt +++ b/backend.native/tests/codegen/inline/inline17.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline17 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i1: T, i2: T): List { val j1 = i1 @@ -9,6 +13,6 @@ fun bar(): List { return foo (1, 2) } -fun main(args: Array) { +@Test fun runTest() { println(bar().toString()) } diff --git a/backend.native/tests/codegen/inline/inline18.kt b/backend.native/tests/codegen/inline/inline18.kt index d6126aead70..e0d126282f6 100644 --- a/backend.native/tests/codegen/inline/inline18.kt +++ b/backend.native/tests/codegen/inline/inline18.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline18 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo2(i2: T, j2: T, p2: (T, T) -> Boolean): Boolean { return p2(i2, j2) @@ -13,6 +17,6 @@ fun bar(): Boolean { return result } -fun main(args: Array) { +@Test fun runTest() { println(bar().toString()) } diff --git a/backend.native/tests/codegen/inline/inline19.kt b/backend.native/tests/codegen/inline/inline19.kt index 21cc587bd84..63420e93213 100644 --- a/backend.native/tests/codegen/inline/inline19.kt +++ b/backend.native/tests/codegen/inline/inline19.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline19 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline private fun foo(i: Int): Int { val result = i @@ -8,7 +12,7 @@ fun bar(): Int { return foo(1) + foo(2) } -fun main(args: Array) { +@Test fun runTest() { println(bar().toString()) } diff --git a/backend.native/tests/codegen/inline/inline2.kt b/backend.native/tests/codegen/inline/inline2.kt index 8ab7e4218fd..cfb29f78316 100644 --- a/backend.native/tests/codegen/inline/inline2.kt +++ b/backend.native/tests/codegen/inline/inline2.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline2 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i4: Int, i5: Int) { println("hello $i4 $i5") @@ -7,6 +11,6 @@ fun bar(i1: Int, i2: Int) { foo(i1, i2) } -fun main(args: Array) { +@Test fun runTest() { bar(1, 8) } diff --git a/backend.native/tests/codegen/inline/inline20.kt b/backend.native/tests/codegen/inline/inline20.kt index b53f98e7229..32c03448ef0 100644 --- a/backend.native/tests/codegen/inline/inline20.kt +++ b/backend.native/tests/codegen/inline/inline20.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline20 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun bar(block: () -> String) : String { return block() @@ -7,6 +11,6 @@ fun bar2() : String { return bar { return "def" } } -fun main(args: Array) { +@Test fun runTest() { println(bar2()) } diff --git a/backend.native/tests/codegen/inline/inline21.kt b/backend.native/tests/codegen/inline/inline21.kt index d68b293b21c..457148a346f 100644 --- a/backend.native/tests/codegen/inline/inline21.kt +++ b/backend.native/tests/codegen/inline/inline21.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline21 + +import kotlin.test.* + inline fun foo2(block2: () -> Int) : Int { println("foo2") return block2() @@ -13,6 +17,6 @@ fun bar(block: () -> Int) : Int { return foo1(block) } -fun main(args: Array) { +@Test fun runTest() { println(bar { 33 }) } diff --git a/backend.native/tests/codegen/inline/inline22.kt b/backend.native/tests/codegen/inline/inline22.kt index ed5e046c586..01638a6f6f6 100644 --- a/backend.native/tests/codegen/inline/inline22.kt +++ b/backend.native/tests/codegen/inline/inline22.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline22 + +import kotlin.test.* + inline fun foo2(i2: Int): Int { return i2 + 3 } @@ -10,6 +14,6 @@ fun bar(): Int { return foo1(11) } -fun main(args: Array) { +@Test fun runTest() { println(bar().toString()) } diff --git a/backend.native/tests/codegen/inline/inline23.kt b/backend.native/tests/codegen/inline/inline23.kt index bf5a0385059..0eb892fbbb0 100644 --- a/backend.native/tests/codegen/inline/inline23.kt +++ b/backend.native/tests/codegen/inline/inline23.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline23 + +import kotlin.test.* + inline fun foo(i2: Any): T { return i2 as T } @@ -6,6 +10,6 @@ fun bar(i1: Int): Int { return foo(i1) } -fun main(args: Array) { +@Test fun runTest() { println(bar(33)) } diff --git a/backend.native/tests/codegen/inline/inline24.kt b/backend.native/tests/codegen/inline/inline24.kt index e500de5111a..765a0222ed1 100644 --- a/backend.native/tests/codegen/inline/inline24.kt +++ b/backend.native/tests/codegen/inline/inline24.kt @@ -1,8 +1,12 @@ +package codegen.inline.inline24 + +import kotlin.test.* + fun foo() = println("foo") fun bar() = println("bar") inline fun baz(x: Unit = foo(), y: Unit) {} -fun main(args: Array) { +@Test fun runTest() { baz(y = bar()) } diff --git a/backend.native/tests/codegen/inline/inline25.kt b/backend.native/tests/codegen/inline/inline25.kt index 3adde72584d..95ca3dd9c65 100644 --- a/backend.native/tests/codegen/inline/inline25.kt +++ b/backend.native/tests/codegen/inline/inline25.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline25 + +import kotlin.test.* + inline fun foo(block: String.() -> Unit) { "Ok".block() } @@ -10,7 +14,7 @@ inline fun baz(block: String.() -> Unit) { block("Ok") } -fun main(args: Array) { +@Test fun runTest() { bar { println(it) } diff --git a/backend.native/tests/codegen/inline/inline3.kt b/backend.native/tests/codegen/inline/inline3.kt index 8b0edf296c0..4a1e9b3e434 100644 --- a/backend.native/tests/codegen/inline/inline3.kt +++ b/backend.native/tests/codegen/inline/inline3.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline3 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i4: Int, i5: Int): Int { try { @@ -11,6 +15,6 @@ fun bar(i1: Int, i2: Int, i3: Int): Int { return i1 + foo(i2, i3) } -fun main(args: Array) { +@Test fun runTest() { println(bar(1, 8, 2).toString()) } diff --git a/backend.native/tests/codegen/inline/inline4.kt b/backend.native/tests/codegen/inline/inline4.kt index 8424ebcdded..2fdd55e5ed7 100644 --- a/backend.native/tests/codegen/inline/inline4.kt +++ b/backend.native/tests/codegen/inline/inline4.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline4 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i4: Int, i5: Int): Int { if (i4 > 0) return i4 @@ -8,6 +12,6 @@ fun bar(i1: Int, i2: Int): Int { return foo(i1, i2) } -fun main(args: Array) { +@Test fun runTest() { println(bar(3, 8).toString()) } diff --git a/backend.native/tests/codegen/inline/inline5.kt b/backend.native/tests/codegen/inline/inline5.kt index 7e921c8d83b..7c2fb98ba3f 100644 --- a/backend.native/tests/codegen/inline/inline5.kt +++ b/backend.native/tests/codegen/inline/inline5.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline5 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i2: Int, body: () -> Int): Int { return i2 + body() @@ -7,7 +11,7 @@ fun bar(i1: Int): Int { return foo(i1) { return 33 } } -fun main(args: Array) { +@Test fun runTest() { println(bar(1).toString()) } diff --git a/backend.native/tests/codegen/inline/inline6.kt b/backend.native/tests/codegen/inline/inline6.kt index 4f6efa66604..c49d3687c11 100644 --- a/backend.native/tests/codegen/inline/inline6.kt +++ b/backend.native/tests/codegen/inline/inline6.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline6 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(body: () -> Unit) { println("hello1") @@ -12,6 +16,6 @@ fun bar() { } } -fun main(args: Array) { +@Test fun runTest() { bar() } diff --git a/backend.native/tests/codegen/inline/inline7.kt b/backend.native/tests/codegen/inline/inline7.kt index 6bb5dd067c2..8e6f625e88f 100644 --- a/backend.native/tests/codegen/inline/inline7.kt +++ b/backend.native/tests/codegen/inline/inline7.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline7 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(vararg args: Int) { for (a in args) { @@ -9,6 +13,6 @@ fun bar() { foo(1, 2, 3) } -fun main(args: Array) { +@Test fun runTest() { bar() } diff --git a/backend.native/tests/codegen/inline/inline8.kt b/backend.native/tests/codegen/inline/inline8.kt index 714ae940700..99b659bee28 100644 --- a/backend.native/tests/codegen/inline/inline8.kt +++ b/backend.native/tests/codegen/inline/inline8.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline8 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i3: Int, i4: Int) : Int { return i3 + i3 + i4 @@ -7,6 +11,6 @@ fun bar(i1: Int, i2: Int) : Int { return foo(i1 + i2, 2) } -fun main(args: Array) { +@Test fun runTest() { println(bar(1, 2).toString()) } diff --git a/backend.native/tests/codegen/inline/inline9.kt b/backend.native/tests/codegen/inline/inline9.kt index bd33c725059..acb083c0d84 100644 --- a/backend.native/tests/codegen/inline/inline9.kt +++ b/backend.native/tests/codegen/inline/inline9.kt @@ -1,3 +1,7 @@ +package codegen.inline.inline9 + +import kotlin.test.* + @Suppress("NOTHING_TO_INLINE") inline fun foo(i3: Int, i4: Int): Int { return i3 + i3 + i4 @@ -12,6 +16,6 @@ fun bar(i1: Int, i2: Int): Int { return foo(quiz(i1), i2) } -fun main(args: Array) { +@Test fun runTest() { println(bar(1, 2).toString()) } diff --git a/backend.native/tests/codegen/innerClass/doubleInner.kt b/backend.native/tests/codegen/innerClass/doubleInner.kt index 449b3a2e093..af80c8c5005 100644 --- a/backend.native/tests/codegen/innerClass/doubleInner.kt +++ b/backend.native/tests/codegen/innerClass/doubleInner.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.doubleInner + +import kotlin.test.* + open class Father(val param: String) { abstract inner class InClass { fun work(): String { @@ -16,6 +20,6 @@ fun box(): String { return Father("fail").Child("OK").Child2().work() } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/generic.kt b/backend.native/tests/codegen/innerClass/generic.kt index 776d631f727..d0f5566706a 100644 --- a/backend.native/tests/codegen/innerClass/generic.kt +++ b/backend.native/tests/codegen/innerClass/generic.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.generic + +import kotlin.test.* + class Outer { inner class Inner(val t: T) { fun box() = t @@ -10,6 +14,6 @@ fun box(): String { return x.box() } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/getOuterVal.kt b/backend.native/tests/codegen/innerClass/getOuterVal.kt index eb0c13b1de6..0ce240f3ad5 100644 --- a/backend.native/tests/codegen/innerClass/getOuterVal.kt +++ b/backend.native/tests/codegen/innerClass/getOuterVal.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.getOuterVal + +import kotlin.test.* + class Outer(val s: String) { inner class Inner { fun box() = s @@ -6,7 +10,7 @@ class Outer(val s: String) { fun box() = Outer("OK").Inner().box() -fun main(args: Array) +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/noPrimaryConstructor.kt b/backend.native/tests/codegen/innerClass/noPrimaryConstructor.kt index e0fd1064fdb..0c26194750a 100644 --- a/backend.native/tests/codegen/innerClass/noPrimaryConstructor.kt +++ b/backend.native/tests/codegen/innerClass/noPrimaryConstructor.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.noPrimaryConstructor + +import kotlin.test.* + class Outer(val s: String) { inner class Inner { constructor(x: Int) { @@ -15,7 +19,7 @@ class Outer(val s: String) { } -fun main(args: Array) { +@Test fun runTest() { println(Outer("OK").Inner(42).foo()) println(Outer("OK").Inner("zzz").foo()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/qualifiedThis.kt b/backend.native/tests/codegen/innerClass/qualifiedThis.kt index 3c7b395333e..837c11e920a 100644 --- a/backend.native/tests/codegen/innerClass/qualifiedThis.kt +++ b/backend.native/tests/codegen/innerClass/qualifiedThis.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.qualifiedThis + +import kotlin.test.* + open class ABase { open fun zzz() = "a_base" diff --git a/backend.native/tests/codegen/innerClass/secondaryConstructor.kt b/backend.native/tests/codegen/innerClass/secondaryConstructor.kt index 8b23e100a48..1ab240b1bbd 100644 --- a/backend.native/tests/codegen/innerClass/secondaryConstructor.kt +++ b/backend.native/tests/codegen/innerClass/secondaryConstructor.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.secondaryConstructor + +import kotlin.test.* + class Outer(val x: Int) { inner class Inner() { inner class InnerInner() { diff --git a/backend.native/tests/codegen/innerClass/simple.kt b/backend.native/tests/codegen/innerClass/simple.kt index be91e5c99d3..a672acf6cea 100644 --- a/backend.native/tests/codegen/innerClass/simple.kt +++ b/backend.native/tests/codegen/innerClass/simple.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.simple + +import kotlin.test.* + class Outer { inner class Inner { fun box() = "OK" @@ -6,7 +10,7 @@ class Outer { fun box() = Outer().Inner().box() -fun main(args: Array) +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/superOuter.kt b/backend.native/tests/codegen/innerClass/superOuter.kt index 4d92568ee23..7b86c358d00 100644 --- a/backend.native/tests/codegen/innerClass/superOuter.kt +++ b/backend.native/tests/codegen/innerClass/superOuter.kt @@ -1,3 +1,7 @@ +package codegen.innerClass.superOuter + +import kotlin.test.* + open class Outer(val outer: String) { open inner class Inner(val inner: String): Outer(inner) { fun foo() = outer diff --git a/backend.native/tests/codegen/kclass/kclass0.kt b/backend.native/tests/codegen/kclass/kclass0.kt index 3ba740c41fd..0827989450a 100644 --- a/backend.native/tests/codegen/kclass/kclass0.kt +++ b/backend.native/tests/codegen/kclass/kclass0.kt @@ -1,5 +1,9 @@ import kotlin.reflect.KClass +@Test fun runTest() { + main(emptyArray()) +} + fun main(args: Array) { checkClass(Any::class, "kotlin.Any", "Any", Any(), null) checkClass(Int::class, "kotlin.Int", "Int", 42, "17") diff --git a/backend.native/tests/codegen/kclass/kclass1.kt b/backend.native/tests/codegen/kclass/kclass1.kt index 75864d454cb..6c0fcb51750 100644 --- a/backend.native/tests/codegen/kclass/kclass1.kt +++ b/backend.native/tests/codegen/kclass/kclass1.kt @@ -1,6 +1,10 @@ +package codegen.kclass.kclass1 + +import kotlin.test.* + // FILE: main.kt -fun main(args: Array) { - com.github.salomonbrys.kmffkn.App(testQualified = true) +@Test fun runTest() { + App(testQualified = true) } // FILE: app.kt @@ -8,8 +12,6 @@ fun main(args: Array) { // Taken from: // https://github.com/SalomonBrys/kmffkn/blob/master/shared/main/kotlin/com/github/salomonbrys/kmffkn/app.kt -package com.github.salomonbrys.kmffkn - @DslMarker annotation class MyDsl @@ -25,7 +27,7 @@ class KClassDsl { fun dsl(block: DslMain.() -> T): T = DslMain().block() -class Test +class TestClass class App(testQualified: Boolean) { @@ -33,7 +35,7 @@ class App(testQualified: Boolean) { var type = dsl { kClass { //kClass { } // This should error if uncommented because of `@DslMarker`. - of() + of() } } @@ -45,8 +47,8 @@ class App(testQualified: Boolean) { assert(String::class == String::class) assert(String::class != Int::class) - assert(Test()::class == Test()::class) - assert(Test()::class == Test::class) + assert(TestClass()::class == TestClass()::class) + assert(TestClass()::class == TestClass::class) println("OK :D") } diff --git a/backend.native/tests/codegen/lambda/lambda1.kt b/backend.native/tests/codegen/lambda/lambda1.kt index 6b83d2fddb4..55e628c61e4 100644 --- a/backend.native/tests/codegen/lambda/lambda1.kt +++ b/backend.native/tests/codegen/lambda/lambda1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda1 + +import kotlin.test.* + +@Test fun runTest() { run { println("lambda") } diff --git a/backend.native/tests/codegen/lambda/lambda10.kt b/backend.native/tests/codegen/lambda/lambda10.kt index 4c65f448a54..c705aadd127 100644 --- a/backend.native/tests/codegen/lambda/lambda10.kt +++ b/backend.native/tests/codegen/lambda/lambda10.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda10 + +import kotlin.test.* + +@Test fun runTest() { var str = "original" val lambda = { diff --git a/backend.native/tests/codegen/lambda/lambda11.kt b/backend.native/tests/codegen/lambda/lambda11.kt index ac6cfe05f38..c3ceb9d3707 100644 --- a/backend.native/tests/codegen/lambda/lambda11.kt +++ b/backend.native/tests/codegen/lambda/lambda11.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda11 + +import kotlin.test.* + +@Test fun runTest() { val first = "first" val second = "second" diff --git a/backend.native/tests/codegen/lambda/lambda12.kt b/backend.native/tests/codegen/lambda/lambda12.kt index 4bcbf55c4d8..ce772f70237 100644 --- a/backend.native/tests/codegen/lambda/lambda12.kt +++ b/backend.native/tests/codegen/lambda/lambda12.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda12 + +import kotlin.test.* + +@Test fun runTest() { val lambda = { s1: String, s2: String -> println(s1) println(s2) diff --git a/backend.native/tests/codegen/lambda/lambda13.kt b/backend.native/tests/codegen/lambda/lambda13.kt index f037ce6237c..095bd2938be 100644 --- a/backend.native/tests/codegen/lambda/lambda13.kt +++ b/backend.native/tests/codegen/lambda/lambda13.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.lambda.lambda13 + +import kotlin.test.* + +@Test fun runTest() { apply("foo") { println(this) } diff --git a/backend.native/tests/codegen/lambda/lambda2.kt b/backend.native/tests/codegen/lambda/lambda2.kt index 09b560e519a..4beae9ff65b 100644 --- a/backend.native/tests/codegen/lambda/lambda2.kt +++ b/backend.native/tests/codegen/lambda/lambda2.kt @@ -1,3 +1,11 @@ +package codegen.lambda.lambda2 + +import kotlin.test.* + +@Test fun runTest() { + main(arrayOf("arg0")) +} + fun main(args : Array) { run { println(args[0]) diff --git a/backend.native/tests/codegen/lambda/lambda3.kt b/backend.native/tests/codegen/lambda/lambda3.kt index e9e195f3521..e2e226bfed5 100644 --- a/backend.native/tests/codegen/lambda/lambda3.kt +++ b/backend.native/tests/codegen/lambda/lambda3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda3 + +import kotlin.test.* + +@Test fun runTest() { var str = "lambda" run { println(str) diff --git a/backend.native/tests/codegen/lambda/lambda4.kt b/backend.native/tests/codegen/lambda/lambda4.kt index 47c633c3f57..104862d8e1a 100644 --- a/backend.native/tests/codegen/lambda/lambda4.kt +++ b/backend.native/tests/codegen/lambda/lambda4.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda4 + +import kotlin.test.* + +@Test fun runTest() { val lambda = bar() lambda() lambda() diff --git a/backend.native/tests/codegen/lambda/lambda5.kt b/backend.native/tests/codegen/lambda/lambda5.kt index 83b6f604266..7d7061c509e 100644 --- a/backend.native/tests/codegen/lambda/lambda5.kt +++ b/backend.native/tests/codegen/lambda/lambda5.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda5 + +import kotlin.test.* + +@Test fun runTest() { foo { println(it) } diff --git a/backend.native/tests/codegen/lambda/lambda6.kt b/backend.native/tests/codegen/lambda/lambda6.kt index 7517c4f9f60..2cff0c10dcb 100644 --- a/backend.native/tests/codegen/lambda/lambda6.kt +++ b/backend.native/tests/codegen/lambda/lambda6.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda6 + +import kotlin.test.* + +@Test fun runTest() { val str = "captured" foo { println(it) diff --git a/backend.native/tests/codegen/lambda/lambda7.kt b/backend.native/tests/codegen/lambda/lambda7.kt index 63c9354a1a7..e38a308f35e 100644 --- a/backend.native/tests/codegen/lambda/lambda7.kt +++ b/backend.native/tests/codegen/lambda/lambda7.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda7 + +import kotlin.test.* + +@Test fun runTest() { val x = foo { it + 1 } diff --git a/backend.native/tests/codegen/lambda/lambda8.kt b/backend.native/tests/codegen/lambda/lambda8.kt index 1872919ca71..a44fcb990b7 100644 --- a/backend.native/tests/codegen/lambda/lambda8.kt +++ b/backend.native/tests/codegen/lambda/lambda8.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda8 + +import kotlin.test.* + +@Test fun runTest() { val lambda1 = bar("first") val lambda2 = bar("second") diff --git a/backend.native/tests/codegen/lambda/lambda9.kt b/backend.native/tests/codegen/lambda/lambda9.kt index b330c3ee124..5a65b7a8d48 100644 --- a/backend.native/tests/codegen/lambda/lambda9.kt +++ b/backend.native/tests/codegen/lambda/lambda9.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.lambda.lambda9 + +import kotlin.test.* + +@Test fun runTest() { val lambdas = ArrayList<() -> Unit>() for (i in 0..1) { diff --git a/backend.native/tests/codegen/lateinit/inBaseClass.kt b/backend.native/tests/codegen/lateinit/inBaseClass.kt index e1eae6146c2..a272b060b9e 100644 --- a/backend.native/tests/codegen/lateinit/inBaseClass.kt +++ b/backend.native/tests/codegen/lateinit/inBaseClass.kt @@ -1,3 +1,7 @@ +package codegen.lateinit.inBaseClass + +import kotlin.test.* + class A(val a: Int) open class B { @@ -8,7 +12,7 @@ class C: B() { fun foo() { a = A(42) } } -fun main(args: Array) { +@Test fun runTest() { val c = C() c.foo() println(c.a.a) diff --git a/backend.native/tests/codegen/lateinit/initialized.kt b/backend.native/tests/codegen/lateinit/initialized.kt index 97828fada07..3ad77cb4e0b 100644 --- a/backend.native/tests/codegen/lateinit/initialized.kt +++ b/backend.native/tests/codegen/lateinit/initialized.kt @@ -1,10 +1,14 @@ +package codegen.lateinit.initialized + +import kotlin.test.* + class A { lateinit var s: String fun foo() = s } -fun main(args: Array) { +@Test fun runTest() { val a = A() a.s = "zzz" println(a.foo()) diff --git a/backend.native/tests/codegen/lateinit/notInitialized.kt b/backend.native/tests/codegen/lateinit/notInitialized.kt index fa72164c21e..91e43077da5 100644 --- a/backend.native/tests/codegen/lateinit/notInitialized.kt +++ b/backend.native/tests/codegen/lateinit/notInitialized.kt @@ -1,10 +1,14 @@ +package codegen.lateinit.notInitialized + +import kotlin.test.* + class A { lateinit var s: String fun foo() = s } -fun main(args: Array) { +@Test fun runTest() { val a = A() try { println(a.foo()) diff --git a/backend.native/tests/codegen/localClass/innerTakesCapturedFromOuter.kt b/backend.native/tests/codegen/localClass/innerTakesCapturedFromOuter.kt index 464c3193a41..fd3fc50c6cc 100644 --- a/backend.native/tests/codegen/localClass/innerTakesCapturedFromOuter.kt +++ b/backend.native/tests/codegen/localClass/innerTakesCapturedFromOuter.kt @@ -1,3 +1,7 @@ +package codegen.localClass.innerTakesCapturedFromOuter + +import kotlin.test.* + fun box() { var previous: Any? = null for (i in 0 .. 2) { @@ -13,6 +17,6 @@ fun box() { } } -fun main(args: Array) { +@Test fun runTest() { box() } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/innerWithCapture.kt b/backend.native/tests/codegen/localClass/innerWithCapture.kt index b030793a34a..f15b619a7b0 100644 --- a/backend.native/tests/codegen/localClass/innerWithCapture.kt +++ b/backend.native/tests/codegen/localClass/innerWithCapture.kt @@ -1,3 +1,7 @@ +package codegen.localClass.innerWithCapture + +import kotlin.test.* + fun box(s: String): String { class Local { open inner class Inner() { @@ -8,6 +12,6 @@ fun box(s: String): String { return Local().Inner().result() } -fun main(args : Array) { +@Test fun runTest() { println(box("OK")) } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/localFunctionCallFromLocalClass.kt b/backend.native/tests/codegen/localClass/localFunctionCallFromLocalClass.kt index 469209e409d..25b2c8f2e07 100644 --- a/backend.native/tests/codegen/localClass/localFunctionCallFromLocalClass.kt +++ b/backend.native/tests/codegen/localClass/localFunctionCallFromLocalClass.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.localClass.localFunctionCallFromLocalClass + +import kotlin.test.* + +@Test fun runTest() { var x = 1 fun local1() { x++ diff --git a/backend.native/tests/codegen/localClass/localFunctionInLocalClass.kt b/backend.native/tests/codegen/localClass/localFunctionInLocalClass.kt index 103daedd0f8..d6364cd9795 100644 --- a/backend.native/tests/codegen/localClass/localFunctionInLocalClass.kt +++ b/backend.native/tests/codegen/localClass/localFunctionInLocalClass.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.localClass.localFunctionInLocalClass + +import kotlin.test.* + +@Test fun runTest() { var x = 0 class A { fun bar() { diff --git a/backend.native/tests/codegen/localClass/localHierarchy.kt b/backend.native/tests/codegen/localClass/localHierarchy.kt index 6f77ff78e25..08e90d2e71c 100644 --- a/backend.native/tests/codegen/localClass/localHierarchy.kt +++ b/backend.native/tests/codegen/localClass/localHierarchy.kt @@ -1,3 +1,7 @@ +package codegen.localClass.localHierarchy + +import kotlin.test.* + fun foo(s: String): String { open class Local { fun f() = s @@ -10,6 +14,6 @@ fun foo(s: String): String { return Derived().g() } -fun main(args: Array) { +@Test fun runTest() { println(foo("OK")) } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/noPrimaryConstructor.kt b/backend.native/tests/codegen/localClass/noPrimaryConstructor.kt index 4d43dc95619..b3062e2818a 100644 --- a/backend.native/tests/codegen/localClass/noPrimaryConstructor.kt +++ b/backend.native/tests/codegen/localClass/noPrimaryConstructor.kt @@ -1,3 +1,7 @@ +package codegen.localClass.noPrimaryConstructor + +import kotlin.test.* + fun box(s: String): String { class Local { constructor(x: Int) { @@ -16,6 +20,6 @@ fun box(s: String): String { return Local(42).result() + Local("zzz").result() } -fun main(args : Array) { +@Test fun runTest() { println(box("OK")) } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/objectExpressionInInitializer.kt b/backend.native/tests/codegen/localClass/objectExpressionInInitializer.kt index 653df8e98e7..fd09d6811b6 100644 --- a/backend.native/tests/codegen/localClass/objectExpressionInInitializer.kt +++ b/backend.native/tests/codegen/localClass/objectExpressionInInitializer.kt @@ -1,3 +1,7 @@ +package codegen.localClass.objectExpressionInInitializer + +import kotlin.test.* + abstract class Father { abstract inner class InClass { abstract fun work(): String @@ -20,6 +24,6 @@ fun box(): String { return Child().ChildInClass.work() } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/objectExpressionInProperty.kt b/backend.native/tests/codegen/localClass/objectExpressionInProperty.kt index 3683f7b0dd2..c2dfe9989eb 100644 --- a/backend.native/tests/codegen/localClass/objectExpressionInProperty.kt +++ b/backend.native/tests/codegen/localClass/objectExpressionInProperty.kt @@ -1,3 +1,7 @@ +package codegen.localClass.objectExpressionInProperty + +import kotlin.test.* + abstract class Father { abstract inner class InClass { abstract fun work(): String @@ -16,6 +20,6 @@ fun box(): String { return Child().ChildInClass.work() } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/tryCatch.kt b/backend.native/tests/codegen/localClass/tryCatch.kt index b75c2b0e403..f5a541fbc2c 100644 --- a/backend.native/tests/codegen/localClass/tryCatch.kt +++ b/backend.native/tests/codegen/localClass/tryCatch.kt @@ -1,3 +1,7 @@ +package codegen.localClass.tryCatch + +import kotlin.test.* + private fun foo() { val local = object { @@ -11,6 +15,6 @@ private fun foo() { local.bar() } -fun main(args: Array) { +@Test fun runTest() { foo() } \ No newline at end of file diff --git a/backend.native/tests/codegen/localClass/virtualCallFromConstructor.kt b/backend.native/tests/codegen/localClass/virtualCallFromConstructor.kt index 230b5ebe0f3..5422985ee4e 100644 --- a/backend.native/tests/codegen/localClass/virtualCallFromConstructor.kt +++ b/backend.native/tests/codegen/localClass/virtualCallFromConstructor.kt @@ -1,3 +1,7 @@ +package codegen.localClass.virtualCallFromConstructor + +import kotlin.test.* + abstract class WaitFor { init { condition() @@ -20,6 +24,6 @@ fun box(): String { return result; } -fun main(args: Array) { +@Test fun runTest() { println(box()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/object/constructor.kt b/backend.native/tests/codegen/object/constructor.kt index 2ca97303454..b55d69e222a 100644 --- a/backend.native/tests/codegen/object/constructor.kt +++ b/backend.native/tests/codegen/object/constructor.kt @@ -1,3 +1,5 @@ +package codegen.`object`.constructor + class A() class B(val a:Int) diff --git a/backend.native/tests/codegen/object/constructor0.kt b/backend.native/tests/codegen/object/constructor0.kt index 49c37a627d0..bde468d6a09 100644 --- a/backend.native/tests/codegen/object/constructor0.kt +++ b/backend.native/tests/codegen/object/constructor0.kt @@ -1,3 +1,7 @@ +package codegen.`object`.constructor0 + +import kotlin.test.* + class A { var field0:Int = 0; constructor(arg0:Int) { diff --git a/backend.native/tests/codegen/object/fields.kt b/backend.native/tests/codegen/object/fields.kt index 1a73052ee81..66296ce02c3 100644 --- a/backend.native/tests/codegen/object/fields.kt +++ b/backend.native/tests/codegen/object/fields.kt @@ -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) { +@Test fun runTest() { if (global != 1) throw Error() if (globalTest(41) != 42) throw Error() if (global != 42) throw Error() diff --git a/backend.native/tests/codegen/object/fields1.kt b/backend.native/tests/codegen/object/fields1.kt index d82041af7b6..f4f8d29dbff 100644 --- a/backend.native/tests/codegen/object/fields1.kt +++ b/backend.native/tests/codegen/object/fields1.kt @@ -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) { +@Test fun runTest() { if (primaryConstructorCall(0xdeadbeef.toInt(), 41) != 42) throw Error() if (secondaryConstructorCall(41) != 42) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/object/fields2.kt b/backend.native/tests/codegen/object/fields2.kt index 070fd6ba170..e807879275b 100644 --- a/backend.native/tests/codegen/object/fields2.kt +++ b/backend.native/tests/codegen/object/fields2.kt @@ -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) { +@Test fun runTest() { global = 1 - val test = Test() + val test = TestClass() test.member = 42 global = test.member diff --git a/backend.native/tests/codegen/object/init0.kt b/backend.native/tests/codegen/object/init0.kt index 825a4d75ee3..0bc8d6e9cbf 100644 --- a/backend.native/tests/codegen/object/init0.kt +++ b/backend.native/tests/codegen/object/init0.kt @@ -1,3 +1,7 @@ +package codegen.`object`.init0 + +import kotlin.test.* + class A(a:Int) { var i:Int = 0 init { diff --git a/backend.native/tests/codegen/object/initialization.kt b/backend.native/tests/codegen/object/initialization.kt index 5c75eb5d4de..531ab9c6d2c 100644 --- a/backend.native/tests/codegen/object/initialization.kt +++ b/backend.native/tests/codegen/object/initialization.kt @@ -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) { +@Test fun runTest() { if (foo(2, 3) != 5) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/object/initialization1.kt b/backend.native/tests/codegen/object/initialization1.kt index 2756dbe536f..2bc4c9be8d7 100644 --- a/backend.native/tests/codegen/object/initialization1.kt +++ b/backend.native/tests/codegen/object/initialization1.kt @@ -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) { - Test() - Test(1) +@Test fun runTest() { + TestClass() + TestClass(1) } \ No newline at end of file diff --git a/backend.native/tests/codegen/object/method_call.kt b/backend.native/tests/codegen/object/method_call.kt index 778d23d6cbf..f1875d7affb 100644 --- a/backend.native/tests/codegen/object/method_call.kt +++ b/backend.native/tests/codegen/object/method_call.kt @@ -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) { +@Test fun runTest() { if (fortyTwo() != 42) throw Error() } \ No newline at end of file diff --git a/backend.native/tests/codegen/objectExpression/1.kt b/backend.native/tests/codegen/objectExpression/1.kt index 60ca50c6ab7..716b392de51 100644 --- a/backend.native/tests/codegen/objectExpression/1.kt +++ b/backend.native/tests/codegen/objectExpression/1.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.objectExpression_1 + +import kotlin.test.* + +@Test fun runTest() { val a = "a" val x = object { diff --git a/backend.native/tests/codegen/objectExpression/2.kt b/backend.native/tests/codegen/objectExpression/2.kt index f6050b7496f..7efdaf4405b 100644 --- a/backend.native/tests/codegen/objectExpression/2.kt +++ b/backend.native/tests/codegen/objectExpression/2.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.objectExpression_2 + +import kotlin.test.* + +@Test fun runTest() { val a = "a" val x = object { diff --git a/backend.native/tests/codegen/objectExpression/3.kt b/backend.native/tests/codegen/objectExpression/3.kt index 36f5ee881d9..28f754e62ae 100644 --- a/backend.native/tests/codegen/objectExpression/3.kt +++ b/backend.native/tests/codegen/objectExpression/3.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package codegen.objectExpression_3 + +import kotlin.test.* + +@Test fun runTest() { var cnt = 0 var x: Any = "" diff --git a/backend.native/tests/codegen/propertyCallableReference/dynamicReceiver.kt b/backend.native/tests/codegen/propertyCallableReference/dynamicReceiver.kt index 7219bac5791..5b1d1ba0860 100644 --- a/backend.native/tests/codegen/propertyCallableReference/dynamicReceiver.kt +++ b/backend.native/tests/codegen/propertyCallableReference/dynamicReceiver.kt @@ -1,12 +1,16 @@ -class Test { +package codegen.propertyCallableReference.dynamicReceiver + +import kotlin.test.* + +class TestClass { var x: Int = 42 } -fun foo(): Test { +fun foo(): TestClass { println(42) - return Test() + return TestClass() } -fun main(args: Array) { +@Test fun runTest() { foo()::x } \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt b/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt index 7595b1acde4..10e980b7165 100644 --- a/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt +++ b/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt @@ -1,3 +1,3 @@ -package a +package codegen.propertyCallableReference.linkTest.a class A(val x: Int) \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt b/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt index 5af7b724a75..7fb5069cc1e 100644 --- a/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt +++ b/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt @@ -1,6 +1,10 @@ -import a.A +package codegen.propertyCallableReference.linkTest_main -fun main(args: Array) { +import kotlin.test.* + +import codegen.propertyCallableReference.linkTest.a.A + +@Test fun runTest() { val p1 = A::x println(p1.get(A(42))) val a = A(117) diff --git a/backend.native/tests/codegen/propertyCallableReference/valClass.kt b/backend.native/tests/codegen/propertyCallableReference/valClass.kt index 9e3f29f56f5..ef9f50451cc 100644 --- a/backend.native/tests/codegen/propertyCallableReference/valClass.kt +++ b/backend.native/tests/codegen/propertyCallableReference/valClass.kt @@ -1,6 +1,10 @@ +package codegen.propertyCallableReference.valClass + +import kotlin.test.* + class A(val x: Int) -fun main(args: Array) { +@Test fun runTest() { val p1 = A::x println(p1.get(A(42))) val a = A(117) diff --git a/backend.native/tests/codegen/propertyCallableReference/valExtension.kt b/backend.native/tests/codegen/propertyCallableReference/valExtension.kt index ef7a7dcc4ee..b73a886a254 100644 --- a/backend.native/tests/codegen/propertyCallableReference/valExtension.kt +++ b/backend.native/tests/codegen/propertyCallableReference/valExtension.kt @@ -1,10 +1,14 @@ +package codegen.propertyCallableReference.valExtension + +import kotlin.test.* + class A(y: Int) { var x = y } val A.z get() = this.x -fun main(args: Array) { +@Test fun runTest() { val p1 = A::z println(p1.get(A(42))) val a = A(117) diff --git a/backend.native/tests/codegen/propertyCallableReference/valModule.kt b/backend.native/tests/codegen/propertyCallableReference/valModule.kt index 800051cebfa..1f3545557d3 100644 --- a/backend.native/tests/codegen/propertyCallableReference/valModule.kt +++ b/backend.native/tests/codegen/propertyCallableReference/valModule.kt @@ -1,6 +1,10 @@ +package codegen.propertyCallableReference.valModule + +import kotlin.test.* + val x = 42 -fun main(args: Array) { +@Test fun runTest() { val p = ::x println(p.get()) } \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/varClass.kt b/backend.native/tests/codegen/propertyCallableReference/varClass.kt index a0b4e060a4e..4f351d31a5a 100644 --- a/backend.native/tests/codegen/propertyCallableReference/varClass.kt +++ b/backend.native/tests/codegen/propertyCallableReference/varClass.kt @@ -1,6 +1,10 @@ +package codegen.propertyCallableReference.varClass + +import kotlin.test.* + class A(var x: Int) -fun main(args: Array) { +@Test fun runTest() { val p1 = A::x val a = A(42) p1.set(a, 117) diff --git a/backend.native/tests/codegen/propertyCallableReference/varExtension.kt b/backend.native/tests/codegen/propertyCallableReference/varExtension.kt index 9f304fddd50..c1b3e3de4ee 100644 --- a/backend.native/tests/codegen/propertyCallableReference/varExtension.kt +++ b/backend.native/tests/codegen/propertyCallableReference/varExtension.kt @@ -1,3 +1,7 @@ +package codegen.propertyCallableReference.varExtension + +import kotlin.test.* + class A(y: Int) { var x = y } @@ -8,7 +12,7 @@ var A.z: Int this.x = value } -fun main(args: Array) { +@Test fun runTest() { val p1 = A::z val a = A(42) p1.set(a, 117) diff --git a/backend.native/tests/codegen/propertyCallableReference/varModule.kt b/backend.native/tests/codegen/propertyCallableReference/varModule.kt index 627076ca8f7..61bdf020a69 100644 --- a/backend.native/tests/codegen/propertyCallableReference/varModule.kt +++ b/backend.native/tests/codegen/propertyCallableReference/varModule.kt @@ -1,6 +1,10 @@ +package codegen.propertyCallableReference.varModule + +import kotlin.test.* + var x = 42 -fun main(args: Array) { +@Test fun runTest() { val p = ::x p.set(117) println(x) diff --git a/backend.native/tests/codegen/try/catch3.kt b/backend.native/tests/codegen/try/catch3.kt index dd27ebe2672..5e872f5e680 100644 --- a/backend.native/tests/codegen/try/catch3.kt +++ b/backend.native/tests/codegen/try/catch3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.catch3 + +import kotlin.test.* + +@Test fun runTest() { try { println("Before") throw Error("Error happens") diff --git a/backend.native/tests/codegen/try/catch4.kt b/backend.native/tests/codegen/try/catch4.kt index f646e8e757c..27750884838 100644 --- a/backend.native/tests/codegen/try/catch4.kt +++ b/backend.native/tests/codegen/try/catch4.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.catch4 + +import kotlin.test.* + +@Test fun runTest() { try { println("Before") throw Error("Error happens") diff --git a/backend.native/tests/codegen/try/catch5.kt b/backend.native/tests/codegen/try/catch5.kt index 473734c8b49..a9a5acb5bd2 100644 --- a/backend.native/tests/codegen/try/catch5.kt +++ b/backend.native/tests/codegen/try/catch5.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.catch5 + +import kotlin.test.* + +@Test fun runTest() { try { try { println("Before") diff --git a/backend.native/tests/codegen/try/catch6.kt b/backend.native/tests/codegen/try/catch6.kt index e4711332f31..1c951ae3e16 100644 --- a/backend.native/tests/codegen/try/catch6.kt +++ b/backend.native/tests/codegen/try/catch6.kt @@ -1,5 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.catch6 +import kotlin.test.* + +@Test fun runTest() { try { println("Before") foo() diff --git a/backend.native/tests/codegen/try/catch8.kt b/backend.native/tests/codegen/try/catch8.kt index 49327992216..09ed352e4a4 100644 --- a/backend.native/tests/codegen/try/catch8.kt +++ b/backend.native/tests/codegen/try/catch8.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.catch8 + +import kotlin.test.* + +@Test fun runTest() { try { throw Error("Error happens") } catch (e: Throwable) { diff --git a/backend.native/tests/codegen/try/finally1.kt b/backend.native/tests/codegen/try/finally1.kt index e2c1c257e39..73646ee32da 100644 --- a/backend.native/tests/codegen/try/finally1.kt +++ b/backend.native/tests/codegen/try/finally1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally1 + +import kotlin.test.* + +@Test fun runTest() { try { println("Try") diff --git a/backend.native/tests/codegen/try/finally10.kt b/backend.native/tests/codegen/try/finally10.kt index 8002437f697..e7a357591e6 100644 --- a/backend.native/tests/codegen/try/finally10.kt +++ b/backend.native/tests/codegen/try/finally10.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally10 + +import kotlin.test.* + +@Test fun runTest() { while (true) { try { continue diff --git a/backend.native/tests/codegen/try/finally11.kt b/backend.native/tests/codegen/try/finally11.kt index dd630d4df17..8016b51dee1 100644 --- a/backend.native/tests/codegen/try/finally11.kt +++ b/backend.native/tests/codegen/try/finally11.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally11 + +import kotlin.test.* + +@Test fun runTest() { try { try { return diff --git a/backend.native/tests/codegen/try/finally2.kt b/backend.native/tests/codegen/try/finally2.kt index 3edb2b73220..68bcd828561 100644 --- a/backend.native/tests/codegen/try/finally2.kt +++ b/backend.native/tests/codegen/try/finally2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally2 + +import kotlin.test.* + +@Test fun runTest() { try { println("Try") diff --git a/backend.native/tests/codegen/try/finally3.kt b/backend.native/tests/codegen/try/finally3.kt index 7e6ab694d7d..31db0055925 100644 --- a/backend.native/tests/codegen/try/finally3.kt +++ b/backend.native/tests/codegen/try/finally3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally3 + +import kotlin.test.* + +@Test fun runTest() { try { try { diff --git a/backend.native/tests/codegen/try/finally4.kt b/backend.native/tests/codegen/try/finally4.kt index 0a9a317c731..75ed9eb82a7 100644 --- a/backend.native/tests/codegen/try/finally4.kt +++ b/backend.native/tests/codegen/try/finally4.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally4 + +import kotlin.test.* + +@Test fun runTest() { try { try { diff --git a/backend.native/tests/codegen/try/finally5.kt b/backend.native/tests/codegen/try/finally5.kt index ebd72f51907..8e8826bca59 100644 --- a/backend.native/tests/codegen/try/finally5.kt +++ b/backend.native/tests/codegen/try/finally5.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally5 + +import kotlin.test.* + +@Test fun runTest() { println(foo()) } diff --git a/backend.native/tests/codegen/try/finally6.kt b/backend.native/tests/codegen/try/finally6.kt index b60e13a0899..128eeed34ad 100644 --- a/backend.native/tests/codegen/try/finally6.kt +++ b/backend.native/tests/codegen/try/finally6.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally6 + +import kotlin.test.* + +@Test fun runTest() { println(foo()) } diff --git a/backend.native/tests/codegen/try/finally7.kt b/backend.native/tests/codegen/try/finally7.kt index b9d7e936ac3..c8dd4d6250a 100644 --- a/backend.native/tests/codegen/try/finally7.kt +++ b/backend.native/tests/codegen/try/finally7.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally7 + +import kotlin.test.* + +@Test fun runTest() { println(foo()) } diff --git a/backend.native/tests/codegen/try/finally8.kt b/backend.native/tests/codegen/try/finally8.kt index d7b876e06d7..5d35fb5efd7 100644 --- a/backend.native/tests/codegen/try/finally8.kt +++ b/backend.native/tests/codegen/try/finally8.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally8 + +import kotlin.test.* + +@Test fun runTest() { println(foo()) } diff --git a/backend.native/tests/codegen/try/finally9.kt b/backend.native/tests/codegen/try/finally9.kt index 46f75d4471d..3fd8b888555 100644 --- a/backend.native/tests/codegen/try/finally9.kt +++ b/backend.native/tests/codegen/try/finally9.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.finally9 + +import kotlin.test.* + +@Test fun runTest() { do { try { break diff --git a/backend.native/tests/codegen/try/try1.kt b/backend.native/tests/codegen/try/try1.kt index e4f54d70fb7..46708efd467 100644 --- a/backend.native/tests/codegen/try/try1.kt +++ b/backend.native/tests/codegen/try/try1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.try1 + +import kotlin.test.* + +@Test fun runTest() { val x = try { 5 } catch (e: Throwable) { diff --git a/backend.native/tests/codegen/try/try2.kt b/backend.native/tests/codegen/try/try2.kt index f40fc73e7a0..c4c815bbee6 100644 --- a/backend.native/tests/codegen/try/try2.kt +++ b/backend.native/tests/codegen/try/try2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.try2 + +import kotlin.test.* + +@Test fun runTest() { val x = try { throw Error() 5 diff --git a/backend.native/tests/codegen/try/try3.kt b/backend.native/tests/codegen/try/try3.kt index 5a5c1a41c88..85513f5951d 100644 --- a/backend.native/tests/codegen/try/try3.kt +++ b/backend.native/tests/codegen/try/try3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.try3 + +import kotlin.test.* + +@Test fun runTest() { val x = try { throw Error() } catch (e: Throwable) { diff --git a/backend.native/tests/codegen/try/try4.kt b/backend.native/tests/codegen/try/try4.kt index 800ebade889..e94bec529ed 100644 --- a/backend.native/tests/codegen/try/try4.kt +++ b/backend.native/tests/codegen/try/try4.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package codegen.`try`.try4 + +import kotlin.test.* + +@Test fun runTest() { val x = try { println("Try") 5 diff --git a/backend.native/tests/datagen/literals/empty_string.kt b/backend.native/tests/datagen/literals/empty_string.kt index cc7ffd9fc06..73d0b892bd9 100644 --- a/backend.native/tests/datagen/literals/empty_string.kt +++ b/backend.native/tests/datagen/literals/empty_string.kt @@ -1,3 +1,7 @@ -fun main(args : Array) { +package datagen.literals.empty_string + +import kotlin.test.* + +@Test fun runTest() { println("") } diff --git a/backend.native/tests/datagen/literals/listof1.kt b/backend.native/tests/datagen/literals/listof1.kt index 237c9f1044d..4dd2439580f 100644 --- a/backend.native/tests/datagen/literals/listof1.kt +++ b/backend.native/tests/datagen/literals/listof1.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package datagen.literals.listof1 + +import kotlin.test.* + +@Test fun runTest() { val list = foo() println(list === foo()) println(list.toString()) diff --git a/backend.native/tests/datagen/literals/strdedup1.kt b/backend.native/tests/datagen/literals/strdedup1.kt index 366af2f3faf..a5e802fe1db 100644 --- a/backend.native/tests/datagen/literals/strdedup1.kt +++ b/backend.native/tests/datagen/literals/strdedup1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package datagen.literals.strdedup1 + +import kotlin.test.* + +@Test fun runTest() { val str1 = "Hello" val str2 = "Hello" println(str1 == str2) diff --git a/backend.native/tests/datagen/literals/strdedup2.kt b/backend.native/tests/datagen/literals/strdedup2.kt index 3da7f546b16..44045e06b0e 100644 --- a/backend.native/tests/datagen/literals/strdedup2.kt +++ b/backend.native/tests/datagen/literals/strdedup2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package datagen.literals.strdedup2 + +import kotlin.test.* + +@Test fun runTest() { val str1 = "" val str2 = "hello".subSequence(2, 2) println(str1 == str2) diff --git a/backend.native/tests/datagen/rtti/abstract_super.kt b/backend.native/tests/datagen/rtti/abstract_super.kt index d89e7d30d6e..c3c187e7be3 100644 --- a/backend.native/tests/datagen/rtti/abstract_super.kt +++ b/backend.native/tests/datagen/rtti/abstract_super.kt @@ -1,8 +1,12 @@ +package datagen.rtti.abstract_super + +import kotlin.test.* + abstract class Super class Foo : Super() -fun main(args: Array) { +@Test fun runTest() { // This test now checks that the source can be successfully compiled and linked; // TODO: check the contents of TypeInfo? } diff --git a/backend.native/tests/datagen/rtti/vtable1.kt b/backend.native/tests/datagen/rtti/vtable1.kt index 03fc2d099ee..5d02af7cc56 100644 --- a/backend.native/tests/datagen/rtti/vtable1.kt +++ b/backend.native/tests/datagen/rtti/vtable1.kt @@ -1,3 +1,7 @@ +package datagen.rtti.vtable1 + +import kotlin.test.* + abstract class Super { abstract fun bar() } @@ -6,7 +10,7 @@ class Foo : Super() { final override fun bar() {} } -fun main(args: Array) { +@Test fun runTest() { // This test now checks that the source can be successfully compiled and linked; // TODO: check the contents of TypeInfo? } \ No newline at end of file diff --git a/backend.native/tests/lower/tailrec.kt b/backend.native/tests/lower/tailrec.kt index 00fb8b486dc..50db56d4b15 100644 --- a/backend.native/tests/lower/tailrec.kt +++ b/backend.native/tests/lower/tailrec.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package lower.tailrec + +import kotlin.test.* + +@Test fun runTest() { println(add(5, 7)) println(add(100000000, 0)) diff --git a/backend.native/tests/lower/vararg.kt b/backend.native/tests/lower/vararg.kt index f93ffd02309..1a49b16f504 100644 --- a/backend.native/tests/lower/vararg.kt +++ b/backend.native/tests/lower/vararg.kt @@ -1,6 +1,10 @@ +package lower.vararg + +import kotlin.test.* + fun foo(vararg x: Any?) {} fun bar() = foo() -fun main(arg:Array) { +@Test fun runTest() { bar() } \ No newline at end of file diff --git a/backend.native/tests/lower/vararg_of_literals.kt b/backend.native/tests/lower/vararg_of_literals.kt index 93405766e5e..a1d9f5410de 100644 --- a/backend.native/tests/lower/vararg_of_literals.kt +++ b/backend.native/tests/lower/vararg_of_literals.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package lower.vararg_of_literals + +import kotlin.test.* + +@Test fun runTest() { foo() foo() } diff --git a/backend.native/tests/mangling/mangling.kt b/backend.native/tests/mangling/mangling.kt index 0da5a5bc04e..8ea7bd17325 100644 --- a/backend.native/tests/mangling/mangling.kt +++ b/backend.native/tests/mangling/mangling.kt @@ -1,3 +1,7 @@ +package mangling.mangling + +import kotlin.test.* + fun test_direct() { val mutListInt = mutableListOf(1, 2, 3, 4) val mutListNum = mutableListOf(9, 10, 11, 12) @@ -28,7 +32,7 @@ fun test_multiple_constructors() { mangle3(number) } -fun main(args: Array) { +@Test fun runTest() { test_direct() test_param() test_multiple_constructors() diff --git a/backend.native/tests/mangling/manglinglib.kt b/backend.native/tests/mangling/manglinglib.kt index 4c75ddd7b04..ac062ebe75b 100644 --- a/backend.native/tests/mangling/manglinglib.kt +++ b/backend.native/tests/mangling/manglinglib.kt @@ -1,3 +1,5 @@ +package mangling.mangling + public fun mangle1(l: List) { println("Int direct $l") } diff --git a/backend.native/tests/runtime/basic/empty_substring.kt b/backend.native/tests/runtime/basic/empty_substring.kt index 1ac05561f70..ab03414d8f0 100644 --- a/backend.native/tests/runtime/basic/empty_substring.kt +++ b/backend.native/tests/runtime/basic/empty_substring.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.empty_substring + +import kotlin.test.* + +@Test fun runTest() { val hello = "Hello world" println(hello.subSequence(1, 1).toString()) } \ No newline at end of file diff --git a/backend.native/tests/runtime/basic/entry0.kt b/backend.native/tests/runtime/basic/entry0.kt index 3e0535a9925..2fc662bdefc 100644 --- a/backend.native/tests/runtime/basic/entry0.kt +++ b/backend.native/tests/runtime/basic/entry0.kt @@ -1,4 +1,4 @@ -package koko.lala +package runtime.basic.entry0 fun fail() { println("Test failed, this is a wrong main() function.") diff --git a/backend.native/tests/runtime/basic/entry1.kt b/backend.native/tests/runtime/basic/entry1.kt index 30878af591a..7a5e552274b 100644 --- a/backend.native/tests/runtime/basic/entry1.kt +++ b/backend.native/tests/runtime/basic/entry1.kt @@ -1,3 +1,5 @@ +package runtime.basic.entry1 + fun fail() { println("Test failed, this is a wrong main() function.") } diff --git a/backend.native/tests/runtime/basic/entry2.kt b/backend.native/tests/runtime/basic/entry2.kt index ce15f37213d..353f9b83715 100644 --- a/backend.native/tests/runtime/basic/entry2.kt +++ b/backend.native/tests/runtime/basic/entry2.kt @@ -1,3 +1,5 @@ +package runtime.basic.entry2 + fun main(args: Array) { fail() } diff --git a/backend.native/tests/runtime/basic/for0.kt b/backend.native/tests/runtime/basic/for0.kt index 82d22cf5e0f..58565776afa 100644 --- a/backend.native/tests/runtime/basic/for0.kt +++ b/backend.native/tests/runtime/basic/for0.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.for0 + +import kotlin.test.* + +@Test fun runTest() { val byteArray = ByteArray(3) byteArray[0] = 2 byteArray[1] = 3 diff --git a/backend.native/tests/runtime/basic/hash0.kt b/backend.native/tests/runtime/basic/hash0.kt index 72c76a82284..5a710e39cd8 100644 --- a/backend.native/tests/runtime/basic/hash0.kt +++ b/backend.native/tests/runtime/basic/hash0.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.hash0 + +import kotlin.test.* + +@Test fun runTest() { println(239.hashCode()) println((-1L).hashCode()) println('a'.hashCode()) diff --git a/backend.native/tests/runtime/basic/hello0.kt b/backend.native/tests/runtime/basic/hello0.kt index 98315b19d44..a1b8590f2cb 100644 --- a/backend.native/tests/runtime/basic/hello0.kt +++ b/backend.native/tests/runtime/basic/hello0.kt @@ -1,3 +1,7 @@ -fun main(args : Array) { +package runtime.basic.hello0 + +import kotlin.test.* + +@Test fun runTest() { println("Hello, world!") } diff --git a/backend.native/tests/runtime/basic/hello1.kt b/backend.native/tests/runtime/basic/hello1.kt index 6acde085c53..d39940189fe 100644 --- a/backend.native/tests/runtime/basic/hello1.kt +++ b/backend.native/tests/runtime/basic/hello1.kt @@ -1,3 +1,4 @@ +// TODO: TestRuner should be able to pass input to stdin // TODO: remove kotlin_native.io once overrides are in place. fun main(args : Array) { print(readLine().toString()) diff --git a/backend.native/tests/runtime/basic/hello2.kt b/backend.native/tests/runtime/basic/hello2.kt index 29d137d9b11..69e121d7f34 100644 --- a/backend.native/tests/runtime/basic/hello2.kt +++ b/backend.native/tests/runtime/basic/hello2.kt @@ -1,3 +1,4 @@ +// TODO: TestRuner should be able to pass input to stdin // TODO: remove kotlin_native.io once overrides are in place. fun main(args : Array) { print("you entered '" + readLine() + "'") diff --git a/backend.native/tests/runtime/basic/hello3.kt b/backend.native/tests/runtime/basic/hello3.kt index 579dfbe0625..a4faa900250 100644 --- a/backend.native/tests/runtime/basic/hello3.kt +++ b/backend.native/tests/runtime/basic/hello3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.hello3 + +import kotlin.test.* + +@Test fun runTest() { println(239) // TODO: enable, once override by name is implemented. println(true) diff --git a/backend.native/tests/runtime/basic/hello4.kt b/backend.native/tests/runtime/basic/hello4.kt index 77cb369ee71..abaff67eb2c 100644 --- a/backend.native/tests/runtime/basic/hello4.kt +++ b/backend.native/tests/runtime/basic/hello4.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.hello4 + +import kotlin.test.* + +@Test fun runTest() { val x = 2 println(if (x == 2) "Hello" else "Привет") println(if (x == 3) "Bye" else "Пока") diff --git a/backend.native/tests/runtime/basic/initializers0.kt b/backend.native/tests/runtime/basic/initializers0.kt index 9d93ea15ae6..4d9883718dc 100644 --- a/backend.native/tests/runtime/basic/initializers0.kt +++ b/backend.native/tests/runtime/basic/initializers0.kt @@ -1,3 +1,7 @@ +package runtime.basic.initializers0 + +import kotlin.test.* + class A { init{ println ("A::init") @@ -25,7 +29,7 @@ class A { } } -fun main(args:Array) { +@Test fun runTest() { println("main") A.foo() A.foo() diff --git a/backend.native/tests/runtime/basic/initializers1.kt b/backend.native/tests/runtime/basic/initializers1.kt index 3c0006dcd46..df9a9a7302b 100644 --- a/backend.native/tests/runtime/basic/initializers1.kt +++ b/backend.native/tests/runtime/basic/initializers1.kt @@ -1,4 +1,8 @@ -class Test { +package runtime.basic.initializers1 + +import kotlin.test.* + +class TestClass { companion object { init { println("Init Test") @@ -6,8 +10,8 @@ class Test { } } -fun main(args : Array) { - val t1 = Test() - val t2 = Test() +@Test fun runTest() { + val t1 = TestClass() + val t2 = TestClass() println("Done") } \ No newline at end of file diff --git a/backend.native/tests/runtime/basic/initializers2.kt b/backend.native/tests/runtime/basic/initializers2.kt index 51ccc478c14..3149e8c618e 100644 --- a/backend.native/tests/runtime/basic/initializers2.kt +++ b/backend.native/tests/runtime/basic/initializers2.kt @@ -1,3 +1,7 @@ +package runtime.basic.initializers2 + +import kotlin.test.* + class A(val msg: String) { init { println("init $msg") @@ -9,7 +13,7 @@ val globalValue1 = 1 val globalValue2 = A("globalValue2") val globalValue3 = A("globalValue3") -fun main(args: Array) { +@Test fun runTest() { println(globalValue1.toString()) println(globalValue2.toString()) println(globalValue3.toString()) diff --git a/backend.native/tests/runtime/basic/initializers3.kt b/backend.native/tests/runtime/basic/initializers3.kt index b2b93283752..4a9804f38ef 100644 --- a/backend.native/tests/runtime/basic/initializers3.kt +++ b/backend.native/tests/runtime/basic/initializers3.kt @@ -1,7 +1,11 @@ +package runtime.basic.initializers3 + +import kotlin.test.* + class Foo(val bar: Int) var x = Foo(42) -fun main(args: Array) { +@Test fun runTest() { println(x.bar) } \ No newline at end of file diff --git a/backend.native/tests/runtime/basic/initializers4.kt b/backend.native/tests/runtime/basic/initializers4.kt index 5c715f6be82..8d9ca66821b 100644 --- a/backend.native/tests/runtime/basic/initializers4.kt +++ b/backend.native/tests/runtime/basic/initializers4.kt @@ -1,7 +1,11 @@ +package runtime.basic.initializers4 + +import kotlin.test.* + const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1 val DOUBLE = Double.MAX_VALUE - 1.0 -fun main(args: Array) { +@Test fun runTest() { println(INT_MAX_POWER_OF_TWO) println(DOUBLE > 0.0) } diff --git a/backend.native/tests/runtime/basic/initializers5.kt b/backend.native/tests/runtime/basic/initializers5.kt index 1c801347fee..bc1b919a841 100644 --- a/backend.native/tests/runtime/basic/initializers5.kt +++ b/backend.native/tests/runtime/basic/initializers5.kt @@ -1,8 +1,12 @@ +package runtime.basic.initializers5 + +import kotlin.test.* + object A { val a = 42 val b = A.a } -fun main(args : Array) { +@Test fun runTest() { println(A.b) } \ No newline at end of file diff --git a/backend.native/tests/runtime/basic/interface0.kt b/backend.native/tests/runtime/basic/interface0.kt index a1dfbfcb891..24ba347ac23 100644 --- a/backend.native/tests/runtime/basic/interface0.kt +++ b/backend.native/tests/runtime/basic/interface0.kt @@ -1,3 +1,6 @@ +package runtime.basic.interface0 + +import kotlin.test.* interface A { fun b() = c() @@ -10,7 +13,7 @@ class B(): A { } } -fun main(args: Array) { +@Test fun runTest() { val a:A = B() a.b() } diff --git a/backend.native/tests/runtime/basic/libentry2.kt b/backend.native/tests/runtime/basic/libentry2.kt index b9d0e5ae40e..0e8177220d1 100644 --- a/backend.native/tests/runtime/basic/libentry2.kt +++ b/backend.native/tests/runtime/basic/libentry2.kt @@ -1,3 +1,5 @@ +package runtime.basic.entry2 + fun fail() { println("Test failed, this is a wrong main() function.") } diff --git a/backend.native/tests/runtime/basic/standard.kt b/backend.native/tests/runtime/basic/standard.kt index 698517766f5..cad780130a9 100644 --- a/backend.native/tests/runtime/basic/standard.kt +++ b/backend.native/tests/runtime/basic/standard.kt @@ -1,10 +1,14 @@ +package runtime.basic.standard + +import kotlin.test.* + class Foo(val bar: Int) fun assertEquals(actual: T, expected: T) { if (actual != expected) throw AssertionError("Assertion failed. Expected value: $expected, actual value: $actual") } -fun main(args: Array) { +@Test fun runTest() { try { TODO() throw AssertionError("TODO() doesn't throw an exception") diff --git a/backend.native/tests/runtime/basic/statements0.kt b/backend.native/tests/runtime/basic/statements0.kt index ec2c075985b..06bed1c8e38 100644 --- a/backend.native/tests/runtime/basic/statements0.kt +++ b/backend.native/tests/runtime/basic/statements0.kt @@ -1,3 +1,7 @@ +package runtime.basic.statements0 + +import kotlin.test.* + fun simple() { var a = 238 a++ @@ -27,7 +31,7 @@ fun fields() { println(foo.i) } -fun main(args: Array) { +@Test fun runTest() { simple() fields() } \ No newline at end of file diff --git a/backend.native/tests/runtime/basic/throw0.kt b/backend.native/tests/runtime/basic/throw0.kt index b899ca0acf1..6076b2dfa4f 100644 --- a/backend.native/tests/runtime/basic/throw0.kt +++ b/backend.native/tests/runtime/basic/throw0.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.throw0 + +import kotlin.test.* + +@Test fun runTest() { val cond = 1 if (cond == 2) throw RuntimeException() if (cond == 3) throw NoSuchElementException("no such element") diff --git a/backend.native/tests/runtime/basic/tostring0.kt b/backend.native/tests/runtime/basic/tostring0.kt index fb3bbe390af..02ecbd9c12b 100644 --- a/backend.native/tests/runtime/basic/tostring0.kt +++ b/backend.native/tests/runtime/basic/tostring0.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.tostring0 + +import kotlin.test.* + +@Test fun runTest() { println(127.toByte().toString()) println(255.toByte().toString()) println(239.toShort().toString()) diff --git a/backend.native/tests/runtime/basic/tostring1.kt b/backend.native/tests/runtime/basic/tostring1.kt index ac114d515ab..7112db67ddf 100644 --- a/backend.native/tests/runtime/basic/tostring1.kt +++ b/backend.native/tests/runtime/basic/tostring1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.tostring1 + +import kotlin.test.* + +@Test fun runTest() { val hello = "Hello world" println(hello.subSequence(1, 5).toString()) } \ No newline at end of file diff --git a/backend.native/tests/runtime/basic/tostring2.kt b/backend.native/tests/runtime/basic/tostring2.kt index 98b48764cf7..0867f0c842b 100644 --- a/backend.native/tests/runtime/basic/tostring2.kt +++ b/backend.native/tests/runtime/basic/tostring2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.basic.tostring2 + +import kotlin.test.* + +@Test fun runTest() { val hello = "Hello" val array = hello.toCharArray() for (ch in array) { diff --git a/backend.native/tests/runtime/basic/tostring3.kt b/backend.native/tests/runtime/basic/tostring3.kt index 771fa6b32bb..a8cc7f37116 100644 --- a/backend.native/tests/runtime/basic/tostring3.kt +++ b/backend.native/tests/runtime/basic/tostring3.kt @@ -1,3 +1,7 @@ +package runtime.basic.tostring3 + +import kotlin.test.* + fun testByte() { val values = ByteArray(2) values[0] = Byte.MIN_VALUE @@ -58,7 +62,7 @@ fun testDouble() { } } -fun main(args : Array) { +@Test fun runTest() { testByte() testShort() testInt() diff --git a/backend.native/tests/runtime/collections/AbstractMutableCollection.kt b/backend.native/tests/runtime/collections/AbstractMutableCollection.kt index dcd22160883..0547a47cb02 100644 --- a/backend.native/tests/runtime/collections/AbstractMutableCollection.kt +++ b/backend.native/tests/runtime/collections/AbstractMutableCollection.kt @@ -1,3 +1,7 @@ +package runtime.collections.AbstractMutableCollection + +import kotlin.test.* + class TestCollection(): AbstractMutableCollection() { companion object { const val SIZE = 7 @@ -48,7 +52,7 @@ fun assertEquals(a: TestCollection, b: List) { } } -fun main(args: Array) { +@Test fun runTest() { val c = TestCollection() if (!c.addAll(listOf(1, 2, 3, 2, 4, 5, 4))) throw AssertionError("addAll is false when it must be true.") if (c.addAll(listOf(1, 2)) != false) throw AssertionError("addAll is true when it must be false.") diff --git a/backend.native/tests/runtime/collections/BitSet.kt b/backend.native/tests/runtime/collections/BitSet.kt index 74615f31b8f..16307d82211 100644 --- a/backend.native/tests/runtime/collections/BitSet.kt +++ b/backend.native/tests/runtime/collections/BitSet.kt @@ -1,3 +1,7 @@ +package runtime.collections.BitSet + +import kotlin.test.* + fun assertContainsOnly(bitSet: BitSet, trueBits: Set, size: Int) { for (i in 0 until size) { val expectedBit = i in trueBits @@ -437,7 +441,7 @@ fun testEqualsHashCode() { assertTrue("Different sized BitSet with higher bits not set returned false", b1 == b3) } -fun main(args: Array) { +@Test fun runTest() { testConstructor() testSet() testFlip() diff --git a/backend.native/tests/runtime/collections/array0.kt b/backend.native/tests/runtime/collections/array0.kt index 01fa4aeded9..878e55b2f98 100644 --- a/backend.native/tests/runtime/collections/array0.kt +++ b/backend.native/tests/runtime/collections/array0.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.collections.array0 + +import kotlin.test.* + +@Test fun runTest() { // Create instances of all array types. val byteArray = ByteArray(5) println(byteArray.size.toString()) diff --git a/backend.native/tests/runtime/collections/array1.kt b/backend.native/tests/runtime/collections/array1.kt index 471b70be3b3..7ce65292f85 100644 --- a/backend.native/tests/runtime/collections/array1.kt +++ b/backend.native/tests/runtime/collections/array1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.collections.array1 + +import kotlin.test.* + +@Test fun runTest() { val byteArray = ByteArray(5) byteArray[1] = 2 byteArray[3] = 4 diff --git a/backend.native/tests/runtime/collections/array2.kt b/backend.native/tests/runtime/collections/array2.kt index edd2d3e1923..b309102db39 100644 --- a/backend.native/tests/runtime/collections/array2.kt +++ b/backend.native/tests/runtime/collections/array2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.collections.array2 + +import kotlin.test.* + +@Test fun runTest() { val byteArray = Array(5, { i -> (i * 2).toByte() }) byteArray.map { println(it) } diff --git a/backend.native/tests/runtime/collections/array3.kt b/backend.native/tests/runtime/collections/array3.kt index 8c94e9b8ef8..6ae54254a1f 100644 --- a/backend.native/tests/runtime/collections/array3.kt +++ b/backend.native/tests/runtime/collections/array3.kt @@ -1,6 +1,10 @@ +package runtime.collections.array3 + +import kotlin.test.* + import konan.* -fun main(args : Array) { +@Test fun runTest() { val data = immutableBinaryBlobOf(0x1, 0x2, 0x3, 0x7, 0x8, 0x9, 0x80, 0xff) for (b in data) { print("$b ") diff --git a/backend.native/tests/runtime/collections/array_list1.kt b/backend.native/tests/runtime/collections/array_list1.kt index e92e73781f7..74ff8d8d2dd 100644 --- a/backend.native/tests/runtime/collections/array_list1.kt +++ b/backend.native/tests/runtime/collections/array_list1.kt @@ -1,3 +1,7 @@ +package runtime.collections.array_list1 + +import kotlin.test.* + fun assertTrue(cond: Boolean) { if (!cond) println("FAIL") @@ -342,7 +346,7 @@ fun testIteratorAdd() { assertEquals(listOf("1", "2", "-2", "3", "4", "-4", "5"), a) } -fun main(args : Array) { +@Test fun runTest() { testBasic() testIterator() testRemove() diff --git a/backend.native/tests/runtime/collections/hash_map0.kt b/backend.native/tests/runtime/collections/hash_map0.kt index 37f3656b950..0ae0b3c5027 100644 --- a/backend.native/tests/runtime/collections/hash_map0.kt +++ b/backend.native/tests/runtime/collections/hash_map0.kt @@ -1,3 +1,7 @@ +package runtime.collections.hash_map0 + +import kotlin.test.* + fun assertTrue(cond: Boolean) { if (!cond) println("FAIL") @@ -247,7 +251,7 @@ fun testEntriesIteratorSet() { assertEquals(mapOf("a" to "1!", "b" to "2!", "c" to "3!"), m) } -fun main(args : Array) { +@Test fun runTest() { testBasic() testRehashAndCompact() testClear() diff --git a/backend.native/tests/runtime/collections/hash_set0.kt b/backend.native/tests/runtime/collections/hash_set0.kt index 5f9c95929ff..afab7a20f2a 100644 --- a/backend.native/tests/runtime/collections/hash_set0.kt +++ b/backend.native/tests/runtime/collections/hash_set0.kt @@ -1,3 +1,7 @@ +package runtime.collections.hash_set0 + +import kotlin.test.* + fun assertTrue(cond: Boolean) { if (!cond) println("FAIL") @@ -118,7 +122,7 @@ fun testRetainAll() { assertEquals(setOf("1", "3", "5"), s) } -fun main(args : Array) { +@Test fun runTest() { testBasic() testIterator() testEquals() diff --git a/backend.native/tests/runtime/collections/listof0.kt b/backend.native/tests/runtime/collections/listof0.kt index ee6495194fb..3f7997cc499 100644 --- a/backend.native/tests/runtime/collections/listof0.kt +++ b/backend.native/tests/runtime/collections/listof0.kt @@ -1,3 +1,11 @@ +package runtime.collections.listof0 + +import kotlin.test.* + +@Test fun runTest() { + main(arrayOf("a")) +} + fun main(args : Array) { val nonConstStr = args[0] val list = arrayListOf(nonConstStr, "b", "c") diff --git a/backend.native/tests/runtime/collections/moderately_large_array.kt b/backend.native/tests/runtime/collections/moderately_large_array.kt index f10bb2a2481..4fc56a979dc 100644 --- a/backend.native/tests/runtime/collections/moderately_large_array.kt +++ b/backend.native/tests/runtime/collections/moderately_large_array.kt @@ -1,5 +1,8 @@ +package runtime.collections.moderately_large_array -fun main(args: Array) { +import kotlin.test.* + +@Test fun runTest() { val a = ByteArray(1000000) var sum = 0 diff --git a/backend.native/tests/runtime/collections/moderately_large_array1.kt b/backend.native/tests/runtime/collections/moderately_large_array1.kt index 06db38faf13..e3f35ddcdb0 100644 --- a/backend.native/tests/runtime/collections/moderately_large_array1.kt +++ b/backend.native/tests/runtime/collections/moderately_large_array1.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package runtime.collections.moderately_large_array1 + +import kotlin.test.* + +@Test fun runTest() { val a = Array(100000, { i -> i.toByte()}) var sum = 0 diff --git a/backend.native/tests/runtime/collections/range0.kt b/backend.native/tests/runtime/collections/range0.kt index 5e80f26dd15..376ba03a2ae 100644 --- a/backend.native/tests/runtime/collections/range0.kt +++ b/backend.native/tests/runtime/collections/range0.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.collections.range0 + +import kotlin.test.* + +@Test fun runTest() { for (i in 1..3) print(i) println() for (i in 'a'..'d') print(i) diff --git a/backend.native/tests/runtime/collections/sort0.kt b/backend.native/tests/runtime/collections/sort0.kt index 18d0faa9d27..2c8467f7015 100644 --- a/backend.native/tests/runtime/collections/sort0.kt +++ b/backend.native/tests/runtime/collections/sort0.kt @@ -1,4 +1,8 @@ -fun main(a: Array) { +package runtime.collections.sort0 + +import kotlin.test.* + +@Test fun runTest() { println(arrayOf("x", "a", "b").sorted().toString()) println(intArrayOf(239, 42, -1, 100500, 0).sorted().toString()); } diff --git a/backend.native/tests/runtime/collections/sort1.kt b/backend.native/tests/runtime/collections/sort1.kt index 0670906516e..1a4fc2dfc90 100644 --- a/backend.native/tests/runtime/collections/sort1.kt +++ b/backend.native/tests/runtime/collections/sort1.kt @@ -1,4 +1,8 @@ -fun main(a: Array) { +package runtime.collections.sort1 + +import kotlin.test.* + +@Test fun runTest() { val foo = mutableListOf("x", "a", "b") foo.sort() println(foo.toString()) diff --git a/backend.native/tests/runtime/exceptions/catch1.kt b/backend.native/tests/runtime/exceptions/catch1.kt index 53e8b65ab0d..ccbb7666653 100644 --- a/backend.native/tests/runtime/exceptions/catch1.kt +++ b/backend.native/tests/runtime/exceptions/catch1.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.exceptions.catch1 + +import kotlin.test.* + +@Test fun runTest() { try { println("Before") foo() diff --git a/backend.native/tests/runtime/exceptions/catch2.kt b/backend.native/tests/runtime/exceptions/catch2.kt index 86bf162ffde..77a912f83bc 100644 --- a/backend.native/tests/runtime/exceptions/catch2.kt +++ b/backend.native/tests/runtime/exceptions/catch2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.exceptions.catch2 + +import kotlin.test.* + +@Test fun runTest() { try { println("Before") foo() diff --git a/backend.native/tests/runtime/exceptions/catch7.kt b/backend.native/tests/runtime/exceptions/catch7.kt index 766f17a369f..0ec875c58f6 100644 --- a/backend.native/tests/runtime/exceptions/catch7.kt +++ b/backend.native/tests/runtime/exceptions/catch7.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.exceptions.catch7 + +import kotlin.test.* + +@Test fun runTest() { try { foo() } catch (e: Throwable) { diff --git a/backend.native/tests/runtime/exceptions/extend0.kt b/backend.native/tests/runtime/exceptions/extend0.kt index 071a53363ff..397177f62d8 100644 --- a/backend.native/tests/runtime/exceptions/extend0.kt +++ b/backend.native/tests/runtime/exceptions/extend0.kt @@ -1,6 +1,10 @@ +package runtime.exceptions.extend0 + +import kotlin.test.* + class C : Exception("OK") -fun main(args: Array) { +@Test fun runTest() { try { throw C() } catch (e: Throwable) { diff --git a/backend.native/tests/runtime/memory/basic0.kt b/backend.native/tests/runtime/memory/basic0.kt index d8ed310c35f..9c4d95679df 100644 --- a/backend.native/tests/runtime/memory/basic0.kt +++ b/backend.native/tests/runtime/memory/basic0.kt @@ -1,10 +1,14 @@ +package runtime.memory.basic0 + +import kotlin.test.* + class A { var field: B? = null } class B(var field: Int) -fun main(args : Array) { +@Test fun runTest() { val a = A() a.field = B(2) } diff --git a/backend.native/tests/runtime/memory/cycles0.kt b/backend.native/tests/runtime/memory/cycles0.kt index dc7872d1c09..6537982d726 100644 --- a/backend.native/tests/runtime/memory/cycles0.kt +++ b/backend.native/tests/runtime/memory/cycles0.kt @@ -1,3 +1,7 @@ +package runtime.memory.cycles0 + +import kotlin.test.* + data class Node(val data: Int, var next: Node?, var prev: Node?, val outer: Node?) fun makeCycle(len: Int, outer: Node?): Node { @@ -35,7 +39,7 @@ fun createCycles(junk: Node) { } -fun main(args : Array) { +@Test fun runTest() { // Create outer link from cyclic garbage. val outer = Node(42, null, null, null) createCycles(outer) diff --git a/backend.native/tests/runtime/memory/escape0.kt b/backend.native/tests/runtime/memory/escape0.kt index 64655ed5ce2..f2caa8a0e35 100644 --- a/backend.native/tests/runtime/memory/escape0.kt +++ b/backend.native/tests/runtime/memory/escape0.kt @@ -1,3 +1,7 @@ +package runtime.memory.escape0 + +import kotlin.test.* + //fun foo1(arg: String) : String = foo0(arg) fun foo1(arg: Any) : Any = foo0(arg) @@ -46,7 +50,7 @@ fun zoo7(arg1: Any, arg2: Any, selector: Int) : Any { return if (selector < 2) arg1 else arg2; } -fun main(args : Array) { +@Test fun runTest() { //val z = zoo7(Any(), Any(), 1) val x = zoo5(Any()) //println(bar(foo1(foo2("")), foo2(foo1("")))) diff --git a/backend.native/tests/runtime/memory/escape1.kt b/backend.native/tests/runtime/memory/escape1.kt index 12f5bb91782..fe4c538b668 100644 --- a/backend.native/tests/runtime/memory/escape1.kt +++ b/backend.native/tests/runtime/memory/escape1.kt @@ -1,3 +1,7 @@ +package runtime.memory.escape1 + +import kotlin.test.* + class B(val s: String) class A { @@ -9,6 +13,6 @@ fun foo(): B { return a.b } -fun main(args: Array) { +@Test fun runTest() { println(foo().s) } \ No newline at end of file diff --git a/backend.native/tests/runtime/memory/escape2.kt b/backend.native/tests/runtime/memory/escape2.kt index d860d23370a..a2d7ff66eff 100644 --- a/backend.native/tests/runtime/memory/escape2.kt +++ b/backend.native/tests/runtime/memory/escape2.kt @@ -1,3 +1,7 @@ +package runtime.memory.escape2 + +import kotlin.test.* + class A(val s: String) class B { @@ -17,7 +21,7 @@ fun bar(b: B) { val global = B() -fun main(args: Array) { +@Test fun runTest() { bar(global) println(global.a!!.s) } \ No newline at end of file diff --git a/backend.native/tests/runtime/memory/throw_cleanup.kt b/backend.native/tests/runtime/memory/throw_cleanup.kt index 0c595b82e68..843943a2922 100644 --- a/backend.native/tests/runtime/memory/throw_cleanup.kt +++ b/backend.native/tests/runtime/memory/throw_cleanup.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package runtime.memory.throw_cleanup + +import kotlin.test.* + +@Test fun runTest() { foo(false) try { foo(true) diff --git a/backend.native/tests/runtime/memory/var1.kt b/backend.native/tests/runtime/memory/var1.kt index 2969dcad805..f7e3ff5f6fd 100644 --- a/backend.native/tests/runtime/memory/var1.kt +++ b/backend.native/tests/runtime/memory/var1.kt @@ -1,3 +1,7 @@ +package runtime.memory.var1 + +import kotlin.test.* + class Integer(val value: Int) { operator fun inc() = Integer(value + 1) } @@ -7,7 +11,7 @@ fun foo(x: Any, y: Any) { y.use() } -fun main(args : Array) { +@Test fun runTest() { var x = Integer(0) for (i in 0..1) { diff --git a/backend.native/tests/runtime/memory/var2.kt b/backend.native/tests/runtime/memory/var2.kt index aa064da42fa..a8dfbb583ac 100644 --- a/backend.native/tests/runtime/memory/var2.kt +++ b/backend.native/tests/runtime/memory/var2.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.memory.var2 + +import kotlin.test.* + +@Test fun runTest() { var x = Any() for (i in 0..1) { diff --git a/backend.native/tests/runtime/memory/var3.kt b/backend.native/tests/runtime/memory/var3.kt index 81030b928bc..7060027f51b 100644 --- a/backend.native/tests/runtime/memory/var3.kt +++ b/backend.native/tests/runtime/memory/var3.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.memory.var3 + +import kotlin.test.* + +@Test fun runTest() { foo().use() } diff --git a/backend.native/tests/runtime/memory/var4.kt b/backend.native/tests/runtime/memory/var4.kt index 37e3746880c..296904f8052 100644 --- a/backend.native/tests/runtime/memory/var4.kt +++ b/backend.native/tests/runtime/memory/var4.kt @@ -1,4 +1,8 @@ -fun main(args : Array) { +package runtime.memory.var4 + +import kotlin.test.* + +@Test fun runTest() { var x = Error() for (i in 0..1) { diff --git a/backend.native/tests/runtime/text/chars0.kt b/backend.native/tests/runtime/text/chars0.kt index 9465caa209b..56e875e6c12 100644 --- a/backend.native/tests/runtime/text/chars0.kt +++ b/backend.native/tests/runtime/text/chars0.kt @@ -1,3 +1,7 @@ +package runtime.text.chars0 + +import kotlin.test.* + fun assertTrue(v: Boolean) = if (!v) throw AssertionError() else Unit fun assertFalse(v: Boolean) = if (v) throw AssertionError() else Unit fun assertEquals(a: Int, b: Int) { if (a != b) throw AssertionError() } @@ -103,7 +107,7 @@ fun testCategory() { } catch (e: IllegalArgumentException) {} } -fun main(args: Array) { +@Test fun runTest() { testIsSurrogatePair() testToChars() testToCodePoint() diff --git a/backend.native/tests/runtime/text/parse0.kt b/backend.native/tests/runtime/text/parse0.kt index f7a1a71e1f3..97adc6add05 100644 --- a/backend.native/tests/runtime/text/parse0.kt +++ b/backend.native/tests/runtime/text/parse0.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package runtime.text.parse0 + +import kotlin.test.* + +@Test fun runTest() { println("false".toBoolean()) println("true".toBoolean()) println("-1".toByte()) diff --git a/backend.native/tests/runtime/text/string0.kt b/backend.native/tests/runtime/text/string0.kt index eb0a4b42dbf..27de10d073b 100644 --- a/backend.native/tests/runtime/text/string0.kt +++ b/backend.native/tests/runtime/text/string0.kt @@ -1,4 +1,8 @@ -fun main(args: Array) { +package runtime.text.string0 + +import kotlin.test.* + +@Test fun runTest() { val str = "hello" println(str.equals("HElLo", true)) val strI18n = "Привет" diff --git a/backend.native/tests/runtime/text/string_builder0.kt b/backend.native/tests/runtime/text/string_builder0.kt index b4481a72e0e..5c62698254d 100644 --- a/backend.native/tests/runtime/text/string_builder0.kt +++ b/backend.native/tests/runtime/text/string_builder0.kt @@ -1,3 +1,7 @@ +package runtime.text.string_builder0 + +import kotlin.test.* + // Utils ==================================================================================================== fun assertTrue(cond: Boolean) { if (!cond) @@ -262,7 +266,7 @@ fun testBasic() { assertEquals("", sb.toString()) } -fun main(args : Array) { +@Test fun runTest() { testBasic() testInsert() testReverse() diff --git a/backend.native/tests/runtime/text/string_builder1.kt b/backend.native/tests/runtime/text/string_builder1.kt index bb5e87dd14b..e055a018964 100644 --- a/backend.native/tests/runtime/text/string_builder1.kt +++ b/backend.native/tests/runtime/text/string_builder1.kt @@ -1,4 +1,8 @@ -fun main(arg:Array) { +package runtime.text.string_builder1 + +import kotlin.test.* + +@Test fun runTest() { val a = StringBuilder() a.append("Hello").appendln("Kotlin").appendln(42).appendln(0.1).appendln(true) println(a.toString()) diff --git a/backend.native/tests/runtime/text/to_string0.kt b/backend.native/tests/runtime/text/to_string0.kt index 0490f6a7ae0..b18d386c87e 100644 --- a/backend.native/tests/runtime/text/to_string0.kt +++ b/backend.native/tests/runtime/text/to_string0.kt @@ -1,3 +1,7 @@ +package runtime.text.to_string0 + +import kotlin.test.* + // Based on Apache Harmony tests. fun assertEquals(actual: String, expected: String, msg: String) { @@ -34,7 +38,7 @@ fun testLongToStringWithRadix() { } -fun main(args: Array) { +@Test fun runTest() { testIntToStringWithRadix() testLongToStringWithRadix() println("OK") diff --git a/backend.native/tests/runtime/workers/worker0.kt b/backend.native/tests/runtime/workers/worker0.kt index 223135e3090..ebdf02f4242 100644 --- a/backend.native/tests/runtime/workers/worker0.kt +++ b/backend.native/tests/runtime/workers/worker0.kt @@ -1,6 +1,10 @@ +package runtime.workers.worker0 + +import kotlin.test.* + import konan.worker.* -fun main(args: Array) { +@Test fun runTest() { val worker = startWorker() val future = worker.schedule(TransferMode.CHECKED, { "Input".shallowCopy()}) { input -> input + " processed" diff --git a/backend.native/tests/runtime/workers/worker1.kt b/backend.native/tests/runtime/workers/worker1.kt index 9bcbe4562c3..9b66585faaa 100644 --- a/backend.native/tests/runtime/workers/worker1.kt +++ b/backend.native/tests/runtime/workers/worker1.kt @@ -1,6 +1,10 @@ +package runtime.workers.worker1 + +import kotlin.test.* + import konan.worker.* -fun main(args: Array) { +@Test fun runTest() { val COUNT = 5 val workers = Array(COUNT, { _ -> startWorker()}) diff --git a/backend.native/tests/runtime/workers/worker2.kt b/backend.native/tests/runtime/workers/worker2.kt index 57cb7f7bbf8..5cf923b1e20 100644 --- a/backend.native/tests/runtime/workers/worker2.kt +++ b/backend.native/tests/runtime/workers/worker2.kt @@ -1,9 +1,13 @@ +package runtime.workers.worker2 + +import kotlin.test.* + import konan.worker.* data class WorkerArgument(val intParam: Int, val stringParam: String) data class WorkerResult(val intResult: Int, val stringResult: String) -fun main(args: Array) { +@Test fun runTest() { val COUNT = 5 val workers = Array(COUNT, { _ -> startWorker()}) diff --git a/backend.native/tests/runtime/workers/worker3.kt b/backend.native/tests/runtime/workers/worker3.kt index 783fd0e2c6d..d7d13388a5f 100644 --- a/backend.native/tests/runtime/workers/worker3.kt +++ b/backend.native/tests/runtime/workers/worker3.kt @@ -1,8 +1,16 @@ +package runtime.workers.worker3 + +import kotlin.test.* + import konan.worker.* data class WorkerArgument(val intParam: Int, val stringParam: String) data class WorkerResult(val intResult: Int, val stringResult: String) +@Test fun runTest() { + main(emptyArray()) +} + fun main(args: Array) { val worker = startWorker() val s = "zzz${args.size.toString()}" diff --git a/backend.native/tests/serialization/deserialize_members.kt b/backend.native/tests/serialization/deserialize_members.kt index a81f6661c92..3d0bb5fb878 100644 --- a/backend.native/tests/serialization/deserialize_members.kt +++ b/backend.native/tests/serialization/deserialize_members.kt @@ -1,6 +1,10 @@ -import foo.bar.* +package serialization.deserialize_members -fun main(args: Array) { +import kotlin.test.* + +import serialization.serialize_members.* + +@Test fun runTest() { val c = C() val d = C.D() val e = C.D.E() diff --git a/backend.native/tests/serialization/deserialized_inline0.kt b/backend.native/tests/serialization/deserialized_inline0.kt index bb787e1c1c8..1687a3f529c 100644 --- a/backend.native/tests/serialization/deserialized_inline0.kt +++ b/backend.native/tests/serialization/deserialized_inline0.kt @@ -1,3 +1,7 @@ +package serialization.deserialized_inline0 + +import kotlin.test.* + fun inline_todo() { try { @@ -28,7 +32,7 @@ fun inline_areEqual() { println(konan.internal.areEqual(b, b)) } -fun main(args: Array) { +@Test fun runTest() { inline_todo() inline_assert() inline_maxof() diff --git a/backend.native/tests/serialization/deserialized_listof0.kt b/backend.native/tests/serialization/deserialized_listof0.kt index ce5e429fb61..1400fb6db0d 100644 --- a/backend.native/tests/serialization/deserialized_listof0.kt +++ b/backend.native/tests/serialization/deserialized_listof0.kt @@ -1,3 +1,6 @@ +package serialization.deserialized_listof0 + +import kotlin.test.* fun test_arrayList() { val l = listOf(1, 2, 3) @@ -20,7 +23,7 @@ fun test_arrayList3() { println(n) } -fun main(args: Array) { +@Test fun runTest() { test_arrayList() test_arrayList2(5, 6, 7) test_arrayList2("a", "b", "c") diff --git a/backend.native/tests/serialization/serialize_members.kt b/backend.native/tests/serialization/serialize_members.kt index f9da87c3781..e10a3450082 100644 --- a/backend.native/tests/serialization/serialize_members.kt +++ b/backend.native/tests/serialization/serialize_members.kt @@ -1,4 +1,4 @@ -package foo.bar +package serialization.serialize_members class R { inline fun bar(t: T) { diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 7241eb45cda..a05b22cbe74 100644 --- a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -295,6 +295,7 @@ class TestFailedException extends RuntimeException { super(s) } } + class RunKonanTest extends KonanTest { void compileTest(List filesToCompile, String exe) { runCompiler(filesToCompile, exe, flags?:[])