diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 8008e5a022e..b06f18abc11 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -3800,6 +3800,9 @@ if (PlatformInfo.isAppleTarget(project)) { it.defFile 'interop/objc/illegal_sharing_with_weak/objclib.def' it.headers "$projectDir/interop/objc/illegal_sharing_with_weak/objclib.h" } + createInterop("objcKt43517") { + it.defFile 'framework/kt43517/kt43517.def' + } } createInterop("withSpaces") { @@ -4672,6 +4675,14 @@ if (isAppleTarget(project)) { } swiftSources = ['framework/kt42397'] } + + frameworkTest("testKt43517Framework") { + framework('Kt43517') { + sources = ['framework/kt43517'] + library = 'objcKt43517' + } + swiftSources = ['framework/kt43517/'] + } } /** diff --git a/kotlin-native/backend.native/tests/framework/kt43517/kt43517.def b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.def new file mode 100644 index 00000000000..04f2b80bc15 --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.def @@ -0,0 +1,15 @@ +--- +enum E { + A, B, C +}; + +struct S { + int i; + float f; +}; + +struct S globalS = { .i = 3, .f = 3.14f }; + +enum E createEnum() { + return A; +} diff --git a/kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt new file mode 100644 index 00000000000..716dcd7e87e --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.kt @@ -0,0 +1,13 @@ +import kt43517.* + +fun produceEnum(): E = + createEnum() + +fun compareEnums(e1: E, e2: E): Boolean = + e1 == e2 + +fun getFirstField(s: S): Int = + s.i + +fun getGlobalS(): S = + globalS \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift new file mode 100644 index 00000000000..1645d5ed669 --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/kt43517/kt43517.swift @@ -0,0 +1,24 @@ +import Foundation +import Kt43517 + +func testKt43517() throws { + try assertEquals( + actual: Kt43517Kt.compareEnums(e1: Kt43517Kt.produceEnum(), e2: Kt43517Kt.produceEnum()), + expected: true + ) + try assertEquals( + actual: Kt43517Kt.getFirstField(s: Kt43517Kt.getGlobalS()), + expected: 3 + ) +} + +class Kt43517Tests : TestProvider { + var tests: [TestCase] = [] + + init() { + providers.append(self) + tests = [ + TestCase(name: "Kt43517", method: withAutorelease(testKt43517)), + ] + } +} \ No newline at end of file