[K/N][Tests] Migrate second ObjC test with framework

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-01-17 23:28:12 +01:00
parent 1b18f4ed1e
commit cc13888dd0
12 changed files with 59 additions and 30 deletions
+35
View File
@@ -0,0 +1,35 @@
// TARGET_BACKEND: NATIVE
// DISABLE_NATIVE: isAppleTarget=false
// FREE_CINTEROP_ARGS: -compiler-option -fmodule-map-file=$generatedSourcesDir/cinterop/module_library.modulemap
// FREE_CINTEROP_ARGS: -compiler-option -I$generatedSourcesDir/cinterop
// MODULE: cinterop
// FILE: module_library.def
language = Objective-C
modules = module_library
// FILE: module_library.modulemap
module module_library {
umbrella header "module_library_umbrella.h"
export *
module * { export * }
}
// FILE: module_library_umbrella.h
#import <foo.h>
// FILE: foo.h
#define ANSWER 42
// MODULE: main(cinterop)
// FILE: main.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import module_library.*
fun box(): String {
val answer = ANSWER
if (answer != 42)
return "FAIL: $answer"
return "OK"
}
@@ -1160,12 +1160,6 @@ if (PlatformInfo.isAppleTarget(project)) {
it.extraOpts '-Xforeign-exception-mode', "objc-wrap"
}
createInterop("objcKt34467") {
it.defFile 'interop/objc/kt34467/module_library.def'
def moduleMap = file("interop/objc/kt34467/module_library.modulemap").absolutePath
def includePath = file("interop/objc/kt34467").absolutePath
it.compilerOpts "-fmodule-map-file=$moduleMap", "-I$includePath"
}
createInterop("objcGh3343") {
it.defFile 'framework/gh3343/objclib.def'
it.headers "$projectDir/framework/gh3343/objclib.h"
@@ -1631,12 +1625,6 @@ if (PlatformInfo.isAppleTarget(project)) {
}
}
interopTest("interop_objc_kt34467") {
source = "interop/objc/kt34467/foo.kt"
interop = 'objcKt34467'
useGoldenData = true
}
interopTest("interop_objc_illegal_sharing_with_weak") {
source = "interop/objc/illegal_sharing_with_weak/main.kt"
interop = 'objc_illegal_sharing_with_weak'
@@ -1 +0,0 @@
#define ANSWER 42
@@ -1,6 +0,0 @@
import module_library.*
fun main() {
println("OK")
println(ANSWER)
}
@@ -1,2 +0,0 @@
OK
42
@@ -1,2 +0,0 @@
language = Objective-C
modules = module_library
@@ -1,6 +0,0 @@
module module_library {
umbrella header "module_library_umbrella.h"
export *
module * { export * }
}
@@ -1 +0,0 @@
#import <foo.h>
@@ -5068,6 +5068,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("kt34467.kt")
public void testKt34467() throws Exception {
runTest("compiler/testData/codegen/box/cinterop/objc/kt34467.kt");
}
@Test
@TestMetadata("kt53151.kt")
public void testKt53151() throws Exception {
@@ -5184,6 +5184,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("kt34467.kt")
public void testKt34467() throws Exception {
runTest("compiler/testData/codegen/box/cinterop/objc/kt34467.kt");
}
@Test
@TestMetadata("kt53151.kt")
public void testKt53151() throws Exception {
@@ -4952,6 +4952,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("kt34467.kt")
public void testKt34467() throws Exception {
runTest("compiler/testData/codegen/box/cinterop/objc/kt34467.kt");
}
@Test
@TestMetadata("kt53151.kt")
public void testKt53151() throws Exception {
@@ -5069,6 +5069,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("kt34467.kt")
public void testKt34467() throws Exception {
runTest("compiler/testData/codegen/box/cinterop/objc/kt34467.kt");
}
@Test
@TestMetadata("kt53151.kt")
public void testKt53151() throws Exception {