[AA] Add KtTestModule.moduleKind
- `TestModule.explicitTestModuleKind` requires a directive to be present to get the `TestModuleKind`. But we still want to find out the test module kind for test modules without a directive. Hence, we have to add this property to `KtTestModule` during its construction. ^KT-65960
This commit is contained in:
committed by
Space Team
parent
dc0f498b15
commit
7baaa38b8a
+12
-4
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.analysis.test.framework.services.configuration.Analy
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
@@ -52,13 +53,20 @@ object FirLowLevelCompilerBasedTestConfigurator : AnalysisApiTestConfigurator()
|
||||
val mainModules = moduleStructure.modules.map { testModule ->
|
||||
val files = TestModuleStructureFactory.createSourcePsiFiles(testModule, testServices, project)
|
||||
val scriptFile = files.singleOrNull() as? KtFile
|
||||
val ktModule = if (scriptFile?.isScript() == true) {
|
||||
KtScriptModuleByCompilerConfiguration(project, testModule, scriptFile, testServices)
|
||||
|
||||
val (ktModule, testModuleKind) = if (scriptFile?.isScript() == true) {
|
||||
Pair(
|
||||
KtScriptModuleByCompilerConfiguration(project, testModule, scriptFile, testServices),
|
||||
TestModuleKind.ScriptSource,
|
||||
)
|
||||
} else {
|
||||
KtSourceModuleByCompilerConfiguration(project, testModule, files, testServices)
|
||||
Pair(
|
||||
KtSourceModuleByCompilerConfiguration(project, testModule, files, testServices),
|
||||
TestModuleKind.Source,
|
||||
)
|
||||
}
|
||||
|
||||
KtTestModule(testModule, ktModule, files)
|
||||
KtTestModule(testModuleKind, testModule, ktModule, files)
|
||||
}
|
||||
|
||||
return KtTestModuleProjectStructure(
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFa
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtTestModuleProjectStructure
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtTestModule
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind
|
||||
import org.jetbrains.kotlin.analysis.test.framework.utils.SkipTestException
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
@@ -74,7 +75,7 @@ private object KtOutOfContentRootModuleFactory : KtModuleFactory {
|
||||
val psiFiles = TestModuleStructureFactory.createSourcePsiFiles(testModule, testServices, project)
|
||||
val platform = testModule.targetPlatform
|
||||
val ktModule = KtNotUnderContentRootModuleForTest(testModule.name, psiFiles.first(), platform)
|
||||
return KtTestModule(testModule, ktModule, psiFiles)
|
||||
return KtTestModule(TestModuleKind.NotUnderContentRoot, testModule, ktModule, psiFiles)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user