Extract new MPP tests from Gradle config tests, forbid them for 173
This removes four failing tests from 173 / AS31
This commit is contained in:
+67
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. 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.idea.codeInsight.gradle
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
|
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator
|
||||||
|
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||||
|
import org.jetbrains.kotlin.test.testFramework.runInEdtAndWait
|
||||||
|
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
|
||||||
|
@TargetVersions("4.7+")
|
||||||
|
@Test
|
||||||
|
fun testEnableFeatureSupportMultiplatform() {
|
||||||
|
val files = importProjectFromTestData()
|
||||||
|
|
||||||
|
runInEdtAndWait {
|
||||||
|
myTestFixture.project.executeWriteCommand("") {
|
||||||
|
KotlinWithGradleConfigurator.changeFeatureConfiguration(
|
||||||
|
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
checkFiles(files)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetVersions("4.7+")
|
||||||
|
@Test
|
||||||
|
fun testEnableFeatureSupportMultiplatformWithDots() {
|
||||||
|
val files = importProjectFromTestData()
|
||||||
|
|
||||||
|
runInEdtAndWait {
|
||||||
|
myTestFixture.project.executeWriteCommand("") {
|
||||||
|
KotlinWithGradleConfigurator.changeFeatureConfiguration(
|
||||||
|
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
checkFiles(files)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetVersions("4.7+")
|
||||||
|
@Test
|
||||||
|
fun testEnableFeatureSupportMultiplatformToExistentArguments() {
|
||||||
|
val files = importProjectFromTestData()
|
||||||
|
|
||||||
|
runInEdtAndWait {
|
||||||
|
myTestFixture.project.executeWriteCommand("") {
|
||||||
|
KotlinWithGradleConfigurator.changeFeatureConfiguration(
|
||||||
|
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
checkFiles(files)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun testDataDirName(): String {
|
||||||
|
return "configurator"
|
||||||
|
}
|
||||||
|
}
|
||||||
-80
@@ -6,24 +6,18 @@
|
|||||||
package org.jetbrains.kotlin.idea.codeInsight.gradle
|
package org.jetbrains.kotlin.idea.codeInsight.gradle
|
||||||
|
|
||||||
import com.intellij.openapi.extensions.Extensions
|
import com.intellij.openapi.extensions.Extensions
|
||||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
|
||||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil
|
|
||||||
import com.intellij.openapi.module.ModuleManager
|
import com.intellij.openapi.module.ModuleManager
|
||||||
import com.intellij.openapi.roots.DependencyScope
|
import com.intellij.openapi.roots.DependencyScope
|
||||||
import com.intellij.openapi.roots.ExternalLibraryDescriptor
|
import com.intellij.openapi.roots.ExternalLibraryDescriptor
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.idea.configuration.*
|
import org.jetbrains.kotlin.idea.configuration.*
|
||||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import org.jetbrains.kotlin.test.testFramework.runInEdtAndWait
|
import org.jetbrains.kotlin.test.testFramework.runInEdtAndWait
|
||||||
import org.jetbrains.kotlin.test.testFramework.runWriteAction
|
import org.jetbrains.kotlin.test.testFramework.runWriteAction
|
||||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class GradleConfiguratorTest : GradleImportingTestCase() {
|
class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||||
|
|
||||||
@@ -612,54 +606,6 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetVersions("4.7+")
|
|
||||||
@Test
|
|
||||||
fun testEnableFeatureSupportMultiplatform() {
|
|
||||||
val files = importProjectFromTestData()
|
|
||||||
|
|
||||||
runInEdtAndWait {
|
|
||||||
myTestFixture.project.executeWriteCommand("") {
|
|
||||||
KotlinWithGradleConfigurator.changeFeatureConfiguration(
|
|
||||||
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
checkFiles(files)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetVersions("4.7+")
|
|
||||||
@Test
|
|
||||||
fun testEnableFeatureSupportMultiplatformWithDots() {
|
|
||||||
val files = importProjectFromTestData()
|
|
||||||
|
|
||||||
runInEdtAndWait {
|
|
||||||
myTestFixture.project.executeWriteCommand("") {
|
|
||||||
KotlinWithGradleConfigurator.changeFeatureConfiguration(
|
|
||||||
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
checkFiles(files)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetVersions("4.7+")
|
|
||||||
@Test
|
|
||||||
fun testEnableFeatureSupportMultiplatformToExistentArguments() {
|
|
||||||
val files = importProjectFromTestData()
|
|
||||||
|
|
||||||
runInEdtAndWait {
|
|
||||||
myTestFixture.project.executeWriteCommand("") {
|
|
||||||
KotlinWithGradleConfigurator.changeFeatureConfiguration(
|
|
||||||
myTestFixture.module, LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED, false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
checkFiles(files)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testEnableFeatureSupportToExistentArguments() {
|
fun testEnableFeatureSupportToExistentArguments() {
|
||||||
val files = importProjectFromTestData()
|
val files = importProjectFromTestData()
|
||||||
@@ -720,33 +666,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun importProjectFromTestData(): List<VirtualFile> {
|
|
||||||
val files = configureByFiles()
|
|
||||||
importProject()
|
|
||||||
return files
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun testDataDirName(): String {
|
override fun testDataDirName(): String {
|
||||||
return "configurator"
|
return "configurator"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkFiles(files: List<VirtualFile>) {
|
|
||||||
FileDocumentManager.getInstance().saveAllDocuments()
|
|
||||||
|
|
||||||
files.filter {
|
|
||||||
it.name == GradleConstants.DEFAULT_SCRIPT_NAME
|
|
||||||
|| it.name == GradleConstants.KOTLIN_DSL_SCRIPT_NAME
|
|
||||||
|| it.name == GradleConstants.SETTINGS_FILE_NAME
|
|
||||||
}
|
|
||||||
.forEach {
|
|
||||||
if (it.name == GradleConstants.SETTINGS_FILE_NAME && !File(testDataDirectory(), it.name + SUFFIX).exists()) return@forEach
|
|
||||||
val actualText = LoadTextUtil.loadText(it).toString()
|
|
||||||
val expectedFileName = if (File(testDataDirectory(), it.name + ".$gradleVersion" + SUFFIX).exists()) {
|
|
||||||
it.name + ".$gradleVersion" + SUFFIX
|
|
||||||
} else {
|
|
||||||
it.name + SUFFIX
|
|
||||||
}
|
|
||||||
KotlinTestUtils.assertEqualsToFile(File(testDataDirectory(), expectedFileName), actualText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+30
@@ -24,6 +24,8 @@ import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutio
|
|||||||
import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings
|
import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings
|
||||||
import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter
|
import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter
|
||||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||||
|
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||||
|
import com.intellij.openapi.fileEditor.impl.LoadTextUtil
|
||||||
import com.intellij.openapi.fileTypes.FileTypeManager
|
import com.intellij.openapi.fileTypes.FileTypeManager
|
||||||
import com.intellij.openapi.projectRoots.JavaSdk
|
import com.intellij.openapi.projectRoots.JavaSdk
|
||||||
import com.intellij.openapi.projectRoots.ProjectJdkTable
|
import com.intellij.openapi.projectRoots.ProjectJdkTable
|
||||||
@@ -42,6 +44,7 @@ import org.gradle.wrapper.GradleWrapperMain
|
|||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import org.jetbrains.annotations.NonNls
|
import org.jetbrains.annotations.NonNls
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.plugins.gradle.settings.DistributionType
|
import org.jetbrains.plugins.gradle.settings.DistributionType
|
||||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||||
@@ -215,6 +218,33 @@ abstract class GradleImportingTestCase : ExternalSystemImportingTestCase() {
|
|||||||
}.toList()
|
}.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun importProjectFromTestData(): List<VirtualFile> {
|
||||||
|
val files = configureByFiles()
|
||||||
|
importProject()
|
||||||
|
return files
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun checkFiles(files: List<VirtualFile>) {
|
||||||
|
FileDocumentManager.getInstance().saveAllDocuments()
|
||||||
|
|
||||||
|
files.filter {
|
||||||
|
it.name == GradleConstants.DEFAULT_SCRIPT_NAME
|
||||||
|
|| it.name == GradleConstants.KOTLIN_DSL_SCRIPT_NAME
|
||||||
|
|| it.name == GradleConstants.SETTINGS_FILE_NAME
|
||||||
|
}
|
||||||
|
.forEach {
|
||||||
|
if (it.name == GradleConstants.SETTINGS_FILE_NAME && !File(testDataDirectory(), it.name + SUFFIX).exists()) return@forEach
|
||||||
|
val actualText = LoadTextUtil.loadText(it).toString()
|
||||||
|
val expectedFileName = if (File(testDataDirectory(), it.name + ".$gradleVersion" + SUFFIX).exists()) {
|
||||||
|
it.name + ".$gradleVersion" + SUFFIX
|
||||||
|
} else {
|
||||||
|
it.name + SUFFIX
|
||||||
|
}
|
||||||
|
KotlinTestUtils.assertEqualsToFile(File(testDataDirectory(), expectedFileName), actualText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun runWrite(f: () -> Unit) {
|
private fun runWrite(f: () -> Unit) {
|
||||||
object : WriteAction<Any>() {
|
object : WriteAction<Any>() {
|
||||||
override fun run(result: Result<Any>) {
|
override fun run(result: Result<Any>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user