mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] KTIJ-31690: rename option to support k2 by default
- pass k1 mode explicitly where it was missed GitOrigin-RevId: c4c7b2aa658094623e15af2685f2a0c3f6799048
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e882b3d3d2
commit
ac893e6775
+8
-1
@@ -17,9 +17,16 @@ import com.intellij.ui.components.JBList
|
||||
import com.intellij.util.PathUtil
|
||||
import org.jetbrains.idea.devkit.inspections.UnresolvedPluginConfigReferenceInspection
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/codeInsight/actionReference")
|
||||
class KtActionReferenceTest : JavaCodeInsightFixtureTestCase() {
|
||||
class KtActionReferenceTest : JavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
override fun getBasePath(): String {
|
||||
return DevkitKtTestsUtil.TESTDATA_PATH + "codeInsight/actionReference"
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@ package org.jetbrains.idea.devkit.kotlin.inspections
|
||||
|
||||
import com.intellij.openapi.util.IntellijInternalApi
|
||||
import org.jetbrains.idea.devkit.inspections.CallingMethodShouldBeRequiresBlockingContextInspection
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -12,7 +13,8 @@ import org.junit.runners.JUnit4
|
||||
import kotlin.test.assertNotNull as assertNotNullK
|
||||
|
||||
@RunWith(JUnit4::class)
|
||||
class CallingMethodShouldBeRequiresBlockingContextInspectionKtTest : KtBlockingContextInspectionTestCase() {
|
||||
class CallingMethodShouldBeRequiresBlockingContextInspectionKtTest : KtBlockingContextInspectionTestCase(), ExpectedPluginModeProvider {
|
||||
|
||||
@Before
|
||||
fun enableInspection() {
|
||||
myFixture.enableInspections(CallingMethodShouldBeRequiresBlockingContextInspection::class.java)
|
||||
|
||||
+10
-1
@@ -11,6 +11,9 @@ import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import com.intellij.testFramework.fixtures.kotlin.withKotlinStdlib
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -754,7 +757,13 @@ class ForbiddenInSuspectContextMethodInspectionTest : KtBlockingContextInspectio
|
||||
}
|
||||
|
||||
@RunWith(JUnit4::class)
|
||||
abstract class KtBlockingContextInspectionTestCase : LightJavaCodeInsightFixtureTestCase() {
|
||||
abstract class KtBlockingContextInspectionTestCase : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = PROJECT_DESCRIPTOR_WITH_KOTLIN
|
||||
|
||||
@Before
|
||||
|
||||
+6
-2
@@ -4,16 +4,20 @@ package org.jetbrains.idea.devkit.kotlin.inspections
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
import org.jetbrains.idea.devkit.inspections.CancellationCheckInLoopsInspectionTestBase
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/inspections/cancellationCheckInLoops")
|
||||
class KtCancellationCheckInLoopsInspectionTest : CancellationCheckInLoopsInspectionTestBase() {
|
||||
class KtCancellationCheckInLoopsInspectionTest : CancellationCheckInLoopsInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun getFileExtension(): String = "kt"
|
||||
|
||||
override fun getBasePath() = DevkitKtTestsUtil.TESTDATA_PATH + "inspections/cancellationCheckInLoops"
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
myFixture.addFileToProject(
|
||||
"Coroutines.kt",
|
||||
//language=kotlin
|
||||
|
||||
+9
-1
@@ -3,8 +3,16 @@ package org.jetbrains.idea.devkit.kotlin.inspections
|
||||
|
||||
import com.intellij.codeInspection.i18n.TitleCapitalizationInspection
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
class KtCapitalizationInspectionTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
class KtCapitalizationInspectionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
fun testBasic() {
|
||||
myFixture.enableInspections(TitleCapitalizationInspection())
|
||||
myFixture.configureByText("Foo.kt", """
|
||||
|
||||
+9
-1
@@ -8,8 +8,16 @@ import com.intellij.psi.PsiClassOwner
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
class KtI18NInspectionTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
class KtI18NInspectionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
||||
return JAVA_8
|
||||
}
|
||||
|
||||
+6
-2
@@ -5,11 +5,15 @@ import com.intellij.testFramework.TestDataPath
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.jetbrains.idea.devkit.inspections.IncorrectCancellationExceptionHandlingInspectionTestBase
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
abstract class KtIncorrectCancellationExceptionHandlingInspectionTestBase : IncorrectCancellationExceptionHandlingInspectionTestBase() {
|
||||
abstract class KtIncorrectCancellationExceptionHandlingInspectionTestBase : IncorrectCancellationExceptionHandlingInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
addKotlinFile("JvmPlatformAnnotations.kt", """
|
||||
package kotlin.jvm
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
+8
-1
@@ -4,9 +4,16 @@ package org.jetbrains.idea.devkit.kotlin.inspections
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
import org.jetbrains.idea.devkit.inspections.JComponentDataProviderInspectionTestBase
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/inspections/jComponentDataProvider")
|
||||
class KtJComponentDataProviderInspectionTest : JComponentDataProviderInspectionTestBase() {
|
||||
class KtJComponentDataProviderInspectionTest : JComponentDataProviderInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
override fun getFileExtension() = "kt"
|
||||
|
||||
|
||||
+8
-1
@@ -5,9 +5,16 @@ import com.intellij.codeInsight.daemon.QuickFixBundle
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
import org.jetbrains.idea.devkit.inspections.quickfix.MismatchedLightServiceLevelAndCtorInspectionTestBase
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/inspections/mismatchedLightServiceLevelAndCtor")
|
||||
internal class KtMismatchedLightServiceLevelAndCtorInspectionTest : MismatchedLightServiceLevelAndCtorInspectionTestBase() {
|
||||
internal class KtMismatchedLightServiceLevelAndCtorInspectionTest : MismatchedLightServiceLevelAndCtorInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
override fun getBasePath() = DevkitKtTestsUtil.TESTDATA_PATH + "inspections/mismatchedLightServiceLevelAndCtor/"
|
||||
|
||||
|
||||
+14
-1
@@ -17,11 +17,24 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.devkit.inspections.UnresolvedPluginConfigReferenceInspection;
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil;
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode;
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider;
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProviderKt;
|
||||
|
||||
@TestDataPath("$CONTENT_ROOT/testData/references/pluginConfigReference")
|
||||
public class KtPluginConfigReferenceTest extends JavaCodeInsightFixtureTestCase {
|
||||
public class KtPluginConfigReferenceTest extends JavaCodeInsightFixtureTestCase implements ExpectedPluginModeProvider {
|
||||
@Override
|
||||
public @NotNull KotlinPluginMode getPluginMode() {
|
||||
return KotlinPluginMode.K1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
ExpectedPluginModeProviderKt.setUpWithKotlinPlugin(this, () -> super.setUp());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
|
||||
+8
-1
@@ -2,8 +2,15 @@
|
||||
package org.jetbrains.idea.devkit.kotlin.inspections
|
||||
|
||||
import org.jetbrains.idea.devkit.inspections.PotentialDeadlockInServiceInitializationInspectionTestBase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
class KtPotentialDeadlockInServiceInitializationInspectionTest : PotentialDeadlockInServiceInitializationInspectionTestBase() {
|
||||
class KtPotentialDeadlockInServiceInitializationInspectionTest : PotentialDeadlockInServiceInitializationInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
fun `test read and write actions are reported in a light service`() {
|
||||
myFixture.configureByText("TestService.kt", getServiceWithReadAndWriteActionsCalledDuringInit(true))
|
||||
|
||||
+9
-1
@@ -2,8 +2,16 @@
|
||||
package org.jetbrains.idea.devkit.kotlin.inspections.internal
|
||||
|
||||
import org.jetbrains.idea.devkit.inspections.internal.FileEqualsUsageInspectionTestBase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
class KtFileEqualsUsageInspectionTest : FileEqualsUsageInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
class KtFileEqualsUsageInspectionTest : FileEqualsUsageInspectionTestBase() {
|
||||
fun testEquals() {
|
||||
doTest("equals(java.io.File(\"any\"))", true)
|
||||
}
|
||||
|
||||
+6
-2
@@ -22,12 +22,16 @@ import org.jetbrains.idea.devkit.inspections.missingApi.MissingRecentApiInspecti
|
||||
import org.jetbrains.idea.devkit.inspections.missingApi.MissingRecentApiUsageProcessor
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.idea.devkit.module.PluginModuleType
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
/**
|
||||
* Base class for tests of [MissingRecentApiInspection] on Java and Kotlin sources.
|
||||
*/
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/inspections/missingApi")
|
||||
class MissingRecentApiInspectionTest : PluginModuleTestCase() {
|
||||
class MissingRecentApiInspectionTest : PluginModuleTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
private val projectDescriptor = object : LightJavaCodeInsightFixtureTestCase.ProjectDescriptor(LanguageLevel.HIGHEST) {
|
||||
override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) {
|
||||
@@ -48,7 +52,7 @@ class MissingRecentApiInspectionTest : PluginModuleTestCase() {
|
||||
override fun getProjectDescriptor() = projectDescriptor
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
configureInspection()
|
||||
assertAnnotationsFoundForClass("library.RecentClass")
|
||||
assertAnnotationsFoundForClass("library.RecentKotlinClass")
|
||||
|
||||
+9
-1
@@ -2,12 +2,20 @@
|
||||
package org.jetbrains.idea.devkit.kotlin.inspections.path
|
||||
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
/**
|
||||
* Kotlin implementation of tests for PathAnnotationInspection.
|
||||
* Some tests might not pass because the inspection implementation might not fully support Kotlin.
|
||||
*/
|
||||
class PathAnnotationInspectionKotlinTest : PathAnnotationInspectionKotlinTestBase() {
|
||||
class PathAnnotationInspectionKotlinTest : PathAnnotationInspectionKotlinTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
fun testFileSystemGetPath() {
|
||||
doTest("""
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
|
||||
+6
-2
@@ -5,16 +5,20 @@ import com.intellij.testFramework.TestDataPath
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import org.jetbrains.idea.devkit.inspections.CancellationCheckInLoopsInspectionTestBase
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/inspections/insertCancellationCheckFix")
|
||||
class KtInsertCancellationCheckFixTest : CancellationCheckInLoopsInspectionTestBase() {
|
||||
class KtInsertCancellationCheckFixTest : CancellationCheckInLoopsInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun getFileExtension(): String = "kt"
|
||||
|
||||
override fun getBasePath() = DevkitKtTestsUtil.TESTDATA_PATH + "inspections/insertCancellationCheckFix"
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
myFixture.addFileToProject(
|
||||
"Coroutines.kt",
|
||||
//language=kotlin
|
||||
|
||||
+8
-1
@@ -5,9 +5,16 @@ import com.intellij.testFramework.TestDataPath
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import org.jetbrains.idea.devkit.inspections.quickfix.SimplifiableServiceRetrievingInspectionTestBase
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/inspections/simplifiableServiceRetrieving")
|
||||
internal class KtSimplifiableServiceRetrievingInspectionTest : SimplifiableServiceRetrievingInspectionTestBase() {
|
||||
internal class KtSimplifiableServiceRetrievingInspectionTest : SimplifiableServiceRetrievingInspectionTestBase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
override fun getBasePath() = DevkitKtTestsUtil.TESTDATA_PATH + "inspections/simplifiableServiceRetrieving/"
|
||||
|
||||
|
||||
+6
-2
@@ -5,6 +5,9 @@ import com.intellij.psi.PsiFile
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@Language("kotlin")
|
||||
private const val FLEET_RPC_API = """
|
||||
@@ -35,10 +38,11 @@ annotation class Serializable(
|
||||
annotation class Transient
|
||||
"""
|
||||
|
||||
class NonSerializableTypeInRpcInterfaceInspectionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class NonSerializableTypeInRpcInterfaceInspectionTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
myFixture.enableInspections(NonSerializableTypeInRpcInterfaceInspection())
|
||||
|
||||
myFixture.addFileToProject("fleet/rpc/Rpc.kt", FLEET_RPC_API)
|
||||
|
||||
+6
-2
@@ -5,6 +5,9 @@ import com.intellij.psi.PsiFile
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
@Language("kotlin")
|
||||
private const val FLEET_RPC_API = """
|
||||
@@ -16,10 +19,11 @@ interface RemoteApi<Metadata>
|
||||
annotation class Rpc
|
||||
"""
|
||||
|
||||
class RpcInterfaceDoesNotExtendRemoteApiInspectionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class RpcInterfaceDoesNotExtendRemoteApiInspectionTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
myFixture.enableInspections(RpcInterfaceDoesNotExtendRemoteApiInspection())
|
||||
|
||||
myFixture.addFileToProject("fleet/rpc/Rpc.kt", FLEET_RPC_API)
|
||||
|
||||
+8
-1
@@ -11,6 +11,9 @@ import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.uast.UClass
|
||||
import org.jetbrains.uast.UExpression
|
||||
import org.jetbrains.uast.expressions.UStringConcatenationsFacade.Companion.createFromTopConcatenation
|
||||
@@ -22,7 +25,11 @@ private const val i18nizedExpr = "i18nizedExpr"
|
||||
/**
|
||||
* Analogical Java tests: [com.intellij.java.codeInsight.daemon.quickFix.I18nizeTest]
|
||||
*/
|
||||
class KtI18nizeTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class KtI18nizeTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
private fun <T : UExpression> doTest(before: String, expected: String? = null, i18nized: String = i18nizedExpr) {
|
||||
myFixture.configureByText("Test.kt", before)
|
||||
|
||||
+6
-2
@@ -10,6 +10,9 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.jetbrains.idea.devkit.inspections.LevelType
|
||||
import org.jetbrains.idea.devkit.inspections.getLevelType
|
||||
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.uast.UClass
|
||||
import org.jetbrains.uast.getContainingUClass
|
||||
import org.jetbrains.uast.getParentOfType
|
||||
@@ -22,12 +25,13 @@ private const val SERVICE_DECLARATIONS_DIR = "serviceDeclarations"
|
||||
private const val SERVICE_USAGES_DIR = "serviceUsages"
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/testData/util/serviceUtil")
|
||||
class ServiceUtilTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class ServiceUtilTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun getBasePath(): String = DevkitKtTestsUtil.TESTDATA_PATH + "util/serviceUtil"
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
addPlatformClasses()
|
||||
myFixture.configureByFile("plugin.xml")
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ jvm_library(
|
||||
"//plugins/kotlin/base/util",
|
||||
"//plugins/kotlin/base/util:util_test_lib",
|
||||
"@lib//:junit4",
|
||||
"//plugins/kotlin/base/test:test_test_lib",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build kotlin.base.analysis.tests` end
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.util" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="module" module-name="kotlin.base.test" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+7
-2
@@ -10,16 +10,21 @@ import com.intellij.openapi.roots.ContentEntry
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.testFramework.JavaModuleTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleProductionSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleTestSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.SdkInfo
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.caches.project.IdeaModelInfosCache
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractModuleInfoCacheTest : JavaModuleTestCase() {
|
||||
abstract class AbstractModuleInfoCacheTest : JavaModuleTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
|
||||
getOrCreateProjectBaseDir()
|
||||
}
|
||||
|
||||
+17
-11
@@ -13,15 +13,19 @@ import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import com.intellij.testFramework.fixtures.MavenDependencyUtil
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.base.test.KotlinRoot
|
||||
import org.jetbrains.kotlin.idea.codeInsight.inspections.shared.runBlocking.RunBlockingInspection
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.kotlin.util.collectionUtils.concat
|
||||
import org.junit.jupiter.api.*
|
||||
import org.junit.jupiter.api.DynamicTest.dynamicTest
|
||||
import java.io.File
|
||||
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
class RunBlockingInspectionTest {
|
||||
class RunBlockingInspectionTest: ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
private val testDataDir = KotlinRoot.DIR.resolve("code-insight/inspections-shared/tests/testData/inspections/runBlocking").path
|
||||
private data class TraceElement(val fgName: String, val url: String, val fileAndLine: String)
|
||||
@@ -45,16 +49,18 @@ class RunBlockingInspectionTest {
|
||||
|
||||
@BeforeAll
|
||||
fun initialize() {
|
||||
testCase.setUp()
|
||||
testCase.getFixture().testDataPath = testDataDir
|
||||
val file = File("$testDataDir/inspectionData/tests.xml")
|
||||
val expectedRoot: Element = JDOMUtil.load(file)
|
||||
myTests = expectedRoot.getChildren("test").map {Test.fromElement(it)}
|
||||
|
||||
val aggregatedInputFiles = myTests.fold(mutableListOf<String>()) { acc, test -> acc.concat(test.inputFiles)!!.toMutableList() }
|
||||
aggregatedInputFiles.forEach { input ->
|
||||
val psiFile = testCase.getFixture().configureByFile(input)
|
||||
psiFileMap[input] = psiFile
|
||||
setUpWithKotlinPlugin(testCase.testRootDisposable) {
|
||||
testCase.setUp()
|
||||
testCase.getFixture().testDataPath = testDataDir
|
||||
val file = File("$testDataDir/inspectionData/tests.xml")
|
||||
val expectedRoot: Element = JDOMUtil.load(file)
|
||||
myTests = expectedRoot.getChildren("test").map {Test.fromElement(it)}
|
||||
|
||||
val aggregatedInputFiles = myTests.fold(mutableListOf<String>()) { acc, test -> acc.concat(test.inputFiles)!!.toMutableList() }
|
||||
aggregatedInputFiles.forEach { input ->
|
||||
val psiFile = testCase.getFixture().configureByFile(input)
|
||||
psiFileMap[input] = psiFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ jvm_library(
|
||||
"//plugins/kotlin/base/facet",
|
||||
"//plugins/kotlin/base/facet/tests:tests_test_lib",
|
||||
"//plugins/kotlin/compiler-plugins/compiler-plugin-support/common",
|
||||
"//plugins/kotlin/base/plugin",
|
||||
"//plugins/kotlin/base/plugin:plugin_test_lib",
|
||||
"//plugins/kotlin/base/test:test_test_lib",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build kotlin.compiler-plugins.compiler-plugin-support.tests` end
|
||||
|
||||
+2
@@ -17,5 +17,7 @@
|
||||
<orderEntry type="module" module-name="kotlin.base.facet" />
|
||||
<orderEntry type="module" module-name="kotlin.base.facet.tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.compiler-plugins.compiler-plugin-support.common" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.plugin" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.test" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+11
-2
@@ -20,7 +20,10 @@ import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode;
|
||||
import org.jetbrains.kotlin.idea.completion.test.CompletionTestUtilKt;
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider;
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProviderKt;
|
||||
import org.jetbrains.kotlin.idea.test.TestUtilsKt;
|
||||
import org.jetbrains.kotlin.idea.base.test.InTextDirectivesUtils;
|
||||
import org.junit.internal.runners.JUnit38ClassRunner;
|
||||
@@ -30,7 +33,12 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(JUnit38ClassRunner.class)
|
||||
public class KotlinConfidenceTest extends LightCompletionTestCase {
|
||||
public class KotlinConfidenceTest extends LightCompletionTestCase implements ExpectedPluginModeProvider {
|
||||
@Override
|
||||
public @NotNull KotlinPluginMode getPluginMode() {
|
||||
return KotlinPluginMode.K1;
|
||||
}
|
||||
|
||||
private static final String TYPE_DIRECTIVE_PREFIX = "// TYPE:";
|
||||
private final ThreadLocal<Boolean> skipComplete = ThreadLocal.withInitial(() -> false);
|
||||
|
||||
@@ -76,7 +84,8 @@ public class KotlinConfidenceTest extends LightCompletionTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
ExpectedPluginModeProviderKt.setUpWithKotlinPlugin(this, () -> super.setUp());
|
||||
|
||||
TestUtilsKt.invalidateLibraryCache(getProject());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ jvm_library(
|
||||
"@lib//:kotlinc-kotlin-compiler-common",
|
||||
"//plugins/kotlin/highlighting/highlighting-shared:kotlin-highlighting-shared",
|
||||
"//platform/diff-impl",
|
||||
"//plugins/kotlin/base/test:test_test_lib",
|
||||
"//plugins/kotlin/base/plugin",
|
||||
"//plugins/kotlin/base/plugin:plugin_test_lib",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build kotlin.highlighting.shared.tests` end
|
||||
|
||||
+2
@@ -18,5 +18,7 @@
|
||||
<orderEntry type="library" scope="TEST" name="kotlinc.kotlin-compiler-common" level="project" />
|
||||
<orderEntry type="module" module-name="kotlin.highlighting.shared" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.diff.impl" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.test" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.plugin" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+9
-1
@@ -10,11 +10,19 @@ import com.intellij.psi.PsiManager
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.kotlin.psi.KtExpressionCodeFragment
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import java.io.File
|
||||
|
||||
class KotlinHighlightingUtilsTest : LightPlatformTestCase() {
|
||||
class KotlinHighlightingUtilsTest : LightPlatformTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
private fun createKotlinFileAtPath(path: String): KtFile {
|
||||
val file = File(project.basePath, path.replace("/", File.separator))
|
||||
file.parentFile.mkdirs()
|
||||
|
||||
@@ -28,6 +28,9 @@ jvm_library(
|
||||
"//plugins/java-i18n:java-i18n_test_lib",
|
||||
"//plugins/properties/properties-psi-impl:backend-psi",
|
||||
"//plugins/kotlin/code-insight/api",
|
||||
"//plugins/kotlin/base/test:test_test_lib",
|
||||
"//plugins/kotlin/base/plugin",
|
||||
"//plugins/kotlin/base/plugin:plugin_test_lib",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build kotlin.i18n.tests` end
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
<orderEntry type="module" module-name="intellij.java.i18n" />
|
||||
<orderEntry type="module" module-name="intellij.properties.backend.psi" />
|
||||
<orderEntry type="module" module-name="kotlin.code-insight.api" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.test" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.plugin" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+14
-5
@@ -4,19 +4,28 @@ package org.jetbrains.kotlin.idea.i18n
|
||||
|
||||
import com.intellij.lang.properties.psi.Property
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.junit.Assert
|
||||
import org.junit.internal.runners.JUnit38ClassRunner
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(JUnit38ClassRunner::class)
|
||||
class I18nReferencesTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class I18nReferencesTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
myFixture.addClass("""package org.jetbrains.annotations;
|
||||
setUpWithKotlinPlugin {
|
||||
super.setUp()
|
||||
myFixture.addClass(
|
||||
"""package org.jetbrains.annotations;
|
||||
import java.lang.annotation.*;
|
||||
@Target({ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.FIELD, ElementType.TYPE_USE})
|
||||
public @interface PropertyKey { String resourceBundle(); }""")
|
||||
myFixture.addFileToProject("messages/MyBundle.properties", "key1=value1\nkey2=value2 {0}")
|
||||
public @interface PropertyKey { String resourceBundle(); }"""
|
||||
)
|
||||
myFixture.addFileToProject("messages/MyBundle.properties", "key1=value1\nkey2=value2 {0}")
|
||||
}
|
||||
}
|
||||
|
||||
fun testResolveResourceBundleKey() {
|
||||
|
||||
+11
-1
@@ -10,15 +10,22 @@ import com.intellij.psi.codeStyle.CodeStyleSettingsManager
|
||||
import com.intellij.psi.impl.source.codeStyle.json.CodeStyleSchemeJsonExporter
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.core.formatter.KotlinPackageEntry
|
||||
import org.jetbrains.kotlin.idea.formatter.*
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.IDEA_TEST_DATA_DIR
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
|
||||
|
||||
class KotlinCodeStyleSettingsTest : LightPlatformTestCase() {
|
||||
class KotlinCodeStyleSettingsTest : LightPlatformTestCase(), ExpectedPluginModeProvider {
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
fun `test json export with official code style`() = doTestWithJson(KotlinStyleGuideCodeStyle.INSTANCE, "officialCodeStyle")
|
||||
fun `test json export with obsolete code style`() = doTestWithJson(KotlinObsoleteCodeStyle.INSTANCE, "obsoleteCodeStyle")
|
||||
|
||||
@@ -105,6 +112,9 @@ class KotlinCodeStyleSettingsTest : LightPlatformTestCase() {
|
||||
assertTrue(copyOfSettings.kotlinCommonSettings == copyOfSettings.kotlinCommonSettings)
|
||||
assertTrue(copyOfSettings.kotlinCustomSettings == copyOfSettings.kotlinCustomSettings)
|
||||
}
|
||||
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
}
|
||||
|
||||
private fun doTestWithJson(codeStyle: KotlinPredefinedCodeStyle, fileName: String) {
|
||||
|
||||
+10
-1
@@ -3,8 +3,11 @@
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.kotlin.idea.util.getFileResolutionScope
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -14,7 +17,13 @@ import org.junit.internal.runners.JUnit38ClassRunner
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(JUnit38ClassRunner::class)
|
||||
class DummyFileResolveCachingTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class DummyFileResolveCachingTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.getInstance()
|
||||
|
||||
fun test() {
|
||||
|
||||
+9
-1
@@ -3,8 +3,16 @@ package org.jetbrains.kotlin.idea.actions
|
||||
|
||||
import com.intellij.ide.fileTemplates.impl.CustomFileTemplate
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
|
||||
class NewKotlinFileActionTest : BasePlatformTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
class NewKotlinFileActionTest : BasePlatformTestCase() {
|
||||
private val testTemplate = CustomFileTemplate("test template", "kt").apply {
|
||||
text = """
|
||||
#if (${'$'}{PACKAGE_NAME} && ${'$'}{PACKAGE_NAME} != "")package ${'$'}{PACKAGE_NAME}
|
||||
|
||||
+5
-1
@@ -3,16 +3,20 @@
|
||||
package org.jetbrains.kotlin.idea.actions
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.junit.internal.runners.JUnit38ClassRunner
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(JUnit38ClassRunner::class)
|
||||
class NewKotlinFileNameValidatorTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
class NewKotlinFileNameValidatorTest : LightJavaCodeInsightFixtureTestCase(), ExpectedPluginModeProvider {
|
||||
companion object {
|
||||
private const val EMPTY_PARTS_ERROR = "Name can't have empty parts"
|
||||
private const val EMPTY_ERROR = "Name can't be empty"
|
||||
}
|
||||
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
fun testEmptyName() {
|
||||
validateName("", EMPTY_ERROR)
|
||||
}
|
||||
|
||||
+7
-2
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.idea.base.platforms.KotlinJavaScriptLibraryKind
|
||||
import org.jetbrains.kotlin.idea.base.platforms.KotlinWasmJsLibraryKind
|
||||
import org.jetbrains.kotlin.idea.base.platforms.KotlinWasmWasiLibraryKind
|
||||
import org.jetbrains.kotlin.idea.artifacts.TestKotlinArtifacts
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.*
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.libraryToSourceAnalysis.withLibraryToSourceAnalysis
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.*
|
||||
@@ -42,6 +43,7 @@ import org.jetbrains.kotlin.idea.caches.project.getModuleInfosFromIdeaModel
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.ScriptConfigurationManager.Companion.updateScriptDependenciesSynchronously
|
||||
import org.jetbrains.kotlin.idea.core.script.v1.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils.allowProjectRootAccess
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils.disposeVfsRootAccess
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||
@@ -49,6 +51,7 @@ import org.jetbrains.kotlin.idea.test.PluginTestCaseBase.addJdk
|
||||
import org.jetbrains.kotlin.idea.test.addDependency
|
||||
import org.jetbrains.kotlin.idea.test.createMultiplatformFacetM3
|
||||
import org.jetbrains.kotlin.idea.test.runAll
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.kotlin.idea.util.application.executeOnPooledThread
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
@@ -75,7 +78,9 @@ import java.util.concurrent.TimeUnit
|
||||
import kotlin.test.assertContains
|
||||
|
||||
@RunWith(JUnit38ClassRunner::class)
|
||||
class IdeaModuleInfoTest8 : JavaModuleTestCase() {
|
||||
class IdeaModuleInfoTest8 : JavaModuleTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
private var vfsDisposable: Ref<Disposable>? = null
|
||||
|
||||
private fun getModuleInfoFromIdeaModuleWithJvmPlatformCheck(): List<IdeaModuleInfo> {
|
||||
@@ -2405,7 +2410,7 @@ class IdeaModuleInfoTest8 : JavaModuleTestCase() {
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
|
||||
vfsDisposable = allowProjectRootAccess(this)
|
||||
}
|
||||
|
||||
+2
@@ -15,9 +15,11 @@ import com.intellij.testFramework.junit5.fixture.TestFixture
|
||||
import com.intellij.testFramework.junit5.fixture.moduleFixture
|
||||
import com.intellij.testFramework.junit5.fixture.projectFixture
|
||||
import org.jetbrains.kotlin.idea.base.platforms.KotlinJavaScriptStdlibDetectorFacility
|
||||
import org.jetbrains.kotlin.idea.test.UseK1PluginMode
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@UseK1PluginMode
|
||||
@TestApplication
|
||||
class StdlibJsDetectorFacilityTest {
|
||||
companion object {
|
||||
|
||||
+7
-2
@@ -8,19 +8,24 @@ import com.intellij.lang.jvm.types.JvmType
|
||||
import com.intellij.psi.PsiType
|
||||
import com.intellij.psi.PsiTypes
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.uast.UMethod
|
||||
import org.junit.Assert
|
||||
import org.junit.internal.runners.JUnit38ClassRunner
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(JUnit38ClassRunner::class)
|
||||
class CommonIntentionActionsParametersTest : BasePlatformTestCase() {
|
||||
class CommonIntentionActionsParametersTest : BasePlatformTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
|
||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.getInstanceFullJdk()
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
myFixture.configureByText("Anno.kt", "annotation class Anno(val i: Int)")
|
||||
myFixture.configureByText("ClassRef.kt", "annotation class ClassRef(val klass: KClass<*>)")
|
||||
myFixture.configureByText("Root.kt", "annotation class Root(val children: Array<Child>")
|
||||
|
||||
+10
-1
@@ -15,8 +15,11 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||
import junit.framework.TestCase
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.jetbrains.kotlin.asJava.toLightElements
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode
|
||||
import org.jetbrains.kotlin.idea.base.util.allScope
|
||||
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
|
||||
import org.jetbrains.kotlin.psi.KtModifierListOwner
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
import org.jetbrains.uast.toUElement
|
||||
@@ -25,7 +28,13 @@ import org.junit.internal.runners.JUnit38ClassRunner
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(JUnit38ClassRunner::class)
|
||||
class CommonIntentionActionsTest : BasePlatformTestCase() {
|
||||
class CommonIntentionActionsTest : BasePlatformTestCase(), ExpectedPluginModeProvider {
|
||||
override val pluginMode: KotlinPluginMode = KotlinPluginMode.K1
|
||||
|
||||
override fun setUp() {
|
||||
setUpWithKotlinPlugin { super.setUp() }
|
||||
}
|
||||
|
||||
private class SimpleMethodRequest(
|
||||
project: Project,
|
||||
private val methodName: String,
|
||||
|
||||
+4
@@ -22,6 +22,10 @@ import kotlin.io.path.pathString
|
||||
import kotlin.io.path.walk
|
||||
|
||||
class GradleKotlinNewProjectWizardTest : GradleKotlinNewProjectWizardTestCase() {
|
||||
@Test
|
||||
fun testK1PluginIsUsed() {
|
||||
Assertions.assertTrue(System.getProperty("idea.kotlin.plugin.use.k1").toBoolean())
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource(GradleDsl::class)
|
||||
|
||||
Reference in New Issue
Block a user