[K/N][Tests] Migrate first ObjC test with framework
^KT-61259
This commit is contained in:
+19
@@ -5056,6 +5056,25 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/objc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class Objc {
|
||||
@Test
|
||||
public void testAllFilesPresentInObjc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53151.kt")
|
||||
public void testKt53151() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+21
@@ -5170,6 +5170,27 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/objc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Objc {
|
||||
@Test
|
||||
public void testAllFilesPresentInObjc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53151.kt")
|
||||
public void testKt53151() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+17
@@ -4942,6 +4942,23 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/objc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class Objc {
|
||||
@Test
|
||||
public void testAllFilesPresentInObjc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53151.kt")
|
||||
public void testKt53151() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+19
@@ -5057,6 +5057,25 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/objc")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Objc {
|
||||
@Test
|
||||
public void testAllFilesPresentInObjc() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53151.kt")
|
||||
public void testKt53151() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/cinterop/packages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+2
@@ -177,6 +177,7 @@ private class ExtTestDataFile(
|
||||
args += "-opt-in=kotlin.native.internal.InternalForKotlinNativeTests" // for ReflectionPackageName
|
||||
val freeCInteropArgs = structure.directives.listValues(FREE_CINTEROP_ARGS.name)
|
||||
.orEmpty().flatMap { it.split(" ") }
|
||||
.map { it.replace("\$generatedSourcesDir", testDataFileSettings.generatedSourcesDir.absolutePath) }
|
||||
return TestCompilerArgs(args, freeCInteropArgs, testDataFileSettings.assertionsMode)
|
||||
}
|
||||
|
||||
@@ -719,6 +720,7 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te
|
||||
|
||||
source.files.forEach { extTestFile ->
|
||||
val file = moduleDir.resolve(extTestFile.name)
|
||||
file.parentFile.mkdirs()
|
||||
file.writeText(extTestFile.text)
|
||||
process(destination, TestFile.createCommitted(file, destination))
|
||||
}
|
||||
|
||||
+3
-2
@@ -7,14 +7,15 @@ package org.jetbrains.kotlin.konan.test.blackbox.support.util
|
||||
|
||||
internal val Class<*>.sanitizedName: String get() = sanitize(name)
|
||||
|
||||
internal fun getSanitizedFileName(fileName: String): String = sanitize(fileName, allowDots = true)
|
||||
internal fun getSanitizedFileName(fileName: String): String = sanitize(fileName, allowDots = true, allowSlashes = true)
|
||||
|
||||
private fun sanitize(s: String, allowDots: Boolean = false) = buildString {
|
||||
private fun sanitize(s: String, allowDots: Boolean = false, allowSlashes: Boolean = false) = buildString {
|
||||
s.forEach { ch ->
|
||||
append(
|
||||
when {
|
||||
ch.isLetterOrDigit() || ch == '_' -> ch
|
||||
allowDots && ch == '.' -> ch
|
||||
allowSlashes && ch == '/' -> ch
|
||||
else -> '_'
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user