[interop][c][reverse][test] (KT-36639)
This commit is contained in:
@@ -4367,6 +4367,19 @@ dynamicTest("produce_dynamic") {
|
||||
"Error handler: kotlin.Error: Expected error\n"
|
||||
}
|
||||
|
||||
dynamicTest("kt36639") {
|
||||
disabled = (project.target.name != project.hostName)
|
||||
source = "produce_dynamic/kt-36639/main.kt"
|
||||
cSource = "$projectDir/produce_dynamic/kt-36639/main.c"
|
||||
goldValue = """|CFoo1::extfoo
|
||||
|CFoo1::extfoo
|
||||
|CFoo2::extfoo
|
||||
|CFoo2::extfoo
|
||||
|Int::extfoo
|
||||
|Int::extfoo
|
||||
|""".stripMargin()
|
||||
}
|
||||
|
||||
dynamicTest("interop_concurrentRuntime") {
|
||||
disabled = (project.target.name != project.hostName)
|
||||
disabled = true // KT-43180
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "testlib_api.h"
|
||||
|
||||
#define __ testlib_symbols()->
|
||||
#define T_(x) testlib_kref_ ## x
|
||||
|
||||
|
||||
int
|
||||
main() {
|
||||
T_(CFoo1) foo1 = __ kotlin.root.CFoo1.CFoo1();
|
||||
T_(CFoo2) foo2 = __ kotlin.root.CFoo2.CFoo2();
|
||||
T_(kotlin_Int) intV = __ createNullableInt(42);
|
||||
T_(kotlin_Any) any;
|
||||
T_(Foo) foo = { .pinned = foo1.pinned };
|
||||
|
||||
any.pinned = foo1.pinned;
|
||||
__ kotlin.root.CFoo1.callMe(foo1, any);
|
||||
__ kotlin.root.Foo.extfoo(foo, any);
|
||||
any.pinned = foo2.pinned;
|
||||
__ kotlin.root.CFoo1.callMe(foo1, any);
|
||||
__ kotlin.root.Foo.extfoo(foo, any);
|
||||
any.pinned = intV.pinned;
|
||||
__ kotlin.root.CFoo1.callMe(foo1, any);
|
||||
__ kotlin.root.Foo.extfoo(foo, any);
|
||||
|
||||
__ DisposeStablePointer(foo1.pinned);
|
||||
__ DisposeStablePointer(foo2.pinned);
|
||||
__ DisposeStablePointer(intV.pinned);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
interface Foo {
|
||||
fun Any.extfoo()
|
||||
}
|
||||
|
||||
class CFoo1:Foo {
|
||||
override fun Any.extfoo() {
|
||||
when(this) {
|
||||
is CFoo1 -> println("CFoo1::extfoo")
|
||||
is CFoo2 -> println("CFoo2::extfoo")
|
||||
is Int -> println("Int::extfoo")
|
||||
}
|
||||
}
|
||||
|
||||
fun callMe(arg: Any) = arg.extfoo()
|
||||
}
|
||||
|
||||
class CFoo2:Foo {
|
||||
override fun Any.extfoo() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user