[analysis api] allow generating test with for with more possible parameters

This commit is contained in:
Ilya Kirillov
2022-03-24 20:55:19 +01:00
parent 12e0254918
commit 443ee4c860
24 changed files with 495 additions and 309 deletions
@@ -0,0 +1,38 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.fe10
import org.jetbrains.kotlin.analysis.test.framework.*
object AnalysisApiFe10TestConfiguratorFactory : AnalysisApiTestConfiguratorFactory() {
override fun createConfigurator(data: AnalysisApiTestConfiguratorFactoryData): AnalysisApiTestConfiguratorService {
require(supportMode(data))
return when (data.moduleKind) {
TestModuleKind.Source -> when (data.analysisSessionMode) {
AnalysisSessionMode.Normal -> KtFe10AnalysisApiTestConfiguratorService
AnalysisSessionMode.Dependent -> error("Unsupported AnalysisSessionMode.Dependent for fe10")
}
else -> {
error("Unsupported non-source module for fe10")
}
}
}
override fun supportMode(data: AnalysisApiTestConfiguratorFactoryData): Boolean {
return when {
data.frontend != FrontendKind.Fe10 -> false
data.analysisSessionMode != AnalysisSessionMode.Normal -> false
data.analysisApiMode != AnalysisApiMode.Ide -> false
else -> when (data.moduleKind) {
TestModuleKind.Source -> true
TestModuleKind.LibraryBinary,
TestModuleKind.LibrarySource -> false
}
}
}
}
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.descriptors.test
package org.jetbrains.kotlin.analysis.api.fe10
import com.intellij.mock.MockApplication
import com.intellij.mock.MockProject
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.descriptors.test
package org.jetbrains.kotlin.analysis.api.fe10
import com.intellij.mock.MockProject
import com.intellij.openapi.Disposable