[K/N][tests] Added test for KT-51925
This commit is contained in:
@@ -4230,6 +4230,10 @@ createInterop("kt44283") {
|
||||
it.defFile 'interop/kt44283/kt44283.def'
|
||||
}
|
||||
|
||||
createInterop("kt51925") {
|
||||
it.defFile 'interop/kt51925/kt51925.def'
|
||||
}
|
||||
|
||||
createInterop("kt43502") {
|
||||
it.defFile 'interop/kt43502/kt43502.def'
|
||||
it.headers "$projectDir/interop/kt43502/kt43502.h"
|
||||
@@ -4685,6 +4689,15 @@ interopTest("interop_kt44283") {
|
||||
source = "interop/kt44283/main.kt"
|
||||
}
|
||||
|
||||
// TODO: This test should be run with caches on.
|
||||
interopTest("interop_kt51925") {
|
||||
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
|
||||
interop = 'kt51925'
|
||||
lib = 'interop/kt51925/kt51925_lib.kt'
|
||||
source = 'interop/kt51925/kt51925_main.kt'
|
||||
useGoldenData = true
|
||||
}
|
||||
|
||||
dynamicTest("interop_kt43502") {
|
||||
disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic
|
||||
interop = "kt43502"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
strictEnums = E
|
||||
---
|
||||
enum E {
|
||||
X = 1, Y = 2, Z = 42
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int d;
|
||||
} Struct;
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kt51925.*
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
fun bar1(e: E) = e.value
|
||||
|
||||
inline fun foo1() = bar1(E.Z)
|
||||
|
||||
fun bar2(s: Struct): Int {
|
||||
return s.d
|
||||
}
|
||||
|
||||
inline fun foo2(): Int {
|
||||
memScoped {
|
||||
val s = alloc<Struct>()
|
||||
s.d = 42
|
||||
return bar2(s)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
println(foo1())
|
||||
println(foo2())
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
42
|
||||
42
|
||||
Reference in New Issue
Block a user