[Native][tests] Port KT-36639 test case to the new infra

This commit is contained in:
Sergey Bogolepov
2023-12-05 14:00:13 +02:00
committed by Space Team
parent 1c24f994db
commit c165171471
9 changed files with 171 additions and 12 deletions
@@ -2000,12 +2000,6 @@ dynamicTest("produce_dynamic") {
useGoldenData = true
}
dynamicTest("kt36639") {
source = "produce_dynamic/kt-36639/main.kt"
cSource = "$projectDir/produce_dynamic/kt-36639/main.c"
useGoldenData = true
}
dynamicTest("kt36878") {
source = "produce_dynamic/kt-36878/hello.kt"
cSource = "$projectDir/produce_dynamic/kt-36878/main.c"
@@ -1,6 +0,0 @@
CFoo1::extfoo
CFoo1::extfoo
CFoo2::extfoo
CFoo2::extfoo
Int::extfoo
Int::extfoo
@@ -1,28 +0,0 @@
#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);
}
@@ -1,21 +0,0 @@
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")
}
}