Fix completion tests

This commit is contained in:
Mikhail Glukhikh
2017-09-19 13:29:54 +03:00
committed by Mikhail Glukhikh
parent 454c5229f9
commit ef6a00f477
2 changed files with 13 additions and 3 deletions
@@ -37,7 +37,7 @@ abstract class AbstractKeywordCompletionTest : KotlinFixtureCompletionBaseTestCa
if ("LangLevel10" in fileName()) {
return KotlinProjectDescriptorWithFacet.KOTLIN_10
}
return KotlinLightProjectDescriptor.INSTANCE
return KotlinProjectDescriptorWithFacet.KOTLIN_STABLE_WITH_MULTIPLATFORM
}
override fun defaultInvocationCount() = 1
@@ -20,6 +20,7 @@ import com.intellij.facet.FacetManager
import com.intellij.openapi.module.Module
import com.intellij.openapi.roots.ContentEntry
import com.intellij.openapi.roots.ModifiableRootModel
import org.jetbrains.kotlin.config.CompilerSettings
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.idea.facet.KotlinFacet
import org.jetbrains.kotlin.idea.facet.KotlinFacetConfiguration
@@ -28,15 +29,24 @@ import org.jetbrains.kotlin.idea.facet.initializeIfNeeded
import org.jetbrains.kotlin.test.testFramework.runInEdtAndWait
import org.jetbrains.kotlin.test.testFramework.runWriteAction
class KotlinProjectDescriptorWithFacet(val languageVersion: LanguageVersion) : KotlinLightProjectDescriptor() {
class KotlinProjectDescriptorWithFacet(
private val languageVersion: LanguageVersion,
private val multiPlatform: Boolean = false
) : KotlinLightProjectDescriptor() {
override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) {
configureKotlinFacet(module) { ->
configureKotlinFacet(module) {
settings.languageLevel = languageVersion
if (multiPlatform) {
settings.compilerSettings = CompilerSettings().apply {
additionalArguments += " -Xmulti-platform"
}
}
}
}
companion object {
val KOTLIN_10 = KotlinProjectDescriptorWithFacet(LanguageVersion.KOTLIN_1_0)
val KOTLIN_STABLE_WITH_MULTIPLATFORM = KotlinProjectDescriptorWithFacet(LanguageVersion.LATEST_STABLE, multiPlatform = true)
}
}