Refactor and fix files previously affected by as36 patchset (KTI-315)
This commit is contained in:
@@ -3,7 +3,5 @@
|
|||||||
203_202
|
203_202
|
||||||
193
|
193
|
||||||
192_193
|
192_193
|
||||||
as36_192_193
|
|
||||||
as40_193
|
as40_193
|
||||||
as41
|
as41as42_as41
|
||||||
as42_as41
|
|
||||||
+3
-3
@@ -8,15 +8,15 @@ package org.jetbrains.kotlin.idea.frontend.api.fir
|
|||||||
import com.intellij.openapi.editor.CaretState
|
import com.intellij.openapi.editor.CaretState
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import org.jetbrains.kotlin.idea.addExternalTestFiles
|
import org.jetbrains.kotlin.idea.addExternalTestFiles
|
||||||
import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction
|
import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction
|
||||||
import org.jetbrains.kotlin.idea.frontend.api.CallInfo
|
import org.jetbrains.kotlin.idea.frontend.api.CallInfo
|
||||||
import org.jetbrains.kotlin.idea.frontend.api.analyze
|
import org.jetbrains.kotlin.idea.frontend.api.analyze
|
||||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
|
||||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol
|
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol
|
||||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol
|
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol
|
||||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtParameterSymbol
|
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtParameterSymbol
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
||||||
import org.jetbrains.kotlin.psi.KtBinaryExpression
|
import org.jetbrains.kotlin.psi.KtBinaryExpression
|
||||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
@@ -29,7 +29,7 @@ import kotlin.reflect.full.primaryConstructor
|
|||||||
import kotlin.reflect.jvm.javaGetter
|
import kotlin.reflect.jvm.javaGetter
|
||||||
|
|
||||||
|
|
||||||
abstract class AbstractResolveCallTest : @Suppress("DEPRECATION") KotlinLightCodeInsightTestCase() {
|
abstract class AbstractResolveCallTest : @Suppress("DEPRECATION") LightCodeInsightTestCase() {
|
||||||
override fun getTestDataPath(): String = KotlinTestUtils.getHomeDirectory() + "/"
|
override fun getTestDataPath(): String = KotlinTestUtils.getHomeDirectory() + "/"
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(path: String) {
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("unused", "IncompatibleAPI", "PropertyName")
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.test
|
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.editor.Document
|
|
||||||
import com.intellij.openapi.editor.Editor
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.psi.PsiFile
|
|
||||||
import com.intellij.testFramework.LightIdeaTestCase
|
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
@Deprecated("Use KotlinLightCodeInsightFixtureTestCase instead")
|
|
||||||
abstract class KotlinLightCodeInsightTestCase : com.intellij.testFramework.LightCodeInsightTestCase() {
|
|
||||||
protected inline val project_: Project get() = project
|
|
||||||
protected inline val module_: Module get() = module
|
|
||||||
protected inline val editor_: Editor get() = editor
|
|
||||||
protected inline val file_: PsiFile get() = file
|
|
||||||
protected inline val currentEditorDataContext_: DataContext get() = currentEditorDataContext
|
|
||||||
|
|
||||||
protected fun configureFromFileText_(fileName: String, fileText: String): Document {
|
|
||||||
return configureFromFileText(fileName, fileText, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
|
||||||
abstract class KotlinLightIdeaTestCase : LightIdeaTestCase() {
|
|
||||||
protected inline val project_: Project get() = project
|
|
||||||
protected inline val module_: Module get() = module
|
|
||||||
}
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("unused", "IncompatibleAPI", "PropertyName")
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.test
|
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.editor.Document
|
|
||||||
import com.intellij.openapi.editor.Editor
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.psi.PsiFile
|
|
||||||
import com.intellij.testFramework.LightIdeaTestCase
|
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
@Deprecated("Use KotlinLightCodeInsightFixtureTestCase instead")
|
|
||||||
abstract class KotlinLightCodeInsightTestCase : com.intellij.testFramework.LightCodeInsightTestCase() {
|
|
||||||
protected inline val project_: Project get() = project
|
|
||||||
protected inline val module_: Module get() = module
|
|
||||||
protected inline val editor_: Editor get() = editor
|
|
||||||
protected inline val file_: PsiFile get() = file
|
|
||||||
protected inline val currentEditorDataContext_: DataContext get() = currentEditorDataContext
|
|
||||||
|
|
||||||
protected fun configureFromFileText_(fileName: String, fileText: String): Document {
|
|
||||||
return configureFromFileText(fileName, fileText, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
|
||||||
abstract class KotlinLightIdeaTestCase : LightIdeaTestCase() {
|
|
||||||
protected inline val project_: Project get() = project
|
|
||||||
protected inline val module_: Module get() = module
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,8 @@ import org.jetbrains.kotlin.idea.KotlinIcons
|
|||||||
import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension
|
import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
// FIX ME WHEN BUNCH as40 REMOVED
|
||||||
|
// FIX ME WHEN BUNCH as41 REMOVED
|
||||||
internal fun createDslStyleIcon(styleId: Int): Icon {
|
internal fun createDslStyleIcon(styleId: Int): Icon {
|
||||||
val globalScheme = EditorColorsManager.getInstance().globalScheme
|
val globalScheme = EditorColorsManager.getInstance().globalScheme
|
||||||
val markersColor = globalScheme.getAttributes(DslHighlighterExtension.styleById(styleId)).foregroundColor
|
val markersColor = globalScheme.getAttributes(DslHighlighterExtension.styleById(styleId)).foregroundColor
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ package org.jetbrains.kotlin.idea.highlighter.markers
|
|||||||
import com.intellij.icons.AllIcons
|
import com.intellij.icons.AllIcons
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
// FIX ME WHEN BUNCH as40 REMOVED
|
||||||
|
// FIX ME WHEN BUNCH as41 REMOVED
|
||||||
internal fun createDslStyleIcon(styleId: Int): Icon {
|
internal fun createDslStyleIcon(styleId: Int): Icon {
|
||||||
return AllIcons.Gutter.Colors
|
return AllIcons.Gutter.Colors
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,8 @@ package org.jetbrains.kotlin.idea.highlighter.markers
|
|||||||
import com.intellij.icons.AllIcons
|
import com.intellij.icons.AllIcons
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
|
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
// FIX ME WHEN BUNCH as40 REMOVED
|
||||||
|
// FIX ME WHEN BUNCH as41 REMOVED
|
||||||
internal fun createDslStyleIcon(styleId: Int): Icon {
|
internal fun createDslStyleIcon(styleId: Int): Icon {
|
||||||
return AllIcons.Gutter.Colors
|
return AllIcons.Gutter.Colors
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.idea
|
package org.jetbrains.kotlin.idea
|
||||||
|
|
||||||
// Remove the function, when there's no dependency to cidr during running Kotlin tests.
|
// Remove the function, when there's no dependency to cidr during running Kotlin tests.
|
||||||
// FIX ME WHEN BUNCH as36 REMOVED
|
// FIX ME WHEN BUNCH as40 REMOVED
|
||||||
|
// FIX ME WHEN BUNCH as41 REMOVED
|
||||||
fun registerAdditionalResourceBundleInTests() {
|
fun registerAdditionalResourceBundleInTests() {
|
||||||
}
|
}
|
||||||
@@ -14,18 +14,17 @@ import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
|||||||
import com.intellij.openapi.util.TextRange;
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.openapi.util.registry.Registry;
|
import com.intellij.openapi.util.registry.Registry;
|
||||||
import com.intellij.openapi.util.registry.RegistryValue;
|
|
||||||
import com.intellij.pom.java.LanguageLevel;
|
import com.intellij.pom.java.LanguageLevel;
|
||||||
import com.intellij.psi.PsiDocumentManager;
|
import com.intellij.psi.PsiDocumentManager;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||||
|
import com.intellij.testFramework.LightIdeaTestCase;
|
||||||
import com.intellij.util.IncorrectOperationException;
|
import com.intellij.util.IncorrectOperationException;
|
||||||
import org.jetbrains.annotations.NonNls;
|
import org.jetbrains.annotations.NonNls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||||
import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings;
|
import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightIdeaTestCase;
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
@@ -37,7 +36,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
// Based on from com.intellij.psi.formatter.java.AbstractJavaFormatterTest
|
// Based on from com.intellij.psi.formatter.java.AbstractJavaFormatterTest
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
public abstract class AbstractFormatterTest extends KotlinLightIdeaTestCase {
|
public abstract class AbstractFormatterTest extends LightIdeaTestCase {
|
||||||
|
|
||||||
protected enum Action {REFORMAT, INDENT}
|
protected enum Action {REFORMAT, INDENT}
|
||||||
|
|
||||||
@@ -137,7 +136,7 @@ public abstract class AbstractFormatterTest extends KotlinLightIdeaTestCase {
|
|||||||
String testFileExtension = expectedFileNameWithExtension.substring(expectedFileNameWithExtension.lastIndexOf("."));
|
String testFileExtension = expectedFileNameWithExtension.substring(expectedFileNameWithExtension.lastIndexOf("."));
|
||||||
String originalFileText = FileUtil.loadFile(new File(testFileName + testFileExtension), true);
|
String originalFileText = FileUtil.loadFile(new File(testFileName + testFileExtension), true);
|
||||||
|
|
||||||
CodeStyleSettings codeStyleSettings = CodeStyle.getSettings(getProject_());
|
CodeStyleSettings codeStyleSettings = CodeStyle.getSettings(getProject());
|
||||||
KotlinCodeStyleSettings customSettings = codeStyleSettings.getCustomSettings(KotlinCodeStyleSettings.class);
|
KotlinCodeStyleSettings customSettings = codeStyleSettings.getCustomSettings(KotlinCodeStyleSettings.class);
|
||||||
try {
|
try {
|
||||||
Integer rightMargin = InTextDirectivesUtils.getPrefixedInt(originalFileText, "// RIGHT_MARGIN: ");
|
Integer rightMargin = InTextDirectivesUtils.getPrefixedInt(originalFileText, "// RIGHT_MARGIN: ");
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea
|
package org.jetbrains.kotlin.idea
|
||||||
|
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils
|
import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils
|
||||||
import org.jetbrains.kotlin.idea.refactoring.IntroduceRefactoringException
|
import org.jetbrains.kotlin.idea.refactoring.IntroduceRefactoringException
|
||||||
import org.jetbrains.kotlin.idea.refactoring.selectElement
|
import org.jetbrains.kotlin.idea.refactoring.selectElement
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class AbstractExpressionSelectionTest : KotlinLightCodeInsightTestCase() {
|
abstract class AbstractExpressionSelectionTest : LightCodeInsightTestCase() {
|
||||||
override fun getTestDataPath() = ""
|
override fun getTestDataPath() = ""
|
||||||
|
|
||||||
fun doTestExpressionSelection(path: String) {
|
fun doTestExpressionSelection(path: String) {
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea
|
package org.jetbrains.kotlin.idea
|
||||||
|
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils
|
import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils
|
||||||
import org.jetbrains.kotlin.idea.refactoring.getExpressionShortText
|
import org.jetbrains.kotlin.idea.refactoring.getExpressionShortText
|
||||||
import org.jetbrains.kotlin.idea.refactoring.getSmartSelectSuggestions
|
import org.jetbrains.kotlin.idea.refactoring.getSmartSelectSuggestions
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class AbstractSmartSelectionTest : KotlinLightCodeInsightTestCase() {
|
abstract class AbstractSmartSelectionTest : LightCodeInsightTestCase() {
|
||||||
fun doTestSmartSelection(path: String) {
|
fun doTestSmartSelection(path: String) {
|
||||||
configureByFile(path)
|
configureByFile(path)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.actions
|
|||||||
|
|
||||||
import com.intellij.ide.actions.CopyReferenceAction
|
import com.intellij.ide.actions.CopyReferenceAction
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||||
import org.jetbrains.kotlin.psi.KtVisitorVoid
|
import org.jetbrains.kotlin.psi.KtVisitorVoid
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||||
@@ -16,9 +16,9 @@ import java.util.*
|
|||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
||||||
class QualifiedNamesTest : KotlinLightCodeInsightTestCase() {
|
class QualifiedNamesTest : LightCodeInsightTestCase() {
|
||||||
fun testClassRef() {
|
fun testClassRef() {
|
||||||
configureFromFileText_(
|
configureFromFileText(
|
||||||
"class.kt",
|
"class.kt",
|
||||||
"""
|
"""
|
||||||
package foo.bar
|
package foo.bar
|
||||||
@@ -35,7 +35,8 @@ class QualifiedNamesTest : KotlinLightCodeInsightTestCase() {
|
|||||||
|
|
||||||
val anonymous = object {
|
val anonymous = object {
|
||||||
}
|
}
|
||||||
"""
|
""",
|
||||||
|
false
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
listOf(
|
listOf(
|
||||||
@@ -51,7 +52,7 @@ class QualifiedNamesTest : KotlinLightCodeInsightTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testFunRef() {
|
fun testFunRef() {
|
||||||
configureFromFileText_(
|
configureFromFileText(
|
||||||
"fun.kt",
|
"fun.kt",
|
||||||
"""
|
"""
|
||||||
package foo.bar
|
package foo.bar
|
||||||
@@ -66,7 +67,8 @@ class QualifiedNamesTest : KotlinLightCodeInsightTestCase() {
|
|||||||
fun topLevelFun()
|
fun topLevelFun()
|
||||||
|
|
||||||
val topLevelVal = ":)"
|
val topLevelVal = ":)"
|
||||||
"""
|
""",
|
||||||
|
false
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
listOf(
|
listOf(
|
||||||
@@ -82,7 +84,7 @@ class QualifiedNamesTest : KotlinLightCodeInsightTestCase() {
|
|||||||
|
|
||||||
private fun getQualifiedNamesForDeclarations(): List<String?> {
|
private fun getQualifiedNamesForDeclarations(): List<String?> {
|
||||||
val result = ArrayList<String?>()
|
val result = ArrayList<String?>()
|
||||||
file_.accept(object : KtVisitorVoid() {
|
file.accept(object : KtVisitorVoid() {
|
||||||
override fun visitElement(element: PsiElement) {
|
override fun visitElement(element: PsiElement) {
|
||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-6
@@ -5,25 +5,23 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.codeInsight.moveUpDown
|
package org.jetbrains.kotlin.idea.codeInsight.moveUpDown
|
||||||
|
|
||||||
import com.intellij.application.options.CodeStyle
|
|
||||||
import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementLeftAction
|
import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementLeftAction
|
||||||
import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementRightAction
|
import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementRightAction
|
||||||
import com.intellij.codeInsight.editorActions.moveUpDown.LineMover
|
import com.intellij.codeInsight.editorActions.moveUpDown.LineMover
|
||||||
import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementDownAction
|
import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementDownAction
|
||||||
import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementUpAction
|
import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementUpAction
|
||||||
import com.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover
|
import com.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
|
||||||
import com.intellij.openapi.application.runWriteAction
|
import com.intellij.openapi.application.runWriteAction
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction
|
import com.intellij.openapi.editor.actionSystem.EditorAction
|
||||||
import com.intellij.openapi.extensions.Extensions
|
import com.intellij.openapi.extensions.Extensions
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import junit.framework.ComparisonFailure
|
import junit.framework.ComparisonFailure
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.kotlin.formatter.FormatSettingsUtil
|
import org.jetbrains.kotlin.formatter.FormatSettingsUtil
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinDeclarationMover
|
import org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinDeclarationMover
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover
|
import org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover
|
||||||
import org.jetbrains.kotlin.idea.formatter.kotlinCustomSettings
|
import org.jetbrains.kotlin.idea.formatter.kotlinCustomSettings
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.configureCodeStyleAndRun
|
import org.jetbrains.kotlin.idea.test.configureCodeStyleAndRun
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
@@ -67,7 +65,7 @@ abstract class AbstractMoveLeftRightTest : AbstractCodeMoverTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class AbstractCodeMoverTest : KotlinLightCodeInsightTestCase() {
|
abstract class AbstractCodeMoverTest : LightCodeInsightTestCase() {
|
||||||
protected fun doTest(
|
protected fun doTest(
|
||||||
path: String,
|
path: String,
|
||||||
trailingComma: Boolean = false,
|
trailingComma: Boolean = false,
|
||||||
@@ -103,8 +101,8 @@ abstract class AbstractCodeMoverTest : KotlinLightCodeInsightTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun invokeAndCheck(path: String, action: EditorAction, isApplicableExpected: Boolean) {
|
private fun invokeAndCheck(path: String, action: EditorAction, isApplicableExpected: Boolean) {
|
||||||
val editor = editor_
|
val editor = editor
|
||||||
val dataContext = currentEditorDataContext_
|
val dataContext = currentEditorDataContext
|
||||||
|
|
||||||
val before = editor.document.text
|
val before = editor.document.text
|
||||||
runWriteAction { action.actionPerformed(editor, dataContext) }
|
runWriteAction { action.actionPerformed(editor, dataContext) }
|
||||||
|
|||||||
+2
-2
@@ -13,11 +13,11 @@ import com.intellij.openapi.editor.SelectionModel;
|
|||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.rt.execution.junit.FileComparisonFailure;
|
import com.intellij.rt.execution.junit.FileComparisonFailure;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.expression.*;
|
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.expression.*;
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement.*;
|
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement.*;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class AbstractSurroundWithTest extends KotlinLightCodeInsightTestCase {
|
public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase {
|
||||||
|
|
||||||
public void doTestWithIfSurrounder(String path) throws Exception {
|
public void doTestWithIfSurrounder(String path) throws Exception {
|
||||||
doTest(path, new KotlinIfSurrounder());
|
doTest(path, new KotlinIfSurrounder());
|
||||||
|
|||||||
+2
-2
@@ -11,16 +11,16 @@ import com.intellij.openapi.util.Condition;
|
|||||||
import com.intellij.openapi.util.Pair;
|
import com.intellij.openapi.util.Pair;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class AbstractUnwrapRemoveTest extends KotlinLightCodeInsightTestCase {
|
public abstract class AbstractUnwrapRemoveTest extends LightCodeInsightTestCase {
|
||||||
public void doTestExpressionRemover(@NotNull String path) throws Exception {
|
public void doTestExpressionRemover(@NotNull String path) throws Exception {
|
||||||
doTest(path, KotlinUnwrappers.KotlinExpressionRemover.class);
|
doTest(path, KotlinUnwrappers.KotlinExpressionRemover.class);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -16,11 +16,11 @@ import com.intellij.psi.PsiFile;
|
|||||||
import com.intellij.psi.PsiJavaModule;
|
import com.intellij.psi.PsiJavaModule;
|
||||||
import com.intellij.psi.search.FilenameIndex;
|
import com.intellij.psi.search.FilenameIndex;
|
||||||
import com.intellij.psi.search.GlobalSearchScope;
|
import com.intellij.psi.search.GlobalSearchScope;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import com.intellij.testFramework.LightProjectDescriptor;
|
import com.intellij.testFramework.LightProjectDescriptor;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||||
@@ -31,7 +31,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class AbstractConfigureProjectByChangingFileTest<C extends KotlinProjectConfigurator>
|
public abstract class AbstractConfigureProjectByChangingFileTest<C extends KotlinProjectConfigurator>
|
||||||
extends KotlinLightCodeInsightTestCase {
|
extends LightCodeInsightTestCase {
|
||||||
private static final String DEFAULT_VERSION = "default_version";
|
private static final String DEFAULT_VERSION = "default_version";
|
||||||
|
|
||||||
private PsiFile moduleInfoFile;
|
private PsiFile moduleInfoFile;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import com.intellij.application.options.CodeStyle;
|
|||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||||
import com.intellij.testFramework.EditorTestUtil;
|
import com.intellij.testFramework.EditorTestUtil;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import org.jetbrains.kotlin.formatter.FormatSettingsUtil;
|
import org.jetbrains.kotlin.formatter.FormatSettingsUtil;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
@@ -21,7 +21,7 @@ import java.io.File;
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
||||||
public class KotlinCommenterTest extends KotlinLightCodeInsightTestCase {
|
public class KotlinCommenterTest extends LightCodeInsightTestCase {
|
||||||
private static final String BASE_PATH =
|
private static final String BASE_PATH =
|
||||||
new File(PluginTestCaseBase.getTestDataPathBase(), "/editor/commenter/").getAbsolutePath();
|
new File(PluginTestCaseBase.getTestDataPathBase(), "/editor/commenter/").getAbsolutePath();
|
||||||
|
|
||||||
@@ -54,9 +54,9 @@ public class KotlinCommenterTest extends KotlinLightCodeInsightTestCase {
|
|||||||
private void doLineCommentTest() throws Exception {
|
private void doLineCommentTest() throws Exception {
|
||||||
configure();
|
configure();
|
||||||
|
|
||||||
CodeStyleSettings codeStyleSettings = CodeStyle.getSettings(getProject_());
|
CodeStyleSettings codeStyleSettings = CodeStyle.getSettings(getProject());
|
||||||
try {
|
try {
|
||||||
String text = getFile_().getText();
|
String text = getFile().getText();
|
||||||
|
|
||||||
SettingsConfigurator configurator = FormatSettingsUtil.createConfigurator(text, codeStyleSettings);
|
SettingsConfigurator configurator = FormatSettingsUtil.createConfigurator(text, codeStyleSettings);
|
||||||
configurator.configureSettings();
|
configurator.configureSettings();
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ package org.jetbrains.kotlin.idea.editor
|
|||||||
import com.intellij.application.options.CodeStyle
|
import com.intellij.application.options.CodeStyle
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||||
import com.intellij.testFramework.EditorTestUtil
|
import com.intellij.testFramework.EditorTestUtil
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||||
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle
|
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle
|
||||||
import org.jetbrains.kotlin.idea.formatter.ktCodeStyleSettings
|
import org.jetbrains.kotlin.idea.formatter.ktCodeStyleSettings
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
||||||
class TypedHandlerTest : KotlinLightCodeInsightTestCase() {
|
class TypedHandlerTest : LightCodeInsightTestCase() {
|
||||||
private val dollar = '$'
|
private val dollar = '$'
|
||||||
|
|
||||||
fun testTypeStringTemplateStart() = doTypeTest(
|
fun testTypeStringTemplateStart() = doTypeTest(
|
||||||
@@ -1089,8 +1089,8 @@ class TypedHandlerTest : KotlinLightCodeInsightTestCase() {
|
|||||||
|
|
||||||
fun testMoveThroughGT() {
|
fun testMoveThroughGT() {
|
||||||
configureFromFileText("a.kt", "val a: List<Set<Int<caret>>>")
|
configureFromFileText("a.kt", "val a: List<Set<Int<caret>>>")
|
||||||
EditorTestUtil.performTypingAction(editor_, '>')
|
EditorTestUtil.performTypingAction(editor, '>')
|
||||||
EditorTestUtil.performTypingAction(editor_, '>')
|
EditorTestUtil.performTypingAction(editor, '>')
|
||||||
checkResultByText("val a: List<Set<Int>><caret>")
|
checkResultByText("val a: List<Set<Int>><caret>")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1099,7 +1099,7 @@ class TypedHandlerTest : KotlinLightCodeInsightTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun enableSmartEnterWithTabs(): () -> Unit = {
|
private fun enableSmartEnterWithTabs(): () -> Unit = {
|
||||||
val indentOptions = CodeStyle.getSettings(project_).getIndentOptions(KotlinFileType.INSTANCE)
|
val indentOptions = CodeStyle.getSettings(project).getIndentOptions(KotlinFileType.INSTANCE)
|
||||||
indentOptions.USE_TAB_CHARACTER = true
|
indentOptions.USE_TAB_CHARACTER = true
|
||||||
indentOptions.SMART_TABS = true
|
indentOptions.SMART_TABS = true
|
||||||
}
|
}
|
||||||
@@ -1116,12 +1116,12 @@ class TypedHandlerTest : KotlinLightCodeInsightTestCase() {
|
|||||||
|
|
||||||
configureFromFileText("a.kt", beforeText.trimMargin())
|
configureFromFileText("a.kt", beforeText.trimMargin())
|
||||||
for (ch in text) {
|
for (ch in text) {
|
||||||
EditorTestUtil.performTypingAction(editor_, ch)
|
EditorTestUtil.performTypingAction(editor, ch)
|
||||||
}
|
}
|
||||||
checkResultByText(afterText.trimMargin())
|
checkResultByText(afterText.trimMargin())
|
||||||
} finally {
|
} finally {
|
||||||
if (settingsModifier != null) {
|
if (settingsModifier != null) {
|
||||||
CodeStyle.getSettings(project_).clearCodeStyleSettings()
|
CodeStyle.getSettings(project).clearCodeStyleSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1145,10 +1145,10 @@ class TypedHandlerTest : KotlinLightCodeInsightTestCase() {
|
|||||||
private fun doLtGtTest(initText: String, shouldCloseBeInsert: Boolean) {
|
private fun doLtGtTest(initText: String, shouldCloseBeInsert: Boolean) {
|
||||||
configureFromFileText("a.kt", initText)
|
configureFromFileText("a.kt", initText)
|
||||||
|
|
||||||
EditorTestUtil.performTypingAction(editor_, '<')
|
EditorTestUtil.performTypingAction(editor, '<')
|
||||||
checkResultByText(if (shouldCloseBeInsert) initText.replace("<caret>", "<<caret>>") else initText.replace("<caret>", "<<caret>"))
|
checkResultByText(if (shouldCloseBeInsert) initText.replace("<caret>", "<<caret>>") else initText.replace("<caret>", "<<caret>"))
|
||||||
|
|
||||||
EditorTestUtil.performTypingAction(editor_, EditorTestUtil.BACKSPACE_FAKE_CHAR)
|
EditorTestUtil.performTypingAction(editor, EditorTestUtil.BACKSPACE_FAKE_CHAR)
|
||||||
checkResultByText(initText)
|
checkResultByText(initText)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1157,7 +1157,7 @@ class TypedHandlerTest : KotlinLightCodeInsightTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val enableKotlinOfficialCodeStyle: () -> Unit = {
|
private val enableKotlinOfficialCodeStyle: () -> Unit = {
|
||||||
val settings = ktCodeStyleSettings(project_)?.all ?: error("No Settings")
|
val settings = ktCodeStyleSettings(project)?.all ?: error("No Settings")
|
||||||
KotlinStyleGuideCodeStyle.apply(settings)
|
KotlinStyleGuideCodeStyle.apply(settings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -8,11 +8,11 @@ package org.jetbrains.kotlin.idea.editor.backspaceHandler
|
|||||||
import com.intellij.openapi.actionSystem.IdeActions
|
import com.intellij.openapi.actionSystem.IdeActions
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import com.intellij.testFramework.EditorTestUtil
|
import com.intellij.testFramework.EditorTestUtil
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class AbstractBackspaceHandlerTest : KotlinLightCodeInsightTestCase() {
|
abstract class AbstractBackspaceHandlerTest : LightCodeInsightTestCase() {
|
||||||
fun doTest(path: String) {
|
fun doTest(path: String) {
|
||||||
configureFromFileText("a.kt", loadFile(path))
|
configureFromFileText("a.kt", loadFile(path))
|
||||||
EditorTestUtil.executeAction(getEditor(), IdeActions.ACTION_EDITOR_BACKSPACE)
|
EditorTestUtil.executeAction(getEditor(), IdeActions.ACTION_EDITOR_BACKSPACE)
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.framework.ui;
|
package org.jetbrains.kotlin.idea.framework.ui;
|
||||||
|
|
||||||
|
import com.intellij.testFramework.LightIdeaTestCase;
|
||||||
import com.intellij.util.text.VersionComparatorUtil;
|
import com.intellij.util.text.VersionComparatorUtil;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightIdeaTestCase;
|
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
||||||
public class LoadVersionsFromMavenTest extends KotlinLightIdeaTestCase {
|
public class LoadVersionsFromMavenTest extends LightIdeaTestCase {
|
||||||
public void testDownload() throws Exception {
|
public void testDownload() throws Exception {
|
||||||
Collection<String> versions = ConfigureDialogWithModulesAndVersion.loadVersions("1.0.0");
|
Collection<String> versions = ConfigureDialogWithModulesAndVersion.loadVersions("1.0.0");
|
||||||
assertTrue(versions.size() > 0);
|
assertTrue(versions.size() > 0);
|
||||||
|
|||||||
+2
-2
@@ -9,15 +9,15 @@ import com.intellij.codeInsight.editorActions.JoinLinesHandler;
|
|||||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
import com.intellij.rt.execution.junit.FileComparisonFailure;
|
import com.intellij.rt.execution.junit.FileComparisonFailure;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class AbstractJoinLinesTest extends KotlinLightCodeInsightTestCase {
|
public abstract class AbstractJoinLinesTest extends LightCodeInsightTestCase {
|
||||||
public void doTest(@NotNull String path) throws Exception {
|
public void doTest(@NotNull String path) throws Exception {
|
||||||
configureByFile(path);
|
configureByFile(path);
|
||||||
new JoinLinesHandler(null).execute(getEditor(), getEditor().getCaretModel().getCurrentCaret(),
|
new JoinLinesHandler(null).execute(getEditor(), getEditor().getCaretModel().getCurrentCaret(),
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ package org.jetbrains.kotlin.idea.kdoc;
|
|||||||
import com.intellij.codeInsight.TargetElementUtil;
|
import com.intellij.codeInsight.TargetElementUtil;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.refactoring.rename.RenameProcessor;
|
import com.intellij.refactoring.rename.RenameProcessor;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.test.CompatKt;
|
import org.jetbrains.kotlin.idea.test.CompatKt;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
||||||
public class KdocRenameTest extends KotlinLightCodeInsightTestCase {
|
public class KdocRenameTest extends LightCodeInsightTestCase {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
protected String getTestDataPath() {
|
protected String getTestDataPath() {
|
||||||
@@ -45,7 +45,7 @@ public class KdocRenameTest extends KotlinLightCodeInsightTestCase {
|
|||||||
private void doTest(String newName) {
|
private void doTest(String newName) {
|
||||||
configureByFile(getTestName(false) + ".kt");
|
configureByFile(getTestName(false) + ".kt");
|
||||||
PsiElement element = TargetElementUtil
|
PsiElement element = TargetElementUtil
|
||||||
.findTargetElement(getEditor_(),
|
.findTargetElement(getEditor(),
|
||||||
TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
|
TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
|
||||||
assertNotNull(element);
|
assertNotNull(element);
|
||||||
new RenameProcessor(getProject(), element, newName, true, true).run();
|
new RenameProcessor(getProject(), element, newName, true, true).run();
|
||||||
|
|||||||
+5
-5
@@ -6,18 +6,18 @@
|
|||||||
package org.jetbrains.kotlin.idea.navigation
|
package org.jetbrains.kotlin.idea.navigation
|
||||||
|
|
||||||
import com.intellij.openapi.projectRoots.Sdk
|
import com.intellij.openapi.projectRoots.Sdk
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase
|
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
|
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class AbstractKotlinGotoImplementationTest : KotlinLightCodeInsightTestCase() {
|
abstract class AbstractKotlinGotoImplementationTest : LightCodeInsightTestCase() {
|
||||||
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
invalidateLibraryCache(project_)
|
invalidateLibraryCache(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTestDataPath(): String = KotlinTestUtils.getHomeDirectory() + File.separator
|
override fun getTestDataPath(): String = KotlinTestUtils.getHomeDirectory() + File.separator
|
||||||
@@ -26,7 +26,7 @@ abstract class AbstractKotlinGotoImplementationTest : KotlinLightCodeInsightTest
|
|||||||
|
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(path: String) {
|
||||||
configureByFile(path)
|
configureByFile(path)
|
||||||
val gotoData = NavigationTestUtils.invokeGotoImplementations(editor_, file_)
|
val gotoData = NavigationTestUtils.invokeGotoImplementations(editor, file)
|
||||||
NavigationTestUtils.assertGotoDataMatching(editor_, gotoData)
|
NavigationTestUtils.assertGotoDataMatching(editor, gotoData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -8,12 +8,12 @@ package org.jetbrains.kotlin.idea.refactoring.rename;
|
|||||||
import com.intellij.codeInsight.TargetElementUtil;
|
import com.intellij.codeInsight.TargetElementUtil;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.refactoring.rename.RenameProcessor;
|
import com.intellij.refactoring.rename.RenameProcessor;
|
||||||
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase;
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class SimpleNameReferenceRenameTest extends KotlinLightCodeInsightTestCase {
|
public class SimpleNameReferenceRenameTest extends LightCodeInsightTestCase {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
@@ -52,7 +52,7 @@ public class SimpleNameReferenceRenameTest extends KotlinLightCodeInsightTestCas
|
|||||||
private void doTest(String newName) throws Exception {
|
private void doTest(String newName) throws Exception {
|
||||||
configureByFile(getTestName(true) + ".kt");
|
configureByFile(getTestName(true) + ".kt");
|
||||||
PsiElement element = TargetElementUtil
|
PsiElement element = TargetElementUtil
|
||||||
.findTargetElement(getEditor_(),
|
.findTargetElement(getEditor(),
|
||||||
TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
|
TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
|
||||||
assertNotNull(element);
|
assertNotNull(element);
|
||||||
new RenameProcessor(getProject(), element, newName, true, true).run();
|
new RenameProcessor(getProject(), element, newName, true, true).run();
|
||||||
|
|||||||
Reference in New Issue
Block a user