From 268e3b26c0ba0ac6374780f1e91e891a0f19aead Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Tue, 22 Nov 2016 13:52:24 +0300 Subject: [PATCH] A couple of new tests for boxing and for body assignment in an interface --- backend.native/tests/build.gradle | 13 +++++++++++++ backend.native/tests/runtime/basic/boxing0.kt | 10 ++++++++++ .../tests/runtime/basic/interface0.kt | 17 +++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 backend.native/tests/runtime/basic/boxing0.kt create mode 100644 backend.native/tests/runtime/basic/interface0.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index cf3fd49cf02..bfc38177a17 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -397,3 +397,16 @@ task throw0(type: RunKonanTest) { goldValue = "Done\n" source = "runtime/basic/throw0.kt" } +/* +task boxing0(type: RunKonanTest) { + goldValue = "17\n" + source = "runtime/basic/boxing0.kt" +} +*/ +/* +task interface0(type: RunKonanTest) { + goldValue = "PASS\n" + source = "runtime/basic/interface0.kt" +} +*/ + diff --git a/backend.native/tests/runtime/basic/boxing0.kt b/backend.native/tests/runtime/basic/boxing0.kt new file mode 100644 index 00000000000..6b29115005f --- /dev/null +++ b/backend.native/tests/runtime/basic/boxing0.kt @@ -0,0 +1,10 @@ + +class Box(t: T) { + var value = t +} + +fun main(args: Array) { + val box: Box = Box(17) + println(box.value) +} + diff --git a/backend.native/tests/runtime/basic/interface0.kt b/backend.native/tests/runtime/basic/interface0.kt new file mode 100644 index 00000000000..a1dfbfcb891 --- /dev/null +++ b/backend.native/tests/runtime/basic/interface0.kt @@ -0,0 +1,17 @@ + +interface A { + fun b() = c() + fun c() +} + +class B(): A { + override fun c() { + println("PASSED") + } +} + +fun main(args: Array) { + val a:A = B() + a.b() +} +