[K/N][tests] Migrate first platform-dependent test to new testing infra

^KT-61259
This commit is contained in:
Alexander Shabalin
2023-12-20 18:52:02 +01:00
committed by Vladimir Sukharev
parent 4786c945d9
commit b7fbfb2fde
10 changed files with 38 additions and 81 deletions
@@ -0,0 +1,23 @@
// MODULE: lib
// FILE: lib.kt
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
import kotlinx.cinterop.convert
import platform.posix.*
fun foo(): String {
val size: size_t = 17.convert<size_t>()
val e = fabs(1.toDouble())
return "$size; $e"
}
// MODULE: main(lib)
// FILE: main.kt
import kotlin.test.*
fun box(): String {
assertEquals("17; 1.0", foo())
return "OK"
}
@@ -3221,6 +3221,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox
runTest("native/native.tests/testData/codegen/link/link.kt");
}
@Test
@TestMetadata("noPurgeForDependencies.kt")
public void testNoPurgeForDependencies() throws Exception {
runTest("native/native.tests/testData/codegen/link/noPurgeForDependencies.kt");
}
@Test
@TestMetadata("omitUnused.kt")
public void testOmitUnused() throws Exception {
@@ -3147,6 +3147,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes
runTest("native/native.tests/testData/codegen/link/link.kt");
}
@Test
@TestMetadata("noPurgeForDependencies.kt")
public void testNoPurgeForDependencies() throws Exception {
runTest("native/native.tests/testData/codegen/link/noPurgeForDependencies.kt");
}
@Test
@TestMetadata("omitUnused.kt")
public void testOmitUnused() throws Exception {
@@ -303,6 +303,7 @@ private class ExtTestDataFile(
|| importedFqName.startsWith(KOTLINX_PACKAGE_NAME)
|| importedFqName.startsWith(HELPERS_PACKAGE_NAME)
|| importedFqName.startsWith(CNAMES_PACKAGE_NAME)
|| importedFqName.startsWith(PLATFORM_PACKAGE_NAME)
) {
return
}
@@ -596,6 +597,7 @@ private class ExtTestDataFile(
private val HELPERS_PACKAGE_NAME = Name.identifier("helpers")
private val KOTLINX_PACKAGE_NAME = Name.identifier("kotlinx")
private val CNAMES_PACKAGE_NAME = Name.identifier("cnames")
private val PLATFORM_PACKAGE_NAME = Name.identifier("platform")
private val MANDATORY_SOURCE_TRANSFORMERS: ExternalSourceTransformers = listOf(DiagnosticsRemovingSourceTransformer)
}