diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/TestDirectives.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/TestDirectives.kt index 05d37f8e7f8..6424f2c0ce6 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/TestDirectives.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/TestDirectives.kt @@ -215,6 +215,10 @@ internal enum class MutedOption { K2 } +internal val CINTEROP_SOURCE_EXTENSIONS = setOf("c", "cpp", "m", "mm") +internal val CINTEROP_DEFINITION_EXTENSIONS = setOf("def", "h") +internal val KNOWN_EXTENSIONS = setOf("kt") + CINTEROP_DEFINITION_EXTENSIONS + CINTEROP_SOURCE_EXTENSIONS + internal class TestCInteropArgs(cinteropArgs: List) : TestCompilerArgs(emptyList(), cinteropArgs) { constructor(vararg cinteropArgs: String) : this(cinteropArgs.asList()) } @@ -344,7 +348,7 @@ internal fun parseFileName(parsedDirective: RegisteredDirectivesParser.ParsedDir } val fileExtension = fileName.split(".").last() - if (fileExtension in setOf("kt", "def", "h", "c", "cpp", "m")) + if (fileExtension in KNOWN_EXTENSIONS) assertTrue(fileName.length > 3 && '/' !in fileName && '\\' !in fileName) { "$location: Invalid file name with extension $fileExtension in ${parsedDirective.directive} directive: $fileName" } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt index 0247cb62b28..8817460a356 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.konan.test.blackbox.support.compilation import org.jetbrains.kotlin.container.topologicalSort import org.jetbrains.kotlin.konan.test.blackbox.muteCInteropTestIfNecessary +import org.jetbrains.kotlin.konan.test.blackbox.support.CINTEROP_SOURCE_EXTENSIONS import org.jetbrains.kotlin.konan.test.blackbox.support.PackageName import org.jetbrains.kotlin.konan.test.blackbox.support.TestCase import org.jetbrains.kotlin.konan.test.blackbox.support.TestCase.* @@ -216,7 +217,7 @@ internal class TestCompilationFactory { muteCInteropTestIfNecessary(defFile, settings.get().testTarget) val cSourceFiles = buildList { - for (ext in listOf("cpp", "c", "m")) { + for (ext in CINTEROP_SOURCE_EXTENSIONS) { filesByExtension[ext]?.let { addAll(it) } } }