Enable feature: add test for JPS case
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// "Enable inline classes support in the project" "true"
|
||||
// Here we just check that quick-fix disappears after application
|
||||
|
||||
<caret>inline class My(val x: String)
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Enable inline classes support in the project" "true"
|
||||
// Here we just check that quick-fix disappears after application
|
||||
|
||||
inline class My(val x: String)
|
||||
+13
@@ -1027,6 +1027,19 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/changeFeatureSupport")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ChangeFeatureSupport extends AbstractQuickFixMultiFileTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTestWithExtraFile, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInChangeFeatureSupport() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/changeFeatureSupport"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/changeSignature")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -1542,6 +1542,24 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/changeFeatureSupport")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ChangeFeatureSupport extends AbstractQuickFixTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInChangeFeatureSupport() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/changeFeatureSupport"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClass.kt")
|
||||
public void testInlineClass() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeFeatureSupport/inlineClass.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/changeSignature")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -40,6 +40,16 @@ import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||
import java.io.File
|
||||
|
||||
class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase() {
|
||||
fun testDisableInlineClasses() {
|
||||
configureRuntime("mockRuntime11")
|
||||
resetProjectSettings(LanguageVersion.KOTLIN_1_3)
|
||||
myFixture.configureByText("foo.kt", "inline class My(val n: Int)")
|
||||
|
||||
assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, inlineClassesSupport)
|
||||
myFixture.launchAction(myFixture.findSingleIntention("Disable inline classes support in the project"))
|
||||
assertEquals(LanguageFeature.State.DISABLED, inlineClassesSupport)
|
||||
}
|
||||
|
||||
fun testEnableCoroutines() {
|
||||
configureRuntime("mockRuntime11")
|
||||
resetProjectSettings(LanguageVersion.KOTLIN_1_1)
|
||||
@@ -192,6 +202,9 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
||||
private val coroutineSupport: LanguageFeature.State
|
||||
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.Coroutines)
|
||||
|
||||
private val inlineClassesSupport: LanguageFeature.State
|
||||
get() = project.getLanguageVersionSettings().getFeatureSupport(LanguageFeature.InlineClasses)
|
||||
|
||||
override fun tearDown() {
|
||||
FacetManager.getInstance(myModule).getFacetByType(KotlinFacetType.TYPE_ID)?.let {
|
||||
FacetUtil.deleteFacet(it)
|
||||
|
||||
Reference in New Issue
Block a user