[Native][tests] Minor. Rename PackageName to PackageFQN
This commit is contained in:
+2
-2
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertTrue
|
|||||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail
|
import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal typealias PackageName = String
|
internal typealias PackageFQN = String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helps to track the origin of every [TestCase], [TestCompilation] or [TestExecutable]. Used for issue reporting purposes.
|
* Helps to track the origin of every [TestCase], [TestCompilation] or [TestExecutable]. Used for issue reporting purposes.
|
||||||
@@ -153,7 +153,7 @@ internal class TestCase(
|
|||||||
val modules: Set<TestModule.Exclusive>,
|
val modules: Set<TestModule.Exclusive>,
|
||||||
val freeCompilerArgs: TestCompilerArgs,
|
val freeCompilerArgs: TestCompilerArgs,
|
||||||
val origin: TestOrigin.SingleTestDataFile,
|
val origin: TestOrigin.SingleTestDataFile,
|
||||||
val nominalPackageName: PackageName,
|
val nominalPackageName: PackageFQN,
|
||||||
val expectedOutputDataFile: File?,
|
val expectedOutputDataFile: File?,
|
||||||
val extras: StandaloneNoTestRunnerExtras? = null
|
val extras: StandaloneNoTestRunnerExtras? = null
|
||||||
) {
|
) {
|
||||||
|
|||||||
+2
-2
@@ -107,7 +107,7 @@ internal class TestCompilationFactory(private val environment: TestEnvironment)
|
|||||||
private fun multiModuleArtifactFile(modules: Collection<TestModule>, extension: String): File {
|
private fun multiModuleArtifactFile(modules: Collection<TestModule>, extension: String): File {
|
||||||
var filesCount = 0
|
var filesCount = 0
|
||||||
var hash = 0
|
var hash = 0
|
||||||
val uniquePackageNames = hashSetOf<PackageName>()
|
val uniquePackageNames = hashSetOf<PackageFQN>()
|
||||||
|
|
||||||
modules.forEach { module ->
|
modules.forEach { module ->
|
||||||
module.files.forEach { file ->
|
module.files.forEach { file ->
|
||||||
@@ -137,7 +137,7 @@ internal class TestCompilationFactory(private val environment: TestEnvironment)
|
|||||||
return artifactDirForPackageName(commonPackageName).resolve(artifactFileName)
|
return artifactDirForPackageName(commonPackageName).resolve(artifactFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun artifactDirForPackageName(packageName: PackageName?): File {
|
private fun artifactDirForPackageName(packageName: PackageFQN?): File {
|
||||||
val baseDir = environment.testBinariesDir
|
val baseDir = environment.testBinariesDir
|
||||||
val outputDir = if (packageName != null) baseDir.resolve(packageName.replace('.', '_')) else baseDir
|
val outputDir = if (packageName != null) baseDir.resolve(packageName.replace('.', '_')) else baseDir
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ internal sealed interface TestRunParameter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithPackageFilter(private val packageFQN: PackageName) : WithFilter() {
|
class WithPackageFilter(private val packageFQN: PackageFQN) : WithFilter() {
|
||||||
override val wildcard get() = "$packageFQN.*"
|
override val wildcard get() = "$packageFQN.*"
|
||||||
override fun testMatches(testName: String) = testName.startsWith("$packageFQN.")
|
override fun testMatches(testName: String) = testName.startsWith("$packageFQN.")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -633,7 +633,7 @@ private class ExtTestDataFileSettings(
|
|||||||
val optInsForCompiler: Set<String>,
|
val optInsForCompiler: Set<String>,
|
||||||
val expectActualLinker: Boolean,
|
val expectActualLinker: Boolean,
|
||||||
val generatedSourcesDir: File,
|
val generatedSourcesDir: File,
|
||||||
val effectivePackageName: PackageName
|
val effectivePackageName: PackageFQN
|
||||||
)
|
)
|
||||||
|
|
||||||
private typealias SharedModuleGenerator = (sharedModulesDir: File) -> TestModule.Shared?
|
private typealias SharedModuleGenerator = (sharedModulesDir: File) -> TestModule.Shared?
|
||||||
|
|||||||
+1
-1
@@ -210,7 +210,7 @@ internal class StandardTestCaseGroupProvider(private val environment: TestEnviro
|
|||||||
|
|
||||||
private fun fixPackageDeclaration(
|
private fun fixPackageDeclaration(
|
||||||
testFile: TestFile<TestModule.Exclusive>,
|
testFile: TestFile<TestModule.Exclusive>,
|
||||||
packageName: PackageName,
|
packageName: PackageFQN,
|
||||||
testDataFile: File
|
testDataFile: File
|
||||||
) = testFile.update { text ->
|
) = testFile.update { text ->
|
||||||
var existingPackageDeclarationLine: String? = null
|
var existingPackageDeclarationLine: String? = null
|
||||||
|
|||||||
+4
-4
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.konan.blackboxtest.support.util
|
package org.jetbrains.kotlin.konan.blackboxtest.support.util
|
||||||
|
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.PackageName
|
import org.jetbrains.kotlin.konan.blackboxtest.support.PackageFQN
|
||||||
import org.jetbrains.kotlin.renderer.KeywordStringsGenerated.KEYWORDS
|
import org.jetbrains.kotlin.renderer.KeywordStringsGenerated.KEYWORDS
|
||||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertTrue
|
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertTrue
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -13,7 +13,7 @@ import java.nio.file.Path
|
|||||||
import kotlin.io.path.name
|
import kotlin.io.path.name
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
internal fun computePackageName(testDataBaseDir: File, testDataFile: File): PackageName {
|
internal fun computePackageName(testDataBaseDir: File, testDataFile: File): PackageFQN {
|
||||||
assertTrue(testDataFile.startsWith(testDataBaseDir)) {
|
assertTrue(testDataFile.startsWith(testDataBaseDir)) {
|
||||||
"""
|
"""
|
||||||
The file is outside of the directory.
|
The file is outside of the directory.
|
||||||
@@ -48,10 +48,10 @@ internal fun computePackageName(testDataBaseDir: File, testDataFile: File): Pack
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Set<PackageName>.findCommonPackageName(): PackageName? = when (size) {
|
internal fun Set<PackageFQN>.findCommonPackageName(): PackageFQN? = when (size) {
|
||||||
0 -> null
|
0 -> null
|
||||||
1 -> first()
|
1 -> first()
|
||||||
else -> map { packageName: PackageName ->
|
else -> map { packageName: PackageFQN ->
|
||||||
packageName.split('.')
|
packageName.split('.')
|
||||||
}.reduce { commonPackageNameParts: List<String>, packageNameParts: List<String> ->
|
}.reduce { commonPackageNameParts: List<String>, packageNameParts: List<String> ->
|
||||||
ArrayList<String>(min(commonPackageNameParts.size, packageNameParts.size)).apply {
|
ArrayList<String>(min(commonPackageNameParts.size, packageNameParts.size)).apply {
|
||||||
|
|||||||
Reference in New Issue
Block a user