From 2a15df6a20df05181db7f3fecc0051085e893d9b Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Wed, 5 Feb 2020 12:12:04 +0300 Subject: [PATCH] [IDEA-TESTS] Update configuration tests involving LATEST_STABLE version Change `LATEST_STABLE` with `VersionView.RELEASED_VERSION` in tests checking default language configuration options. Replace `LATEST_STABLE` with fixed version in `testDropKotlincOnVersionAutoAdvance` as the test actually compares it with version from kotlinc.xml. It being latest stable is not relevant. By default the lastest stable Kotlin version is selected for module when there is no explicit version in configuration. However, it is the version previous to `LanguageVersion.LATEST_STABLE` during prerelease. --- .../configuration/ConfigureKotlinInTempDirTest.kt | 11 ++++++----- .../idea/configuration/ConfigureKotlinTest.java | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt index e9e49e8131a..3d5b530dd0e 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt @@ -10,6 +10,7 @@ import com.intellij.openapi.application.impl.ApplicationImpl import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider import org.jetbrains.kotlin.config.LanguageVersion +import org.jetbrains.kotlin.config.VersionView import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JsCompilerArgumentsHolder import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings @@ -34,8 +35,8 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() fun testNoKotlincExistsNoSettingsLatestRuntime() { val application = ApplicationManager.getApplication() as ApplicationImpl application.isSaveAllowed = true - Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion) - Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion) + Assert.assertEquals(VersionView.RELEASED_VERSION, module.languageVersionSettings.languageVersion) + Assert.assertEquals(VersionView.RELEASED_VERSION, myProject.getLanguageVersionSettings(null).languageVersion) application.saveAll() Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null) } @@ -43,8 +44,8 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() fun testKotlincExistsNoSettingsLatestRuntimeNoVersionAutoAdvance() { val application = ApplicationManager.getApplication() as ApplicationImpl application.isSaveAllowed = true - Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion) - Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion) + Assert.assertEquals(VersionView.RELEASED_VERSION, module.languageVersionSettings.languageVersion) + Assert.assertEquals(VersionView.RELEASED_VERSION, myProject.getLanguageVersionSettings(null).languageVersion) KotlinCommonCompilerArgumentsHolder.getInstance(project).update { autoAdvanceLanguageVersion = false autoAdvanceApiVersion = false @@ -56,7 +57,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() fun testDropKotlincOnVersionAutoAdvance() { val application = ApplicationManager.getApplication() as ApplicationImpl application.isSaveAllowed = true - Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion) + Assert.assertEquals(LanguageVersion.KOTLIN_1_4, module.languageVersionSettings.languageVersion) KotlinCommonCompilerArgumentsHolder.getInstance(project).update { autoAdvanceLanguageVersion = true autoAdvanceApiVersion = true diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java index 90fd0b76682..32e75b41590 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java @@ -176,7 +176,10 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest { public void testProjectWithFacetWithRuntime11WithLanguageLevel10() { assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(getModule()).getLanguageVersion()); - assertEquals(LanguageVersion.LATEST_STABLE, PlatformKt.getLanguageVersionSettings(myProject, null).getLanguageVersion()); + assertEquals( + VersionView.Companion.getRELEASED_VERSION(), + PlatformKt.getLanguageVersionSettings(myProject, null).getLanguageVersion() + ); } public void testJsLibraryVersion11() {