[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:
@@ -10,6 +10,7 @@ import com.intellij.openapi.application.impl.ApplicationImpl
|
|||||||
import org.jetbrains.kotlin.config.ApiVersion
|
import org.jetbrains.kotlin.config.ApiVersion
|
||||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||||
import org.jetbrains.kotlin.config.LanguageVersion
|
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.Kotlin2JsCompilerArgumentsHolder
|
||||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||||
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
||||||
@@ -34,8 +35,8 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
fun testNoKotlincExistsNoSettingsLatestRuntime() {
|
fun testNoKotlincExistsNoSettingsLatestRuntime() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.isSaveAllowed = true
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(VersionView.RELEASED_VERSION, module.languageVersionSettings.languageVersion)
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
Assert.assertEquals(VersionView.RELEASED_VERSION, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||||
application.saveAll()
|
application.saveAll()
|
||||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
||||||
}
|
}
|
||||||
@@ -43,8 +44,8 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
fun testKotlincExistsNoSettingsLatestRuntimeNoVersionAutoAdvance() {
|
fun testKotlincExistsNoSettingsLatestRuntimeNoVersionAutoAdvance() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.isSaveAllowed = true
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(VersionView.RELEASED_VERSION, module.languageVersionSettings.languageVersion)
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
Assert.assertEquals(VersionView.RELEASED_VERSION, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||||
autoAdvanceLanguageVersion = false
|
autoAdvanceLanguageVersion = false
|
||||||
autoAdvanceApiVersion = false
|
autoAdvanceApiVersion = false
|
||||||
@@ -56,7 +57,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
fun testDropKotlincOnVersionAutoAdvance() {
|
fun testDropKotlincOnVersionAutoAdvance() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.isSaveAllowed = true
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(LanguageVersion.KOTLIN_1_4, module.languageVersionSettings.languageVersion)
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||||
autoAdvanceLanguageVersion = true
|
autoAdvanceLanguageVersion = true
|
||||||
autoAdvanceApiVersion = true
|
autoAdvanceApiVersion = true
|
||||||
|
|||||||
@@ -176,7 +176,10 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
|||||||
|
|
||||||
public void testProjectWithFacetWithRuntime11WithLanguageLevel10() {
|
public void testProjectWithFacetWithRuntime11WithLanguageLevel10() {
|
||||||
assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(getModule()).getLanguageVersion());
|
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() {
|
public void testJsLibraryVersion11() {
|
||||||
|
|||||||
Reference in New Issue
Block a user