[analysis api] allow generating test with for with more possible parameters
This commit is contained in:
+38
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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
|
||||
+1
-1
@@ -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
|
||||
Reference in New Issue
Block a user