[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.
This commit is contained in:
Pavel Kirpichenkov
2020-02-05 12:12:04 +03:00
parent a5d201e263
commit 2a15df6a20
2 changed files with 10 additions and 6 deletions
@@ -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
@@ -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() {