[Test] Remove abstract MultiModuleInfoDumper
This commit is contained in:
committed by
teamcityserver
parent
90e06bf403
commit
08a1134fff
+2
-2
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.defaultsProvider
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.withExtension
|
||||
import org.jetbrains.kotlin.test.utils.withSuffixAndExtension
|
||||
import java.io.File
|
||||
@@ -25,7 +25,7 @@ class BytecodeListingHandler(testServices: TestServices) : JvmBinaryArtifactHand
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(CodegenTestDirectives)
|
||||
|
||||
private val multiModuleInfoDumper = MultiModuleInfoDumperImpl()
|
||||
private val multiModuleInfoDumper = MultiModuleInfoDumper()
|
||||
|
||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
|
||||
if (CHECK_BYTECODE_LISTING !in module.directives) return
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.withExtension
|
||||
|
||||
class IrPrettyKotlinDumpHandler(testServices: TestServices) : AbstractIrHandler(testServices) {
|
||||
@@ -28,7 +28,7 @@ class IrPrettyKotlinDumpHandler(testServices: TestServices) : AbstractIrHandler(
|
||||
const val DUMP_EXTENSION = "kt.txt"
|
||||
}
|
||||
|
||||
private val dumper = MultiModuleInfoDumperImpl("// MODULE: %s")
|
||||
private val dumper = MultiModuleInfoDumper("// MODULE: %s")
|
||||
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(CodegenTestDirectives, FirDiagnosticsDirectives)
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.test.model.TestFile
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.withExtension
|
||||
import org.jetbrains.kotlin.test.utils.withSuffixAndExtension
|
||||
import java.io.File
|
||||
@@ -56,7 +56,7 @@ class IrTextDumpHandler(testServices: TestServices) : AbstractIrHandler(testServ
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(CodegenTestDirectives, FirDiagnosticsDirectives)
|
||||
|
||||
private val baseDumper = MultiModuleInfoDumperImpl()
|
||||
private val baseDumper = MultiModuleInfoDumper()
|
||||
private val buildersForSeparateFileDumps: MutableMap<File, StringBuilder> = mutableMapOf()
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.test.model.BinaryArtifacts
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.withExtension
|
||||
|
||||
class SMAPDumpHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) {
|
||||
@@ -30,7 +30,7 @@ class SMAPDumpHandler(testServices: TestServices) : JvmBinaryArtifactHandler(tes
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(CodegenTestDirectives)
|
||||
|
||||
private val dumper = MultiModuleInfoDumperImpl(moduleHeaderTemplate = null)
|
||||
private val dumper = MultiModuleInfoDumper(moduleHeaderTemplate = null)
|
||||
|
||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
|
||||
if (!GENERATE_SMAP) return
|
||||
|
||||
+1
-2
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.test.util.DescriptorValidator
|
||||
import org.jetbrains.kotlin.test.util.RecursiveDescriptorComparator
|
||||
import org.jetbrains.kotlin.test.util.RecursiveDescriptorComparator.RECURSIVE
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
import java.util.function.Predicate
|
||||
import java.util.regex.Pattern
|
||||
@@ -45,7 +44,7 @@ class DeclarationsDumpHandler(
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(DiagnosticsDirectives)
|
||||
|
||||
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumperImpl(moduleHeaderTemplate = "// -- Module: <%s> --")
|
||||
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumper(moduleHeaderTemplate = "// -- Module: <%s> --")
|
||||
|
||||
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
|
||||
if (dumper.isEmpty()) return
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.util.RecursiveDescriptorComparator
|
||||
import org.jetbrains.kotlin.test.util.RecursiveDescriptorComparator.RECURSIVE_ALL
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.test.utils.withExtension
|
||||
|
||||
class DynamicCallsDumpHandler(testServices: TestServices) : ClassicFrontendAnalysisHandler(testServices) {
|
||||
@@ -29,7 +28,7 @@ class DynamicCallsDumpHandler(testServices: TestServices) : ClassicFrontendAnaly
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(DiagnosticsDirectives)
|
||||
|
||||
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumperImpl(moduleHeaderTemplate = "// -- Module: <%s> --")
|
||||
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumper(moduleHeaderTemplate = "// -- Module: <%s> --")
|
||||
|
||||
override fun processModule(module: TestModule, info: ClassicFrontendOutputArtifact) {
|
||||
val dynamicCallDescriptors = mutableListOf<DeclarationDescriptor>()
|
||||
|
||||
+1
-2
@@ -13,12 +13,11 @@ import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
|
||||
class FirDumpHandler(
|
||||
testServices: TestServices
|
||||
) : FirAnalysisHandler(testServices) {
|
||||
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumperImpl()
|
||||
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumper()
|
||||
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(FirDiagnosticsDirectives)
|
||||
|
||||
+2
-2
@@ -27,14 +27,14 @@ import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumperImpl
|
||||
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
|
||||
import org.jetbrains.kotlin.test.utils.withExtension
|
||||
import org.jetbrains.kotlin.util.SmartPrinter
|
||||
import org.jetbrains.kotlin.util.withIndent
|
||||
|
||||
@OptIn(SymbolInternals::class)
|
||||
class FirScopeDumpHandler(testServices: TestServices) : FirAnalysisHandler(testServices) {
|
||||
private val dumper = MultiModuleInfoDumperImpl()
|
||||
private val dumper = MultiModuleInfoDumper()
|
||||
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(FirDiagnosticsDirectives)
|
||||
|
||||
+4
-10
@@ -7,21 +7,15 @@ package org.jetbrains.kotlin.test.utils
|
||||
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
|
||||
abstract class MultiModuleInfoDumper {
|
||||
abstract fun builderForModule(module: TestModule): StringBuilder
|
||||
abstract fun generateResultingDump(): String
|
||||
abstract fun isEmpty(): Boolean
|
||||
}
|
||||
|
||||
// TODO: consider about tests with multiple testdata files
|
||||
class MultiModuleInfoDumperImpl(private val moduleHeaderTemplate: String? = "Module: %s") : MultiModuleInfoDumper() {
|
||||
class MultiModuleInfoDumper(private val moduleHeaderTemplate: String? = "Module: %s") {
|
||||
private val builderByModule = LinkedHashMap<TestModule, StringBuilder>()
|
||||
|
||||
override fun builderForModule(module: TestModule): StringBuilder {
|
||||
fun builderForModule(module: TestModule): StringBuilder {
|
||||
return builderByModule.getOrPut(module, ::StringBuilder)
|
||||
}
|
||||
|
||||
override fun generateResultingDump(): String {
|
||||
fun generateResultingDump(): String {
|
||||
builderByModule.values.singleOrNull()?.let { return it.toString() }
|
||||
return buildString {
|
||||
for ((module, builder) in builderByModule) {
|
||||
@@ -31,7 +25,7 @@ class MultiModuleInfoDumperImpl(private val moduleHeaderTemplate: String? = "Mod
|
||||
}
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
fun isEmpty(): Boolean {
|
||||
return builderByModule.isEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user