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

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-01-17 11:49:34 +01:00
parent 6e2df0e086
commit 1b18f4ed1e
26 changed files with 263 additions and 35 deletions
@@ -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))
}
@@ -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 -> '_'
}
)