Use test path relative to testDataPath in fixture.configureByFile to be complaint with 193, part 3
This commit is contained in:
@@ -16,23 +16,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.analyzer
|
package org.jetbrains.kotlin.analyzer
|
||||||
|
|
||||||
import com.intellij.openapi.components.ServiceManager
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.util.ModificationTracker
|
import com.intellij.openapi.util.ModificationTracker
|
||||||
import com.intellij.psi.search.GlobalSearchScope
|
import com.intellij.psi.search.GlobalSearchScope
|
||||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
|
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
|
||||||
import org.jetbrains.kotlin.container.ComponentProvider
|
import org.jetbrains.kotlin.container.ComponentProvider
|
||||||
import org.jetbrains.kotlin.context.ModuleContext
|
import org.jetbrains.kotlin.context.ModuleContext
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
|
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDependencies
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDependencies
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||||
import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
@@ -207,7 +202,7 @@ interface ResolverForModuleComputationTracker {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getInstance(project: Project): ResolverForModuleComputationTracker? =
|
fun getInstance(project: Project): ResolverForModuleComputationTracker? =
|
||||||
ServiceManager.getService(project, ResolverForModuleComputationTracker::class.java) ?: null
|
project.getComponent(ResolverForModuleComputationTracker::class.java) ?: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -25,7 +25,8 @@ abstract class KotlinFixtureCompletionBaseTestCase : KotlinLightCodeInsightFixtu
|
|||||||
protected abstract fun defaultCompletionType(): CompletionType
|
protected abstract fun defaultCompletionType(): CompletionType
|
||||||
protected open fun defaultInvocationCount(): Int = 0
|
protected open fun defaultInvocationCount(): Int = 0
|
||||||
|
|
||||||
open fun doTest(testPath: String) {
|
open fun doTest(unused: String) {
|
||||||
|
val testPath = testPath()
|
||||||
setUpFixture(testPath)
|
setUpFixture(testPath)
|
||||||
|
|
||||||
val fileText = FileUtil.loadFile(File(testPath), true)
|
val fileText = FileUtil.loadFile(File(testPath), true)
|
||||||
@@ -58,7 +59,7 @@ abstract class KotlinFixtureCompletionBaseTestCase : KotlinLightCodeInsightFixtu
|
|||||||
//TODO: this is a hacky workaround for js second completion tests failing with PsiInvalidElementAccessException
|
//TODO: this is a hacky workaround for js second completion tests failing with PsiInvalidElementAccessException
|
||||||
LibraryModificationTracker.getInstance(project).incModificationCount()
|
LibraryModificationTracker.getInstance(project).incModificationCount()
|
||||||
|
|
||||||
myFixture.configureByFile(testPath)
|
myFixture.configureByFile(File(testPath).name)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun tearDownFixture() {
|
protected open fun tearDownFixture() {
|
||||||
|
|||||||
-67
@@ -1,67 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.completion.test
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.completion.CompletionType
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElement
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import org.jetbrains.kotlin.idea.caches.project.LibraryModificationTracker
|
|
||||||
import org.jetbrains.kotlin.idea.test.CompilerTestDirectives
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
|
|
||||||
import org.jetbrains.kotlin.idea.test.rollbackCompilerOptions
|
|
||||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class KotlinFixtureCompletionBaseTestCase : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
abstract fun getPlatform(): TargetPlatform
|
|
||||||
|
|
||||||
protected open fun complete(completionType: CompletionType, invocationCount: Int): Array<LookupElement>? =
|
|
||||||
myFixture.complete(completionType, invocationCount)
|
|
||||||
|
|
||||||
protected abstract fun defaultCompletionType(): CompletionType
|
|
||||||
protected open fun defaultInvocationCount(): Int = 0
|
|
||||||
|
|
||||||
open fun doTest(testPath: String) {
|
|
||||||
setUpFixture(fileName())
|
|
||||||
|
|
||||||
val fileText = FileUtil.loadFile(File(testPath), true)
|
|
||||||
val configured = configureCompilerOptions(fileText, project, module)
|
|
||||||
try {
|
|
||||||
|
|
||||||
assertTrue("\"<caret>\" is missing in file \"$testPath\"", fileText.contains("<caret>"))
|
|
||||||
|
|
||||||
if (ExpectedCompletionUtils.shouldRunHighlightingBeforeCompletion(fileText)) {
|
|
||||||
myFixture.doHighlighting()
|
|
||||||
}
|
|
||||||
|
|
||||||
testCompletion(
|
|
||||||
fileText,
|
|
||||||
getPlatform(),
|
|
||||||
{ completionType, count -> complete(completionType, count) },
|
|
||||||
defaultCompletionType(),
|
|
||||||
defaultInvocationCount(),
|
|
||||||
additionalValidDirectives = CompilerTestDirectives.ALL_COMPILER_TEST_DIRECTIVES
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
if (configured) {
|
|
||||||
rollbackCompilerOptions(project, module)
|
|
||||||
}
|
|
||||||
tearDownFixture()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun setUpFixture(testPath: String) {
|
|
||||||
//TODO: this is a hacky workaround for js second completion tests failing with PsiInvalidElementAccessException
|
|
||||||
LibraryModificationTracker.getInstance(project).incModificationCount()
|
|
||||||
|
|
||||||
myFixture.configureByFile(testPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun tearDownFixture() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+6
-6
@@ -28,14 +28,14 @@ abstract class AbstractCompletionHandlerTest(private val defaultCompletionType:
|
|||||||
private val CODE_STYLE_SETTING_PREFIX = "CODE_STYLE_SETTING:"
|
private val CODE_STYLE_SETTING_PREFIX = "CODE_STYLE_SETTING:"
|
||||||
|
|
||||||
protected open fun doTest(testPath: String) {
|
protected open fun doTest(testPath: String) {
|
||||||
setUpFixture(testPath)
|
setUpFixture(fileName())
|
||||||
|
|
||||||
val tempSettings = CodeStyle.getSettings(project).clone()
|
val tempSettings = CodeStyle.getSettings(project).clone()
|
||||||
CodeStyle.setTemporarySettings(project, tempSettings)
|
CodeStyle.setTemporarySettings(project, tempSettings)
|
||||||
val fileText = FileUtil.loadFile(File(testPath))
|
val fileText = FileUtil.loadFile(File(testPath))
|
||||||
val configured = configureCompilerOptions(fileText, project, module)
|
val configured = configureCompilerOptions(fileText, project, module)
|
||||||
try {
|
try {
|
||||||
assertTrue("\"<caret>\" is missing in file \"$testPath\"", fileText.contains("<caret>"));
|
assertTrue("\"<caret>\" is missing in file \"$testPath\"", fileText.contains("<caret>"))
|
||||||
|
|
||||||
|
|
||||||
val invocationCount = InTextDirectivesUtils.getPrefixedInt(fileText, INVOCATION_COUNT_PREFIX) ?: 1
|
val invocationCount = InTextDirectivesUtils.getPrefixedInt(fileText, INVOCATION_COUNT_PREFIX) ?: 1
|
||||||
@@ -98,10 +98,10 @@ abstract class AbstractCompletionHandlerTest(private val defaultCompletionType:
|
|||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AbstractBasicCompletionHandlerTest() : AbstractCompletionHandlerTest(CompletionType.BASIC)
|
abstract class AbstractBasicCompletionHandlerTest : AbstractCompletionHandlerTest(CompletionType.BASIC)
|
||||||
|
|
||||||
abstract class AbstractSmartCompletionHandlerTest() : AbstractCompletionHandlerTest(CompletionType.SMART)
|
abstract class AbstractSmartCompletionHandlerTest : AbstractCompletionHandlerTest(CompletionType.SMART)
|
||||||
|
|
||||||
abstract class AbstractCompletionCharFilterTest() : AbstractCompletionHandlerTest(CompletionType.BASIC)
|
abstract class AbstractCompletionCharFilterTest : AbstractCompletionHandlerTest(CompletionType.BASIC)
|
||||||
|
|
||||||
abstract class AbstractKeywordCompletionHandlerTest() : AbstractCompletionHandlerTest(CompletionType.BASIC)
|
abstract class AbstractKeywordCompletionHandlerTest : AbstractCompletionHandlerTest(CompletionType.BASIC)
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
|||||||
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
|
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
|
|
||||||
abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class CompletionHandlerTestBase : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
protected val fixture: JavaCodeInsightTestFixture
|
protected val fixture: JavaCodeInsightTestFixture
|
||||||
get() = myFixture
|
get() = myFixture
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -30,7 +30,6 @@ import com.intellij.psi.search.FileTypeIndex
|
|||||||
import com.intellij.psi.search.ProjectScope
|
import com.intellij.psi.search.ProjectScope
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import com.intellij.testFramework.LoggedErrorProcessor
|
import com.intellij.testFramework.LoggedErrorProcessor
|
||||||
import com.sun.tools.corba.se.idl.toJavaPortable.Util.fileName
|
|
||||||
import org.apache.log4j.Logger
|
import org.apache.log4j.Logger
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||||
import org.jetbrains.kotlin.config.CompilerSettings
|
import org.jetbrains.kotlin.config.CompilerSettings
|
||||||
@@ -64,9 +63,13 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||||||
|
|
||||||
protected open val captureExceptions = true
|
protected open val captureExceptions = true
|
||||||
|
|
||||||
protected fun testDataFile(): File = File(testDataPath, fileName())
|
protected fun testDataFile(fileName: String): File = File(testDataPath, fileName)
|
||||||
|
|
||||||
protected fun testPath(): String = testDataFile().toString()
|
protected fun testDataFile(): File = testDataFile(fileName())
|
||||||
|
|
||||||
|
protected fun testPath(fileName: String = fileName()): String = testDataFile(fileName).toString()
|
||||||
|
|
||||||
|
protected fun testPath(): String = testPath(fileName())
|
||||||
|
|
||||||
protected open fun fileName(): String = KotlinTestUtils.getTestDataFileName(this::class.java, this.name) ?: (getTestName(false) + ".kt")
|
protected open fun fileName(): String = KotlinTestUtils.getTestDataFileName(this::class.java, this.name) ?: (getTestName(false) + ".kt")
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -29,7 +29,6 @@ import com.intellij.psi.search.FileTypeIndex
|
|||||||
import com.intellij.psi.search.ProjectScope
|
import com.intellij.psi.search.ProjectScope
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import com.intellij.testFramework.LoggedErrorProcessor
|
import com.intellij.testFramework.LoggedErrorProcessor
|
||||||
import com.sun.tools.corba.se.idl.toJavaPortable.Util.fileName
|
|
||||||
import org.apache.log4j.Logger
|
import org.apache.log4j.Logger
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||||
import org.jetbrains.kotlin.config.CompilerSettings
|
import org.jetbrains.kotlin.config.CompilerSettings
|
||||||
@@ -63,9 +62,13 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||||||
|
|
||||||
protected open val captureExceptions = true
|
protected open val captureExceptions = true
|
||||||
|
|
||||||
protected fun testDataFile(): File = File(testDataPath, fileName())
|
protected fun testDataFile(fileName: String): File = File(testDataPath, fileName)
|
||||||
|
|
||||||
protected fun testPath(): String = testDataFile().toString()
|
protected fun testDataFile(): File = testDataFile(fileName())
|
||||||
|
|
||||||
|
protected fun testPath(fileName: String = fileName()): String = testDataFile(fileName).toString()
|
||||||
|
|
||||||
|
protected fun testPath(): String = testPath(fileName())
|
||||||
|
|
||||||
protected open fun fileName(): String = KotlinTestUtils.getTestDataFileName(this::class.java, this.name) ?: (getTestName(false) + ".kt")
|
protected open fun fileName(): String = KotlinTestUtils.getTestDataFileName(this::class.java, this.name) ?: (getTestName(false) + ".kt")
|
||||||
|
|
||||||
|
|||||||
+11
@@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
|
|||||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
|
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.kotlin.test.TestMetadata
|
import org.jetbrains.kotlin.test.TestMetadata
|
||||||
|
import java.io.File
|
||||||
import kotlin.reflect.full.findAnnotation
|
import kotlin.reflect.full.findAnnotation
|
||||||
|
|
||||||
abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeInsightFixtureTestCase() {
|
abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeInsightFixtureTestCase() {
|
||||||
@@ -38,5 +39,15 @@ abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeI
|
|||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun testDataFile(fileName: String): File = File(testDataPath, fileName)
|
||||||
|
|
||||||
|
protected fun testDataFile(): File = testDataFile(fileName())
|
||||||
|
|
||||||
|
protected fun testPath(fileName: String = fileName()): String = testDataFile(fileName).toString()
|
||||||
|
|
||||||
|
protected fun testPath(): String = testPath(fileName())
|
||||||
|
|
||||||
|
protected open fun fileName(): String = KotlinTestUtils.getTestDataFileName(this::class.java, this.name) ?: (getTestName(false) + ".kt")
|
||||||
|
|
||||||
override fun getTestDataPath(): String = this::class.findAnnotation<TestMetadata>()?.value ?: super.getTestDataPath()
|
override fun getTestDataPath(): String = this::class.findAnnotation<TestMetadata>()?.value ?: super.getTestDataPath()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-17
@@ -14,37 +14,23 @@ import org.jetbrains.kotlin.idea.debugger.breakpoints.*
|
|||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.idea.test.allKotlinFiles
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractBreakpointApplicabilityTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractBreakpointApplicabilityTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
private companion object {
|
private companion object {
|
||||||
private const val COMMENT = "///"
|
private const val COMMENT = "///"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTestDataPath(): String {
|
|
||||||
return PluginTestCaseBase.getTestDataPathBase() + "/debugger/breakpointApplicability/"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setUp() {
|
|
||||||
super.setUp()
|
|
||||||
myFixture.testDataPath = PluginTestCaseBase.getTestDataPathBase()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
override fun getProjectDescriptor(): LightProjectDescriptor {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(unused: String) {
|
||||||
myFixture.configureByFile(getPath(path))
|
val ktFile = myFixture.configureByFile(fileName()) as KtFile
|
||||||
|
|
||||||
val file = File(path)
|
|
||||||
val ktFile = project.allKotlinFiles().single()
|
|
||||||
|
|
||||||
val actualContents = checkBreakpoints(ktFile, BreakpointChecker())
|
val actualContents = checkBreakpoints(ktFile, BreakpointChecker())
|
||||||
KotlinTestUtils.assertEqualsToFile(file, actualContents)
|
KotlinTestUtils.assertEqualsToFile(testDataFile(), actualContents)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkBreakpoints(file: KtFile, checker: BreakpointChecker): String {
|
private fun checkBreakpoints(file: KtFile, checker: BreakpointChecker): String {
|
||||||
|
|||||||
+5
-8
@@ -5,15 +5,14 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.debugger.test
|
package org.jetbrains.kotlin.idea.debugger.test
|
||||||
|
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.debugger.KotlinEditorTextProvider
|
import org.jetbrains.kotlin.idea.debugger.KotlinEditorTextProvider
|
||||||
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor
|
||||||
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.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
|
|
||||||
abstract class AbstractSelectExpressionForDebuggerTest : LightCodeInsightFixtureTestCase() {
|
abstract class AbstractSelectExpressionForDebuggerTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
invalidateLibraryCache(project)
|
invalidateLibraryCache(project)
|
||||||
@@ -27,8 +26,8 @@ abstract class AbstractSelectExpressionForDebuggerTest : LightCodeInsightFixture
|
|||||||
doTest(path, false)
|
doTest(path, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doTest(path: String, allowMethodCalls: Boolean) {
|
fun doTest(unused: String, allowMethodCalls: Boolean) {
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByFile(fileName())
|
||||||
|
|
||||||
val elementAt = myFixture.file?.findElementAt(myFixture.caretOffset)!!
|
val elementAt = myFixture.file?.findElementAt(myFixture.caretOffset)!!
|
||||||
val selectedExpression = KotlinEditorTextProvider.findExpressionInner(elementAt, allowMethodCalls)
|
val selectedExpression = KotlinEditorTextProvider.findExpressionInner(elementAt, allowMethodCalls)
|
||||||
@@ -44,7 +43,5 @@ abstract class AbstractSelectExpressionForDebuggerTest : LightCodeInsightFixture
|
|||||||
Assert.assertEquals("Another expression should be selected", expected, actualResult)
|
Assert.assertEquals("Another expression should be selected", expected, actualResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = KotlinLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/debugger/selectExpression"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ public class PackageFacade {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// REF: /src/<test dir>/resolve/referenceInJava/dependency.dependencies.kt
|
// REF: /src.dependencies.kt
|
||||||
// CLS_REF: <jar>!/k.DependenciesKt.class
|
// CLS_REF: <jar>!/k.DependenciesKt.class
|
||||||
@@ -17,8 +17,8 @@ public abstract class AbstractJsCheckerTest extends KotlinLightCodeInsightFixtur
|
|||||||
return KotlinStdJSProjectDescriptor.INSTANCE;
|
return KotlinStdJSProjectDescriptor.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doTest(String filePath) {
|
public void doTest(String unused) {
|
||||||
myFixture.configureByFile(filePath);
|
myFixture.configureByFile(fileName());
|
||||||
myFixture.checkHighlighting(true, false, false);
|
myFixture.checkHighlighting(true, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.checkers;
|
|
||||||
|
|
||||||
import com.intellij.testFramework.LightProjectDescriptor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinStdJSProjectDescriptor;
|
|
||||||
|
|
||||||
public abstract class AbstractJsCheckerTest extends KotlinLightCodeInsightFixtureTestCase {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected LightProjectDescriptor getProjectDescriptor() {
|
|
||||||
return KotlinStdJSProjectDescriptor.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doTest(String filePath) {
|
|
||||||
myFixture.configureByFile(fileName());
|
|
||||||
myFixture.checkHighlighting(true, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,6 +15,7 @@ import org.junit.runner.RunWith
|
|||||||
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
||||||
class PsiCheckerCustomTest : AbstractPsiCheckerTest() {
|
class PsiCheckerCustomTest : AbstractPsiCheckerTest() {
|
||||||
|
|
||||||
|
@TestMetadata("noUnusedParameterWhenCustom.kt")
|
||||||
fun testNoUnusedParameterWhenCustom() {
|
fun testNoUnusedParameterWhenCustom() {
|
||||||
val testAnnotation = "MyTestAnnotation"
|
val testAnnotation = "MyTestAnnotation"
|
||||||
EntryPointsManagerBase.getInstance(project).ADDITIONAL_ANNOTATIONS.add(testAnnotation)
|
EntryPointsManagerBase.getInstance(project).ADDITIONAL_ANNOTATIONS.add(testAnnotation)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import com.intellij.openapi.util.io.FileUtil
|
|||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractCopyPasteTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractCopyPasteTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
private var savedImportsOnPasteSetting: Int = 0
|
private var savedImportsOnPasteSetting: Int = 0
|
||||||
@@ -28,23 +27,21 @@ abstract class AbstractCopyPasteTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun configureByDependencyIfExists(dependencyFileName: String): PsiFile? {
|
protected fun configureByDependencyIfExists(dependencyFileName: String): PsiFile? {
|
||||||
val file = File(testDataPath + File.separator + dependencyFileName)
|
val file = testDataFile(dependencyFileName)
|
||||||
if (!file.exists()) return null
|
if (!file.exists()) return null
|
||||||
return if (dependencyFileName.endsWith(".java")) {
|
return if (dependencyFileName.endsWith(".java")) {
|
||||||
//allow test framework to put it under right directory
|
//allow test framework to put it under right directory
|
||||||
myFixture.addClass(FileUtil.loadFile(file, true)).containingFile
|
myFixture.addClass(FileUtil.loadFile(file, true)).containingFile
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
myFixture.configureByFile(dependencyFileName)
|
myFixture.configureByFile(dependencyFileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun configureTargetFile(fileName: String): KtFile {
|
protected fun configureTargetFile(fileName: String): KtFile {
|
||||||
if (File(testDataPath + File.separator + fileName).exists()) {
|
return if (testDataFile(fileName).exists()) {
|
||||||
return myFixture.configureByFile(fileName) as KtFile
|
myFixture.configureByFile(fileName) as KtFile
|
||||||
}
|
} else {
|
||||||
else {
|
myFixture.configureByText(fileName, DEFAULT_TO_FILE_TEXT) as KtFile
|
||||||
return myFixture.configureByText(fileName, DEFAULT_TO_FILE_TEXT) as KtFile
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,28 +8,26 @@ package org.jetbrains.kotlin.idea.codeInsight
|
|||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightPlatformCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightPlatformCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
abstract class AbstractBreadcrumbsTest : KotlinLightPlatformCodeInsightFixtureTestCase() {
|
abstract class AbstractBreadcrumbsTest : KotlinLightPlatformCodeInsightFixtureTestCase() {
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor? = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor(): LightProjectDescriptor? = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/breadcrumbs"
|
protected open fun doTest(unused: String) {
|
||||||
|
val fileName = fileName()
|
||||||
protected open fun doTest(path: String) {
|
assert(fileName.endsWith(".kt")) { fileName }
|
||||||
assert(path.endsWith(".kt")) { path }
|
myFixture.configureByFile(fileName)
|
||||||
myFixture.configureByFile(path)
|
|
||||||
|
|
||||||
val element = myFixture.file.findElementAt(myFixture.caretOffset)!!
|
val element = myFixture.file.findElementAt(myFixture.caretOffset)!!
|
||||||
val provider = KotlinBreadcrumbsInfoProvider()
|
val provider = KotlinBreadcrumbsInfoProvider()
|
||||||
val elements = generateSequence(element) { provider.getParent(it) }
|
val elements = generateSequence(element) { provider.getParent(it) }
|
||||||
.filter { provider.acceptElement(it) }
|
.filter { provider.acceptElement(it) }
|
||||||
.toList()
|
.toList()
|
||||||
.asReversed()
|
.asReversed()
|
||||||
val crumbs = elements.joinToString(separator = "\n") { " " + provider.getElementInfo(it) }
|
val crumbs = elements.joinToString(separator = "\n") { " " + provider.getElementInfo(it) }
|
||||||
val tooltips = elements.joinToString(separator = "\n") { " " + provider.getElementTooltip(it) }
|
val tooltips = elements.joinToString(separator = "\n") { " " + provider.getElementTooltip(it) }
|
||||||
val resultText = "Crumbs:\n$crumbs\nTooltips:\n$tooltips"
|
val resultText = "Crumbs:\n$crumbs\nTooltips:\n$tooltips"
|
||||||
KotlinTestUtils.assertEqualsToFile(File(testDataPath + "/" + File(path).nameWithoutExtension + ".txt"), resultText)
|
KotlinTestUtils.assertEqualsToFile(testDataFile(File(fileName).nameWithoutExtension + ".txt"), resultText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,35 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.codeInsight
|
|
||||||
|
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightPlatformCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractBreadcrumbsTest : KotlinLightPlatformCodeInsightFixtureTestCase() {
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor? = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
|
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/breadcrumbs"
|
|
||||||
|
|
||||||
protected open fun doTest(path: String) {
|
|
||||||
assert(path.endsWith(".kt")) { path }
|
|
||||||
myFixture.configureByFile(path.substringAfterLast('/'))
|
|
||||||
|
|
||||||
val element = myFixture.file.findElementAt(myFixture.caretOffset)!!
|
|
||||||
val provider = KotlinBreadcrumbsInfoProvider()
|
|
||||||
val elements = generateSequence(element) { provider.getParent(it) }
|
|
||||||
.filter { provider.acceptElement(it) }
|
|
||||||
.toList()
|
|
||||||
.asReversed()
|
|
||||||
val crumbs = elements.joinToString(separator = "\n") { " " + provider.getElementInfo(it) }
|
|
||||||
val tooltips = elements.joinToString(separator = "\n") { " " + provider.getElementTooltip(it) }
|
|
||||||
val resultText = "Crumbs:\n$crumbs\nTooltips:\n$tooltips"
|
|
||||||
KotlinTestUtils.assertEqualsToFile(File(testDataPath + "/" + File(path).nameWithoutExtension + ".txt"), resultText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,16 +8,14 @@ package org.jetbrains.kotlin.idea.codeInsight
|
|||||||
import com.intellij.testFramework.UsefulTestCase
|
import com.intellij.testFramework.UsefulTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
|
|
||||||
abstract class AbstractExpressionTypeTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractExpressionTypeTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
override fun getBasePath() = PluginTestCaseBase.TEST_DATA_PROJECT_RELATIVE + "/codeInsight/expressionType"
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(path: String) {
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByFile(fileName())
|
||||||
val expressionTypeProvider = KotlinExpressionTypeProvider()
|
val expressionTypeProvider = KotlinExpressionTypeProvider()
|
||||||
val elementAtCaret = myFixture.file.findElementAt(myFixture.editor.caretModel.offset)!!
|
val elementAtCaret = myFixture.file.findElementAt(myFixture.editor.caretModel.offset)!!
|
||||||
val expressions = expressionTypeProvider.getExpressionsAt(elementAtCaret)
|
val expressions = expressionTypeProvider.getExpressionsAt(elementAtCaret)
|
||||||
|
|||||||
@@ -1,28 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.codeInsight
|
|
||||||
|
|
||||||
import com.intellij.testFramework.UsefulTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
|
|
||||||
abstract class AbstractExpressionTypeTest : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
override fun getBasePath() = PluginTestCaseBase.TEST_DATA_PROJECT_RELATIVE + "/codeInsight/expressionType"
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
|
||||||
myFixture.configureByFile(fileName())
|
|
||||||
val expressionTypeProvider = KotlinExpressionTypeProvider()
|
|
||||||
val elementAtCaret = myFixture.file.findElementAt(myFixture.editor.caretModel.offset)!!
|
|
||||||
val expressions = expressionTypeProvider.getExpressionsAt(elementAtCaret)
|
|
||||||
val types = expressions.map { "${it.text.replace('\n', ' ')} -> ${expressionTypeProvider.getInformationHint(it)}" }
|
|
||||||
val expectedTypes = InTextDirectivesUtils.findLinesWithPrefixesRemoved(myFixture.file.text, "// TYPE: ")
|
|
||||||
UsefulTestCase.assertOrderedEquals(types, expectedTypes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-11
@@ -8,22 +8,16 @@ package org.jetbrains.kotlin.idea.codeInsight
|
|||||||
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 org.jetbrains.kotlin.idea.AbstractCopyPasteTest
|
import org.jetbrains.kotlin.idea.AbstractCopyPasteTest
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.idea.test.dumpTextWithErrors
|
import org.jetbrains.kotlin.idea.test.dumpTextWithErrors
|
||||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
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 java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractInsertImportOnPasteTest : AbstractCopyPasteTest() {
|
abstract class AbstractInsertImportOnPasteTest : AbstractCopyPasteTest() {
|
||||||
private val BASE_PATH = PluginTestCaseBase.getTestDataPathBase() + "/copyPaste/imports"
|
|
||||||
|
|
||||||
private val NO_ERRORS_DUMP_DIRECTIVE = "// NO_ERRORS_DUMP"
|
private val NO_ERRORS_DUMP_DIRECTIVE = "// NO_ERRORS_DUMP"
|
||||||
private val DELETE_DEPENDENCIES_BEFORE_PASTE_DIRECTIVE = "// DELETE_DEPENDENCIES_BEFORE_PASTE"
|
private val DELETE_DEPENDENCIES_BEFORE_PASTE_DIRECTIVE = "// DELETE_DEPENDENCIES_BEFORE_PASTE"
|
||||||
|
|
||||||
override fun getTestDataPath() = BASE_PATH
|
|
||||||
|
|
||||||
protected fun doTestCut(path: String) {
|
protected fun doTestCut(path: String) {
|
||||||
doTestAction(IdeActions.ACTION_CUT, path)
|
doTestAction(IdeActions.ACTION_CUT, path)
|
||||||
}
|
}
|
||||||
@@ -32,9 +26,8 @@ abstract class AbstractInsertImportOnPasteTest : AbstractCopyPasteTest() {
|
|||||||
doTestAction(IdeActions.ACTION_COPY, path)
|
doTestAction(IdeActions.ACTION_COPY, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doTestAction(cutOrCopy: String, path: String) {
|
private fun doTestAction(cutOrCopy: String, unused: String) {
|
||||||
myFixture.testDataPath = BASE_PATH
|
val testFile = testDataFile()
|
||||||
val testFile = File(path)
|
|
||||||
val testFileText = FileUtil.loadFile(testFile, true)
|
val testFileText = FileUtil.loadFile(testFile, true)
|
||||||
val testFileName = testFile.name
|
val testFileName = testFile.name
|
||||||
|
|
||||||
@@ -57,13 +50,13 @@ abstract class AbstractInsertImportOnPasteTest : AbstractCopyPasteTest() {
|
|||||||
performNotWriteEditorAction(IdeActions.ACTION_PASTE)
|
performNotWriteEditorAction(IdeActions.ACTION_PASTE)
|
||||||
|
|
||||||
val namesToImportDump = KotlinCopyPasteReferenceProcessor.declarationsToImportSuggested.joinToString("\n")
|
val namesToImportDump = KotlinCopyPasteReferenceProcessor.declarationsToImportSuggested.joinToString("\n")
|
||||||
KotlinTestUtils.assertEqualsToFile(File(path.replace(".kt", ".expected.names")), namesToImportDump)
|
KotlinTestUtils.assertEqualsToFile(testDataFile(testFileName.replace(".kt", ".expected.names")), namesToImportDump)
|
||||||
|
|
||||||
val resultFile = myFixture.file as KtFile
|
val resultFile = myFixture.file as KtFile
|
||||||
val resultText = if (InTextDirectivesUtils.isDirectiveDefined(testFileText, NO_ERRORS_DUMP_DIRECTIVE))
|
val resultText = if (InTextDirectivesUtils.isDirectiveDefined(testFileText, NO_ERRORS_DUMP_DIRECTIVE))
|
||||||
resultFile.text
|
resultFile.text
|
||||||
else
|
else
|
||||||
resultFile.dumpTextWithErrors()
|
resultFile.dumpTextWithErrors()
|
||||||
KotlinTestUtils.assertEqualsToFile(File(path.replace(".kt", ".expected.kt")), resultText)
|
KotlinTestUtils.assertEqualsToFile(testDataFile(testFileName.replace(".kt", ".expected.kt")), resultText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.idea.navigation.NavigationTestUtils
|
|||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
@@ -34,10 +33,6 @@ import java.io.File
|
|||||||
|
|
||||||
abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
|
|
||||||
override fun getBasePath(): String {
|
|
||||||
return PluginTestCaseBase.TEST_DATA_PROJECT_RELATIVE + "/codeInsight/lineMarker"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
override fun getProjectDescriptor(): LightProjectDescriptor {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
}
|
}
|
||||||
@@ -56,14 +51,14 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun doTest(path: String, additionalCheck: () -> Unit) {
|
fun doTest(path: String, additionalCheck: () -> Unit) {
|
||||||
val fileText = FileUtil.loadFile(File(path))
|
val fileText = FileUtil.loadFile(testDataFile())
|
||||||
try {
|
try {
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myFixture.module, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(myFixture.module, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
if (InTextDirectivesUtils.findStringWithPrefixes(fileText, "METHOD_SEPARATORS") != null) {
|
if (InTextDirectivesUtils.findStringWithPrefixes(fileText, "METHOD_SEPARATORS") != null) {
|
||||||
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = true
|
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = true
|
||||||
}
|
}
|
||||||
|
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByFile(fileName())
|
||||||
val project = myFixture.project
|
val project = myFixture.project
|
||||||
val document = myFixture.editor.document
|
val document = myFixture.editor.document
|
||||||
|
|
||||||
@@ -72,7 +67,7 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
|
|
||||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||||
|
|
||||||
val markers = doAndCheckHighlighting(myFixture.project, document, data, File(path))
|
val markers = doAndCheckHighlighting(myFixture.project, document, data, testDataFile())
|
||||||
|
|
||||||
assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers)
|
assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers)
|
||||||
additionalCheck()
|
additionalCheck()
|
||||||
|
|||||||
@@ -1,189 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.codeInsight
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings
|
|
||||||
import com.intellij.codeInsight.daemon.LineMarkerInfo
|
|
||||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
|
|
||||||
import com.intellij.openapi.editor.Document
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.psi.PsiDocumentManager
|
|
||||||
import com.intellij.rt.execution.junit.FileComparisonFailure
|
|
||||||
import com.intellij.testFramework.ExpectedHighlightingData
|
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
|
||||||
import com.intellij.testFramework.PlatformTestUtil
|
|
||||||
import com.intellij.testFramework.UsefulTestCase
|
|
||||||
import junit.framework.TestCase
|
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.TestableLineMarkerNavigator
|
|
||||||
import org.jetbrains.kotlin.idea.navigation.NavigationTestUtils
|
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import org.jetbrains.kotlin.test.TagsTestDataUtil
|
|
||||||
import org.jetbrains.kotlin.test.util.renderAsGotoImplementation
|
|
||||||
import org.junit.Assert
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
|
|
||||||
override fun getBasePath(): String {
|
|
||||||
return PluginTestCaseBase.TEST_DATA_PROJECT_RELATIVE + "/codeInsight/lineMarker"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun doTest(path: String) = doTest(path) {}
|
|
||||||
|
|
||||||
protected fun doAndCheckHighlighting(
|
|
||||||
project: Project,
|
|
||||||
documentToAnalyze: Document,
|
|
||||||
expectedHighlighting: ExpectedHighlightingData,
|
|
||||||
expectedFile: File
|
|
||||||
): List<LineMarkerInfo<*>> {
|
|
||||||
myFixture.doHighlighting()
|
|
||||||
|
|
||||||
return checkHighlighting(project, documentToAnalyze, expectedHighlighting, expectedFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun doTest(path: String, additionalCheck: () -> Unit) {
|
|
||||||
val fileText = FileUtil.loadFile(File(path))
|
|
||||||
try {
|
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(myFixture.module, PlatformTestUtil.getCommunityPath(), fileText)
|
|
||||||
if (InTextDirectivesUtils.findStringWithPrefixes(fileText, "METHOD_SEPARATORS") != null) {
|
|
||||||
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = true
|
|
||||||
}
|
|
||||||
|
|
||||||
myFixture.configureByFile(fileName())
|
|
||||||
val project = myFixture.project
|
|
||||||
val document = myFixture.editor.document
|
|
||||||
|
|
||||||
val data = ExpectedHighlightingData(document, false, false, false, myFixture.file)
|
|
||||||
data.init()
|
|
||||||
|
|
||||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
|
||||||
|
|
||||||
val markers = doAndCheckHighlighting(myFixture.project, document, data, File(path))
|
|
||||||
|
|
||||||
assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers)
|
|
||||||
additionalCheck()
|
|
||||||
} catch (exc: Exception) {
|
|
||||||
throw RuntimeException(exc)
|
|
||||||
} finally {
|
|
||||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText)
|
|
||||||
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
|
||||||
private const val LINE_MARKER_PREFIX = "LINEMARKER:"
|
|
||||||
private const val TARGETS_PREFIX = "TARGETS"
|
|
||||||
|
|
||||||
fun assertNavigationElements(project: Project, file: KtFile, markers: List<LineMarkerInfo<*>>) {
|
|
||||||
val navigationDataComments = KotlinTestUtils.getLastCommentsInFile(
|
|
||||||
file, KotlinTestUtils.CommentType.BLOCK_COMMENT, false
|
|
||||||
)
|
|
||||||
if (navigationDataComments.isEmpty()) return
|
|
||||||
|
|
||||||
for ((navigationCommentIndex, navigationComment) in navigationDataComments.reversed().withIndex()) {
|
|
||||||
val description = getLineMarkerDescription(navigationComment)
|
|
||||||
val navigateMarkers = markers.filter { it.lineMarkerTooltip?.startsWith(description) == true }
|
|
||||||
val navigateMarker = navigateMarkers.singleOrNull() ?: navigateMarkers.getOrNull(navigationCommentIndex)
|
|
||||||
|
|
||||||
TestCase.assertNotNull(
|
|
||||||
String.format("Can't find marker for navigation check with description \"%s\"", description),
|
|
||||||
navigateMarker
|
|
||||||
)
|
|
||||||
|
|
||||||
val handler = navigateMarker!!.navigationHandler
|
|
||||||
if (handler is TestableLineMarkerNavigator) {
|
|
||||||
val navigateElements = handler.getTargetsPopupDescriptor(navigateMarker.element)?.targets?.sortedBy {
|
|
||||||
it.renderAsGotoImplementation()
|
|
||||||
}
|
|
||||||
val actualNavigationData = NavigationTestUtils.getNavigateElementsText(project, navigateElements)
|
|
||||||
|
|
||||||
UsefulTestCase.assertSameLines(getExpectedNavigationText(navigationComment), actualNavigationData)
|
|
||||||
} else {
|
|
||||||
Assert.fail("Only TestableLineMarkerNavigator are supported in navigate check")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getLineMarkerDescription(navigationComment: String): String {
|
|
||||||
val firstLineEnd = navigationComment.indexOf("\n")
|
|
||||||
TestCase.assertTrue(
|
|
||||||
"The first line in block comment must contain description of marker for navigation check", firstLineEnd != -1
|
|
||||||
)
|
|
||||||
|
|
||||||
var navigationMarkerText = navigationComment.substring(0, firstLineEnd)
|
|
||||||
|
|
||||||
TestCase.assertTrue(
|
|
||||||
String.format("Add %s directive in first line of comment", LINE_MARKER_PREFIX),
|
|
||||||
navigationMarkerText.startsWith(LINE_MARKER_PREFIX)
|
|
||||||
)
|
|
||||||
|
|
||||||
navigationMarkerText = navigationMarkerText.substring(LINE_MARKER_PREFIX.length)
|
|
||||||
|
|
||||||
return navigationMarkerText.trim { it <= ' ' }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getExpectedNavigationText(navigationComment: String): String {
|
|
||||||
val firstLineEnd = navigationComment.indexOf("\n")
|
|
||||||
|
|
||||||
var expectedNavigationText = navigationComment.substring(firstLineEnd + 1)
|
|
||||||
|
|
||||||
TestCase.assertTrue(
|
|
||||||
String.format("Marker %s is expected before navigation data", TARGETS_PREFIX),
|
|
||||||
expectedNavigationText.startsWith(TARGETS_PREFIX)
|
|
||||||
)
|
|
||||||
|
|
||||||
expectedNavigationText = expectedNavigationText.substring(expectedNavigationText.indexOf("\n") + 1)
|
|
||||||
|
|
||||||
return expectedNavigationText
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkHighlighting(
|
|
||||||
project: Project,
|
|
||||||
documentToAnalyze: Document,
|
|
||||||
expectedHighlighting: ExpectedHighlightingData,
|
|
||||||
expectedFile: File
|
|
||||||
): MutableList<LineMarkerInfo<*>> {
|
|
||||||
val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, project)
|
|
||||||
|
|
||||||
try {
|
|
||||||
expectedHighlighting.checkLineMarkers(markers, documentToAnalyze.text)
|
|
||||||
|
|
||||||
// This is a workaround for sad bug in ExpectedHighlightingData:
|
|
||||||
// the latter doesn't throw assertion error when some line markers are expected, but none are present.
|
|
||||||
if (FileUtil.loadFile(expectedFile).contains("<lineMarker") && markers.isEmpty()) {
|
|
||||||
throw AssertionError("Some line markers are expected, but nothing is present at all")
|
|
||||||
}
|
|
||||||
} catch (error: AssertionError) {
|
|
||||||
try {
|
|
||||||
val actualTextWithTestData = TagsTestDataUtil.insertInfoTags(markers, true, documentToAnalyze.text)
|
|
||||||
KotlinTestUtils.assertEqualsToFile(expectedFile, actualTextWithTestData)
|
|
||||||
} catch (failure: FileComparisonFailure) {
|
|
||||||
throw FileComparisonFailure(
|
|
||||||
error.message + "\n" + failure.message,
|
|
||||||
failure.expected,
|
|
||||||
failure.actual,
|
|
||||||
failure.filePath
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return markers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,25 +14,18 @@ import org.jetbrains.kotlin.idea.AbstractCopyPasteTest
|
|||||||
import org.jetbrains.kotlin.idea.core.moveCaret
|
import org.jetbrains.kotlin.idea.core.moveCaret
|
||||||
import org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsEditorCookie
|
import org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsEditorCookie
|
||||||
import org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsProcessor
|
import org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsProcessor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.idea.test.dumpTextWithErrors
|
import org.jetbrains.kotlin.idea.test.dumpTextWithErrors
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
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 java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractMoveOnCutPasteTest : AbstractCopyPasteTest() {
|
abstract class AbstractMoveOnCutPasteTest : AbstractCopyPasteTest() {
|
||||||
private val BASE_PATH = PluginTestCaseBase.getTestDataPathBase() + "/copyPaste/moveDeclarations"
|
|
||||||
|
|
||||||
private val OPTIMIZE_IMPORTS_AFTER_CUT_DIRECTIVE = "// OPTIMIZE_IMPORTS_AFTER_CUT"
|
private val OPTIMIZE_IMPORTS_AFTER_CUT_DIRECTIVE = "// OPTIMIZE_IMPORTS_AFTER_CUT"
|
||||||
private val IS_AVAILABLE_DIRECTIVE = "// IS_AVAILABLE:"
|
private val IS_AVAILABLE_DIRECTIVE = "// IS_AVAILABLE:"
|
||||||
private val COPY_DIRECTIVE = "// COPY"
|
private val COPY_DIRECTIVE = "// COPY"
|
||||||
|
|
||||||
override fun getTestDataPath() = BASE_PATH
|
protected fun doTest(unused: String) {
|
||||||
|
val testFile = testDataFile()
|
||||||
protected fun doTest(sourceFilePath: String) {
|
|
||||||
myFixture.testDataPath = BASE_PATH
|
|
||||||
val testFile = File(sourceFilePath)
|
|
||||||
val sourceFileName = testFile.name
|
val sourceFileName = testFile.name
|
||||||
val testFileText = FileUtil.loadFile(testFile, true)
|
val testFileText = FileUtil.loadFile(testFile, true)
|
||||||
|
|
||||||
@@ -52,7 +45,7 @@ abstract class AbstractMoveOnCutPasteTest : AbstractCopyPasteTest() {
|
|||||||
editor.putUserData(MoveDeclarationsEditorCookie.KEY, null) // because editor is reused
|
editor.putUserData(MoveDeclarationsEditorCookie.KEY, null) // because editor is reused
|
||||||
|
|
||||||
val targetFileName = sourceFileName.replace(".kt", ".to.kt")
|
val targetFileName = sourceFileName.replace(".kt", ".to.kt")
|
||||||
val targetFileExists = File(testDataPath + File.separator + targetFileName).exists()
|
val targetFileExists = testDataFile(targetFileName).exists()
|
||||||
val targetPsiFile = if (targetFileExists) configureTargetFile(targetFileName) else null
|
val targetPsiFile = if (targetFileExists) configureTargetFile(targetFileName) else null
|
||||||
performNotWriteEditorAction(IdeActions.ACTION_PASTE)
|
performNotWriteEditorAction(IdeActions.ACTION_PASTE)
|
||||||
|
|
||||||
@@ -68,15 +61,21 @@ abstract class AbstractMoveOnCutPasteTest : AbstractCopyPasteTest() {
|
|||||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||||
|
|
||||||
if (dependencyPsiFile != null) {
|
if (dependencyPsiFile != null) {
|
||||||
KotlinTestUtils.assertEqualsToFile(File(BASE_PATH, dependencyFileName.replace(".kt", ".expected.kt")),
|
KotlinTestUtils.assertEqualsToFile(
|
||||||
dependencyPsiFile.dumpTextWithErrors())
|
testDataFile(dependencyFileName.replace(".kt", ".expected.kt")),
|
||||||
|
dependencyPsiFile.dumpTextWithErrors()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
KotlinTestUtils.assertEqualsToFile(File(BASE_PATH, sourceFileName.replace(".kt", ".expected.kt")),
|
KotlinTestUtils.assertEqualsToFile(
|
||||||
sourcePsiFile.dumpTextWithErrors())
|
testDataFile(sourceFileName.replace(".kt", ".expected.kt")),
|
||||||
|
sourcePsiFile.dumpTextWithErrors()
|
||||||
|
)
|
||||||
if (targetPsiFile != null) {
|
if (targetPsiFile != null) {
|
||||||
KotlinTestUtils.assertEqualsToFile(File(BASE_PATH, targetFileName.replace(".kt", ".expected.kt")),
|
KotlinTestUtils.assertEqualsToFile(
|
||||||
targetPsiFile.dumpTextWithErrors())
|
testDataFile(targetFileName.replace(".kt", ".expected.kt")),
|
||||||
|
targetPsiFile.dumpTextWithErrors()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-15
@@ -17,29 +17,17 @@ import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
|||||||
import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListenerKt;
|
import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListenerKt;
|
||||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCodeInsightFixtureTestCase {
|
public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCodeInsightFixtureTestCase {
|
||||||
@Override
|
|
||||||
public void setUp() {
|
|
||||||
super.setUp();
|
|
||||||
myFixture.setTestDataPath(PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/outOfBlock");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
protected void doTest(String unused) throws IOException {
|
||||||
protected String getTestDataPath() {
|
myFixture.configureByFile(fileName());
|
||||||
return PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/outOfBlock";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doTest(String path) throws IOException {
|
|
||||||
myFixture.configureByFile(path);
|
|
||||||
|
|
||||||
boolean expectedOutOfBlock = getExpectedOutOfBlockResult();
|
boolean expectedOutOfBlock = getExpectedOutOfBlockResult();
|
||||||
boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK");
|
boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK");
|
||||||
@@ -67,7 +55,8 @@ public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCode
|
|||||||
|
|
||||||
assertTrue("Modification tracker should always be changed after type", modificationCountBeforeType != modificationCountAfterType);
|
assertTrue("Modification tracker should always be changed after type", modificationCountBeforeType != modificationCountAfterType);
|
||||||
|
|
||||||
assertEquals("Result for out of block test is differs from expected on element in file:\n" + FileUtil.loadFile(new File(path)),
|
assertEquals("Result for out of block test is differs from expected on element in file:\n"
|
||||||
|
+ FileUtil.loadFile(testDataFile()),
|
||||||
expectedOutOfBlock, oobBeforeType != oobAfterCount);
|
expectedOutOfBlock, oobBeforeType != oobAfterCount);
|
||||||
|
|
||||||
if (!isSkipCheckDefined) {
|
if (!isSkipCheckDefined) {
|
||||||
|
|||||||
-139
@@ -1,139 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.codeInsight;
|
|
||||||
|
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
|
||||||
import com.intellij.psi.PsiDocumentManager;
|
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import com.intellij.psi.PsiManager;
|
|
||||||
import com.intellij.psi.impl.PsiModificationTrackerImpl;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
|
||||||
import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListenerKt;
|
|
||||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade;
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
|
||||||
import org.jetbrains.kotlin.psi.*;
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
|
||||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCodeInsightFixtureTestCase {
|
|
||||||
@Override
|
|
||||||
public void setUp() {
|
|
||||||
super.setUp();
|
|
||||||
myFixture.setTestDataPath(PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/outOfBlock");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getTestDataPath() {
|
|
||||||
return PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/outOfBlock";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doTest(String path) throws IOException {
|
|
||||||
myFixture.configureByFile(fileName());
|
|
||||||
|
|
||||||
boolean expectedOutOfBlock = getExpectedOutOfBlockResult();
|
|
||||||
boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK");
|
|
||||||
|
|
||||||
assertTrue("It's allowed to skip check with analyze only for tests where out-of-block is expected",
|
|
||||||
!isSkipCheckDefined || expectedOutOfBlock);
|
|
||||||
|
|
||||||
|
|
||||||
PsiModificationTrackerImpl tracker =
|
|
||||||
(PsiModificationTrackerImpl) PsiManager.getInstance(myFixture.getProject()).getModificationTracker();
|
|
||||||
|
|
||||||
PsiElement element = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
|
|
||||||
assertNotNull("Should be valid element", element);
|
|
||||||
|
|
||||||
KtFile file = (KtFile) getFile();
|
|
||||||
|
|
||||||
long oobBeforeType = KotlinCodeBlockModificationListenerKt.getOutOfBlockModificationCount(file);
|
|
||||||
long modificationCountBeforeType = tracker.getModificationCount();
|
|
||||||
|
|
||||||
myFixture.type(getStringToType());
|
|
||||||
PsiDocumentManager.getInstance(myFixture.getProject()).commitDocument(myFixture.getDocument(myFixture.getFile()));
|
|
||||||
|
|
||||||
long oobAfterCount = KotlinCodeBlockModificationListenerKt.getOutOfBlockModificationCount(file);
|
|
||||||
long modificationCountAfterType = tracker.getModificationCount();
|
|
||||||
|
|
||||||
assertTrue("Modification tracker should always be changed after type", modificationCountBeforeType != modificationCountAfterType);
|
|
||||||
|
|
||||||
assertEquals("Result for out of block test is differs from expected on element in file:\n" + FileUtil.loadFile(new File(path)),
|
|
||||||
expectedOutOfBlock, oobBeforeType != oobAfterCount);
|
|
||||||
|
|
||||||
if (!isSkipCheckDefined) {
|
|
||||||
checkOOBWithDescriptorsResolve(expectedOutOfBlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkOOBWithDescriptorsResolve(boolean expectedOutOfBlock) {
|
|
||||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
((PsiModificationTrackerImpl) PsiManager.getInstance(myFixture.getProject()).getModificationTracker())
|
|
||||||
.incOutOfCodeBlockModificationCounter();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
PsiElement updateElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset() - 1);
|
|
||||||
KtExpression ktExpression = PsiTreeUtil.getParentOfType(updateElement, KtExpression.class, false);
|
|
||||||
KtDeclaration ktDeclaration = PsiTreeUtil.getParentOfType(updateElement, KtDeclaration.class, false);
|
|
||||||
KtElement ktElement = ktExpression != null ? ktExpression : ktDeclaration;
|
|
||||||
|
|
||||||
if (ktElement == null) return;
|
|
||||||
|
|
||||||
ResolutionFacade facade = ResolutionUtils.getResolutionFacade(ktElement.getContainingKtFile());
|
|
||||||
ResolveSession session = facade.getFrontendService(ResolveSession.class);
|
|
||||||
session.forceResolveAll();
|
|
||||||
|
|
||||||
BindingContext context = session.getBindingContext();
|
|
||||||
|
|
||||||
if (ktExpression != null && ktExpression != ktDeclaration) {
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
|
||||||
boolean expressionProcessed = context.get(
|
|
||||||
BindingContext.PROCESSED,
|
|
||||||
ktExpression instanceof KtFunctionLiteral ? (KtLambdaExpression) ktExpression.getParent() : ktExpression) == Boolean.TRUE;
|
|
||||||
|
|
||||||
assertEquals("Expected out-of-block should result expression analyzed and vise versa", expectedOutOfBlock,
|
|
||||||
expressionProcessed);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
boolean declarationProcessed = context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, ktDeclaration) != null;
|
|
||||||
assertEquals("Expected out-of-block should result declaration analyzed and vise versa", expectedOutOfBlock,
|
|
||||||
declarationProcessed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getStringToType() {
|
|
||||||
String text = myFixture.getDocument(myFixture.getFile()).getText();
|
|
||||||
String typeDirectives = InTextDirectivesUtils.findStringWithPrefixes(text, "TYPE:");
|
|
||||||
|
|
||||||
return typeDirectives != null ? StringUtil.unescapeStringCharacters(typeDirectives) : "a";
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean getExpectedOutOfBlockResult() {
|
|
||||||
String text = myFixture.getDocument(myFixture.getFile()).getText();
|
|
||||||
|
|
||||||
boolean expectedOutOfBlock = false;
|
|
||||||
if (text.startsWith("// TRUE")) {
|
|
||||||
expectedOutOfBlock = true;
|
|
||||||
}
|
|
||||||
else if (text.startsWith("// FALSE")) {
|
|
||||||
expectedOutOfBlock = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fail("Expectation of code block result test should be configured with " +
|
|
||||||
"\"// TRUE\" or \"// FALSE\" directive in the beginning of the file");
|
|
||||||
}
|
|
||||||
return expectedOutOfBlock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+9
-9
@@ -50,7 +50,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected open fun doTest(path: String) {
|
protected open fun doTest(path: String) {
|
||||||
val fileText = FileUtil.loadFile(File(path), true)
|
val fileText = FileUtil.loadFile(testDataFile(), true)
|
||||||
|
|
||||||
val conflictFile = File("$path.messages")
|
val conflictFile = File("$path.messages")
|
||||||
val afterFile = File("$path.after")
|
val afterFile = File("$path.after")
|
||||||
@@ -60,19 +60,19 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
try {
|
try {
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
||||||
|
|
||||||
val mainFile = File(path)
|
val mainFile = testDataFile()
|
||||||
val mainFileName = mainFile.name
|
val mainFileName = mainFile.name
|
||||||
val fileNameBase = mainFile.nameWithoutExtension + "."
|
val fileNameBase = mainFile.nameWithoutExtension + "."
|
||||||
val rootDir = mainFile.parentFile
|
val rootDir = mainFile.parentFile
|
||||||
rootDir
|
rootDir
|
||||||
.list { _, name ->
|
.list { _, name ->
|
||||||
name.startsWith(fileNameBase) && name != mainFileName && (name.endsWith(".kt") || name.endsWith(".java"))
|
name.startsWith(fileNameBase) && name != mainFileName && (name.endsWith(".kt") || name.endsWith(".java"))
|
||||||
}
|
}
|
||||||
.forEach {
|
.forEach {
|
||||||
myFixture.configureByFile(File(rootDir, it).path.replace(File.separator, "/"))
|
myFixture.configureByFile(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
configure(path, fileText)
|
configure(fileName(), fileText)
|
||||||
mainPsiFile = myFixture.file as KtFile
|
mainPsiFile = myFixture.file as KtFile
|
||||||
|
|
||||||
val targetPlatformName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// PLATFORM: ")
|
val targetPlatformName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// PLATFORM: ")
|
||||||
|
|||||||
-120
@@ -1,120 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.codeInsight.generate
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.actions.CodeInsightAction
|
|
||||||
import com.intellij.openapi.actionSystem.AnAction
|
|
||||||
import com.intellij.openapi.actionSystem.Presentation
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.refactoring.util.CommonRefactoringUtil
|
|
||||||
import com.intellij.testFramework.PlatformTestUtil
|
|
||||||
import com.intellij.testFramework.TestActionEvent
|
|
||||||
import junit.framework.ComparisonFailure
|
|
||||||
import junit.framework.TestCase
|
|
||||||
import org.jetbrains.kotlin.idea.project.forcedTargetPlatform
|
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
|
||||||
import org.jetbrains.kotlin.platform.CommonPlatforms
|
|
||||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
|
||||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
protected open fun createAction(fileText: String): CodeInsightAction {
|
|
||||||
val actionClassName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// ACTION_CLASS: ")
|
|
||||||
return Class.forName(actionClassName).newInstance() as CodeInsightAction
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun configure(mainFilePath: String, mainFileText: String) {
|
|
||||||
myFixture.configureByFile(fileName()) as KtFile
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun checkExtra() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun testAction(action: AnAction, forced: Boolean): Presentation {
|
|
||||||
val e = TestActionEvent(action)
|
|
||||||
action.beforeActionPerformedUpdate(e)
|
|
||||||
if (forced || (e.presentation.isEnabled && e.presentation.isVisible)) {
|
|
||||||
action.actionPerformed(e)
|
|
||||||
}
|
|
||||||
return e.presentation
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun doTest(path: String) {
|
|
||||||
val fileText = FileUtil.loadFile(File(path), true)
|
|
||||||
|
|
||||||
val conflictFile = File("$path.messages")
|
|
||||||
val afterFile = File("$path.after")
|
|
||||||
|
|
||||||
var mainPsiFile: KtFile? = null
|
|
||||||
|
|
||||||
try {
|
|
||||||
ConfigLibraryUtil.configureLibrariesByDirective(module, PlatformTestUtil.getCommunityPath(), fileText)
|
|
||||||
|
|
||||||
val mainFile = File(path)
|
|
||||||
val mainFileName = mainFile.name
|
|
||||||
val fileNameBase = mainFile.nameWithoutExtension + "."
|
|
||||||
val rootDir = mainFile.parentFile
|
|
||||||
rootDir
|
|
||||||
.list { _, name ->
|
|
||||||
name.startsWith(fileNameBase) && name != mainFileName && (name.endsWith(".kt") || name.endsWith(".java"))
|
|
||||||
}
|
|
||||||
.forEach {
|
|
||||||
myFixture.configureByFile(File(rootDir, it).path.replace(File.separator, "/"))
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(path, fileText)
|
|
||||||
mainPsiFile = myFixture.file as KtFile
|
|
||||||
|
|
||||||
val targetPlatformName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// PLATFORM: ")
|
|
||||||
if (targetPlatformName != null) {
|
|
||||||
val targetPlatform = when (targetPlatformName) {
|
|
||||||
"JVM" -> JvmPlatforms.unspecifiedJvmPlatform
|
|
||||||
"JavaScript" -> JsPlatforms.defaultJsPlatform
|
|
||||||
"Common" -> CommonPlatforms.defaultCommonPlatform
|
|
||||||
else -> error("Unexpected platform name: $targetPlatformName")
|
|
||||||
}
|
|
||||||
mainPsiFile.forcedTargetPlatform = targetPlatform
|
|
||||||
}
|
|
||||||
|
|
||||||
val action = createAction(fileText)
|
|
||||||
|
|
||||||
val isApplicableExpected = !InTextDirectivesUtils.isDirectiveDefined(fileText, "// NOT_APPLICABLE")
|
|
||||||
val isForced = InTextDirectivesUtils.isDirectiveDefined(fileText, "// FORCED")
|
|
||||||
|
|
||||||
val presentation = testAction(action, isForced)
|
|
||||||
if (!isForced) {
|
|
||||||
TestCase.assertEquals(isApplicableExpected, presentation.isEnabled)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(!conflictFile.exists()) { "Conflict file $conflictFile should not exist" }
|
|
||||||
|
|
||||||
if (isForced || isApplicableExpected) {
|
|
||||||
TestCase.assertTrue(afterFile.exists())
|
|
||||||
myFixture.checkResult(FileUtil.loadFile(afterFile, true))
|
|
||||||
checkExtra()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e: ComparisonFailure) {
|
|
||||||
KotlinTestUtils.assertEqualsToFile(afterFile, myFixture.editor)
|
|
||||||
}
|
|
||||||
catch (e: CommonRefactoringUtil.RefactoringErrorHintException) {
|
|
||||||
KotlinTestUtils.assertEqualsToFile(conflictFile, e.message!!)
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
mainPsiFile?.forcedTargetPlatform = null
|
|
||||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
}
|
|
||||||
+1
-2
@@ -9,13 +9,12 @@ import com.intellij.codeInsight.CodeInsightSettings
|
|||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateEqualsAndHashcodeAction
|
import org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateEqualsAndHashcodeAction
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractGenerateHashCodeAndEqualsActionTest : AbstractCodeInsightActionTest() {
|
abstract class AbstractGenerateHashCodeAndEqualsActionTest : AbstractCodeInsightActionTest() {
|
||||||
override fun createAction(fileText: String) = KotlinGenerateEqualsAndHashcodeAction()
|
override fun createAction(fileText: String) = KotlinGenerateEqualsAndHashcodeAction()
|
||||||
|
|
||||||
override fun doTest(path: String) {
|
override fun doTest(path: String) {
|
||||||
val fileText = FileUtil.loadFile(File(path), true)
|
val fileText = FileUtil.loadFile(testDataFile(), true)
|
||||||
|
|
||||||
val codeInsightSettings = CodeInsightSettings.getInstance()
|
val codeInsightSettings = CodeInsightSettings.getInstance()
|
||||||
val useInstanceOfOnEqualsParameterOld = codeInsightSettings.USE_INSTANCEOF_ON_EQUALS_PARAMETER
|
val useInstanceOfOnEqualsParameterOld = codeInsightSettings.USE_INSTANCEOF_ON_EQUALS_PARAMETER
|
||||||
|
|||||||
+4
-8
@@ -14,23 +14,19 @@ import org.jetbrains.kotlin.psi.KtFile
|
|||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
abstract class AbstractKotlinCoverageOutputFilesTest(): KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractKotlinCoverageOutputFilesTest: KotlinLightCodeInsightFixtureTestCase() {
|
||||||
private val TEST_DATA_PATH = PluginTestCaseBase.getTestDataPathBase() + "/coverage/outputFiles"
|
|
||||||
|
|
||||||
override fun getTestDataPath(): String = TEST_DATA_PATH
|
|
||||||
|
|
||||||
fun doTest(path: String) {
|
fun doTest(path: String) {
|
||||||
val kotlinFile = myFixture.configureByFile(path) as KtFile
|
val kotlinFile = myFixture.configureByFile(fileName()) as KtFile
|
||||||
val outDir = myFixture.tempDirFixture.findOrCreateDir("coverageTestOut")
|
val outDir = myFixture.tempDirFixture.findOrCreateDir("coverageTestOut")
|
||||||
try {
|
try {
|
||||||
FileUtil.loadLines(File(path.replace(".kt", ".classes.txt"))).forEach {
|
FileUtil.loadLines(File(testPath().replace(".kt", ".classes.txt"))).forEach {
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
createEmptyFile(outDir, it)
|
createEmptyFile(outDir, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val actualClasses = KotlinCoverageExtension.collectGeneratedClassQualifiedNames(outDir, kotlinFile)
|
val actualClasses = KotlinCoverageExtension.collectGeneratedClassQualifiedNames(outDir, kotlinFile)
|
||||||
KotlinTestUtils.assertEqualsToFile(File(path.replace(".kt", ".expected.txt")), actualClasses!!.joinToString("\n"))
|
KotlinTestUtils.assertEqualsToFile(File(testPath().replace(".kt", ".expected.txt")), actualClasses!!.joinToString("\n"))
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
|
|||||||
+2
-5
@@ -8,8 +8,6 @@ package org.jetbrains.kotlin.idea.debugger.evaluate
|
|||||||
import org.jetbrains.kotlin.checkers.AbstractPsiCheckerTest
|
import org.jetbrains.kotlin.checkers.AbstractPsiCheckerTest
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import java.io.File
|
|
||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentAutoImportTest : AbstractPsiCheckerTest() {
|
abstract class AbstractCodeFragmentAutoImportTest : AbstractPsiCheckerTest() {
|
||||||
@@ -21,15 +19,14 @@ abstract class AbstractCodeFragmentAutoImportTest : AbstractPsiCheckerTest() {
|
|||||||
?: error("No import fix available")
|
?: error("No import fix available")
|
||||||
importFix.invoke(project, editor, file)
|
importFix.invoke(project, editor, file)
|
||||||
|
|
||||||
myFixture.checkResultByFile("$filePath.after")
|
myFixture.checkResultByFile("${fileName()}.after")
|
||||||
|
|
||||||
val fragment = myFixture.file as KtCodeFragment
|
val fragment = myFixture.file as KtCodeFragment
|
||||||
fragment.checkImports(testDataPath + File.separator + filePath)
|
fragment.checkImports(testPath())
|
||||||
|
|
||||||
val fixAfter = myFixture.availableIntentions.firstOrNull { it.familyName == "Import" }
|
val fixAfter = myFixture.availableIntentions.firstOrNull { it.familyName == "Import" }
|
||||||
assertNull(fixAfter, "No import fix should be available after")
|
assertNull(fixAfter, "No import fix should be available after")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
override fun getTestDataPath() = KotlinTestUtils.getHomeDirectory()
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.psi.KtCodeFragment
|
|||||||
|
|
||||||
abstract class AbstractCodeFragmentCompletionHandlerTest : AbstractCompletionHandlerTest(CompletionType.BASIC) {
|
abstract class AbstractCodeFragmentCompletionHandlerTest : AbstractCompletionHandlerTest(CompletionType.BASIC) {
|
||||||
override fun setUpFixture(testPath: String) {
|
override fun setUpFixture(testPath: String) {
|
||||||
myFixture.configureByCodeFragment(testPath)
|
myFixture.configureByCodeFragment(testPath(testPath))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doTest(testPath: String) {
|
override fun doTest(testPath: String) {
|
||||||
|
|||||||
-154
@@ -1,154 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.debugger.evaluate
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.completion.CompletionType
|
|
||||||
import com.intellij.codeInspection.InspectionProfileEntry
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.openapi.util.text.StringUtil
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
|
||||||
import org.jetbrains.kotlin.checkers.AbstractPsiCheckerTest
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference
|
|
||||||
import org.jetbrains.kotlin.idea.completion.test.AbstractJvmBasicCompletionTest
|
|
||||||
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
|
|
||||||
import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractCompletionHandlerTest
|
|
||||||
import org.jetbrains.kotlin.idea.debugger.getContextElement
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.util.ImportInsertHelper
|
|
||||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
|
||||||
import org.jetbrains.kotlin.name.FqName
|
|
||||||
import org.jetbrains.kotlin.psi.*
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import java.io.File
|
|
||||||
import kotlin.test.assertNull
|
|
||||||
import kotlin.test.assertTrue
|
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentHighlightingTest : AbstractPsiCheckerTest() {
|
|
||||||
override fun doTest(filePath: String) {
|
|
||||||
myFixture.configureByCodeFragment(testDataFile())
|
|
||||||
checkHighlighting(filePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun doTestWithImport(filePath: String) {
|
|
||||||
myFixture.configureByCodeFragment(testDataFile())
|
|
||||||
|
|
||||||
project.executeWriteCommand("Imports insertion") {
|
|
||||||
val fileText = FileUtil.loadFile(File(filePath), true)
|
|
||||||
val file = myFixture.file as KtFile
|
|
||||||
InTextDirectivesUtils.findListWithPrefixes(fileText, "// IMPORT: ").forEach {
|
|
||||||
val descriptor = file.resolveImportReference(FqName(it)).singleOrNull()
|
|
||||||
?: error("Could not resolve descriptor to import: $it")
|
|
||||||
ImportInsertHelper.getInstance(project).importDescriptor(file, descriptor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkHighlighting(filePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkHighlighting(filePath: String) {
|
|
||||||
val inspectionName = InTextDirectivesUtils.findStringWithPrefixes(File(filePath).readText(), "// INSPECTION_CLASS: ")
|
|
||||||
if (inspectionName != null) {
|
|
||||||
val inspection = Class.forName(inspectionName).newInstance() as InspectionProfileEntry
|
|
||||||
myFixture.enableInspections(inspection)
|
|
||||||
try {
|
|
||||||
myFixture.checkHighlighting(true, false, false)
|
|
||||||
} finally {
|
|
||||||
myFixture.disableInspections(inspection)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
myFixture.checkHighlighting(true, false, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentCompletionTest : AbstractJvmBasicCompletionTest() {
|
|
||||||
override fun setUpFixture(testPath: String) {
|
|
||||||
myFixture.configureByCodeFragment(testDataFile())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentCompletionHandlerTest : AbstractCompletionHandlerTest(CompletionType.BASIC) {
|
|
||||||
override fun setUpFixture(testPath: String) {
|
|
||||||
myFixture.configureByCodeFragment(testDataFile())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doTest(testPath: String) {
|
|
||||||
super.doTest(testPath)
|
|
||||||
|
|
||||||
val fragment = myFixture.file as KtCodeFragment
|
|
||||||
fragment.checkImports(testPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentAutoImportTest : AbstractPsiCheckerTest() {
|
|
||||||
override fun doTest(filePath: String) {
|
|
||||||
myFixture.configureByCodeFragment(testDataFile())
|
|
||||||
myFixture.doHighlighting()
|
|
||||||
|
|
||||||
val importFix = myFixture.availableIntentions.singleOrNull { it.familyName == "Import" }
|
|
||||||
?: error("No import fix available")
|
|
||||||
importFix.invoke(project, editor, file)
|
|
||||||
|
|
||||||
myFixture.checkResultByFile(filePath + ".after")
|
|
||||||
|
|
||||||
val fragment = myFixture.file as KtCodeFragment
|
|
||||||
fragment.checkImports(testDataPath + File.separator + filePath)
|
|
||||||
|
|
||||||
val fixAfter = myFixture.availableIntentions.firstOrNull { it.familyName == "Import" }
|
|
||||||
assertNull(fixAfter, "No import fix should be available after")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
override fun getTestDataPath() = KotlinTestUtils.getHomeDirectory()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun KtCodeFragment.checkImports(testPath: String) {
|
|
||||||
val importList = importsAsImportList()
|
|
||||||
val importsText = StringUtil.convertLineSeparators(importList?.text ?: "")
|
|
||||||
val fragmentAfterFile = File(testPath + ".after.imports")
|
|
||||||
|
|
||||||
if (fragmentAfterFile.exists()) {
|
|
||||||
KotlinTestUtils.assertEqualsToFile(fragmentAfterFile, importsText)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
assertTrue(importsText.isEmpty(), "Unexpected imports found: $importsText" )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun JavaCodeInsightTestFixture.configureByCodeFragment(testDataFile: File) {
|
|
||||||
configureByFile(testDataFile.name)
|
|
||||||
|
|
||||||
val elementAt = file?.findElementAt(caretOffset)
|
|
||||||
val file = createCodeFragment(testDataFile.path, elementAt!!)
|
|
||||||
|
|
||||||
val typeStr = InTextDirectivesUtils.findStringWithPrefixes(getFile().text, "// ${ExpectedCompletionUtils.RUNTIME_TYPE} ")
|
|
||||||
if (typeStr != null) {
|
|
||||||
file.putCopyableUserData(KtCodeFragment.RUNTIME_TYPE_EVALUATOR, {
|
|
||||||
val codeFragment = KtPsiFactory(project).createBlockCodeFragment("val xxx: $typeStr", PsiTreeUtil.getParentOfType(elementAt, KtElement::class.java))
|
|
||||||
val context = codeFragment.analyzeWithContent()
|
|
||||||
val typeReference: KtTypeReference = PsiTreeUtil.getChildOfType(codeFragment.getContentElement().firstChild, KtTypeReference::class.java)!!
|
|
||||||
context[BindingContext.TYPE, typeReference]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
configureFromExistingVirtualFile(file.virtualFile!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createCodeFragment(filePath: String, contextElement: PsiElement): KtCodeFragment {
|
|
||||||
val fileForFragment = File(filePath + ".fragment")
|
|
||||||
val codeFragmentText = FileUtil.loadFile(fileForFragment, true).trim()
|
|
||||||
val psiFactory = KtPsiFactory(contextElement.project)
|
|
||||||
if (fileForFragment.readLines().size == 1) {
|
|
||||||
return psiFactory.createExpressionCodeFragment(codeFragmentText, getContextElement(contextElement))
|
|
||||||
}
|
|
||||||
return psiFactory.createBlockCodeFragment(codeFragmentText, getContextElement(contextElement))
|
|
||||||
}
|
|
||||||
-49
@@ -1,49 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.debugger.evaluate
|
|
||||||
|
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.debugger.KotlinEditorTextProvider
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.junit.Assert
|
|
||||||
|
|
||||||
abstract class AbstractSelectExpressionForDebuggerTest : LightCodeInsightFixtureTestCase() {
|
|
||||||
|
|
||||||
override fun setUp() {
|
|
||||||
super.setUp()
|
|
||||||
invalidateLibraryCache(project)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun doTest(path: String) {
|
|
||||||
doTest(path, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun doTestWoMethodCalls(path: String) {
|
|
||||||
doTest(path, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun doTest(path: String, allowMethodCalls: Boolean) {
|
|
||||||
myFixture.configureByFile(path.substringAfterLast('/'))
|
|
||||||
|
|
||||||
val elementAt = myFixture.file?.findElementAt(myFixture.caretOffset)!!
|
|
||||||
val selectedExpression = KotlinEditorTextProvider.findExpressionInner(elementAt, allowMethodCalls)
|
|
||||||
|
|
||||||
val expected = InTextDirectivesUtils.findStringWithPrefixes(myFixture.file?.text!!, "// EXPECTED: ")
|
|
||||||
val actualResult = if (selectedExpression != null)
|
|
||||||
KotlinEditorTextProvider.getElementInfo(selectedExpression) { it.text }
|
|
||||||
else
|
|
||||||
"null"
|
|
||||||
|
|
||||||
Assert.assertEquals("Another expression should be selected", expected, actualResult)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinLightProjectDescriptor.INSTANCE
|
|
||||||
|
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/debugger/selectExpression"
|
|
||||||
}
|
|
||||||
@@ -36,7 +36,7 @@ internal fun KtCodeFragment.checkImports(testPath: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun JavaCodeInsightTestFixture.configureByCodeFragment(filePath: String) {
|
internal fun JavaCodeInsightTestFixture.configureByCodeFragment(filePath: String) {
|
||||||
configureByFile(filePath)
|
configureByFile(File(filePath).name)
|
||||||
|
|
||||||
val elementAt = file?.findElementAt(caretOffset)
|
val elementAt = file?.findElementAt(caretOffset)
|
||||||
val file = createCodeFragment(filePath, elementAt!!)
|
val file = createCodeFragment(filePath, elementAt!!)
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ class BuiltInDecompilerForWrongAbiVersionTest : AbstractBuiltInDecompilerTest()
|
|||||||
override fun getTestDataPath() = PluginTestCaseBase.TEST_DATA_DIR + "/decompiler/builtins/"
|
override fun getTestDataPath() = PluginTestCaseBase.TEST_DATA_DIR + "/decompiler/builtins/"
|
||||||
|
|
||||||
override fun configureAndBuildFileStub(packageFqName: String): PsiFileStub<*> {
|
override fun configureAndBuildFileStub(packageFqName: String): PsiFileStub<*> {
|
||||||
myFixture.configureByFile(testDataPath + BuiltInSerializerProtocol.getBuiltInsFilePath(FqName(packageFqName)))
|
myFixture.configureByFile(BuiltInSerializerProtocol.getBuiltInsFilePath(FqName(packageFqName)))
|
||||||
return KotlinBuiltInDecompiler().stubBuilder.buildFileStub(FileContentImpl.createByFile(myFixture.file.virtualFile))!!
|
return KotlinBuiltInDecompiler().stubBuilder.buildFileStub(FileContentImpl.createByFile(myFixture.file.virtualFile))!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.util.io.FileUtil
|
|||||||
import com.intellij.openapi.vfs.VfsUtilCore
|
import com.intellij.openapi.vfs.VfsUtilCore
|
||||||
import com.intellij.psi.codeStyle.JavaCodeStyleSettings
|
import com.intellij.psi.codeStyle.JavaCodeStyleSettings
|
||||||
import com.intellij.testFramework.LightPlatformTestCase
|
import com.intellij.testFramework.LightPlatformTestCase
|
||||||
|
import com.intellij.testFramework.TestDataPath
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||||
@@ -19,6 +20,8 @@ import java.io.File
|
|||||||
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
|
||||||
class ExternalAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
|
class ExternalAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
|
|
||||||
|
override fun getTestDataPath() = KotlinTestUtils.getHomeDirectory()
|
||||||
|
|
||||||
fun testNotNullMethod() {
|
fun testNotNullMethod() {
|
||||||
KotlinTestUtils.runTest(::doTest, TargetBackend.ANY, "idea/testData/externalAnnotations/notNullMethod.kt")
|
KotlinTestUtils.runTest(::doTest, TargetBackend.ANY, "idea/testData/externalAnnotations/notNullMethod.kt")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,20 +8,20 @@ package org.jetbrains.kotlin.idea.highlighter
|
|||||||
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl
|
import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl
|
||||||
import com.intellij.lang.annotation.AnnotationSession
|
import com.intellij.lang.annotation.AnnotationSession
|
||||||
import com.intellij.psi.PsiComment
|
import com.intellij.psi.PsiComment
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithAllCompilerChecks
|
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithAllCompilerChecks
|
||||||
import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension
|
import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension
|
||||||
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.psi.KtTreeVisitor
|
import org.jetbrains.kotlin.psi.KtTreeVisitor
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
|
|
||||||
abstract class AbstractDslHighlighterTest : LightCodeInsightFixtureTestCase() {
|
abstract class AbstractDslHighlighterTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
protected fun doTest(filePath: String) {
|
protected fun doTest(unused: String) {
|
||||||
val psiFile = myFixture.configureByFile(filePath) as KtFile
|
val psiFile = myFixture.configureByFile(fileName()) as KtFile
|
||||||
val extension = DslHighlighterExtension()
|
val extension = DslHighlighterExtension()
|
||||||
val bindingContext = psiFile.analyzeWithAllCompilerChecks().bindingContext
|
val bindingContext = psiFile.analyzeWithAllCompilerChecks().bindingContext
|
||||||
|
|
||||||
@@ -64,5 +64,4 @@ abstract class AbstractDslHighlighterTest : LightCodeInsightFixtureTestCase() {
|
|||||||
psiFile.accept(visitor)
|
psiFile.accept(visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTestDataPath() = ""
|
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,8 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest
|
|||||||
const val CARET_TAG = "~"
|
const val CARET_TAG = "~"
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun doTest(filePath: String) {
|
protected fun doTest(unused: String) {
|
||||||
myFixture.configureByFile(filePath)
|
myFixture.configureByFile(fileName())
|
||||||
val document = myFixture.editor.document
|
val document = myFixture.editor.document
|
||||||
val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file)
|
val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file)
|
||||||
data.init()
|
data.init()
|
||||||
@@ -65,5 +65,4 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinLightProjectDescriptor.INSTANCE
|
||||||
override fun getTestDataPath() = ""
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -20,12 +20,12 @@ import java.io.File
|
|||||||
abstract class AbstractConcatenatedStringGeneratorTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractConcatenatedStringGeneratorTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(path: String) {
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByFile(fileName())
|
||||||
val expression = myFixture.file.collectDescendantsOfType<KtBinaryExpression>().lastOrNull()
|
val expression = myFixture.file.collectDescendantsOfType<KtBinaryExpression>().lastOrNull()
|
||||||
TestCase.assertNotNull("No binary expression found: $path", expression)
|
TestCase.assertNotNull("No binary expression found: $path", expression)
|
||||||
|
|
||||||
val generatedString = ConcatenatedStringGenerator().create(expression!!)
|
val generatedString = ConcatenatedStringGenerator().create(expression!!)
|
||||||
|
|
||||||
KotlinTestUtils.assertEqualsToFile(File("$path.result"), generatedString)
|
KotlinTestUtils.assertEqualsToFile(File("${testPath()}.result"), generatedString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ import static org.jetbrains.kotlin.idea.navigation.GotoCheck.checkGotoDirectives
|
|||||||
|
|
||||||
public abstract class AbstractKotlinGotoTest extends KotlinLightCodeInsightFixtureTestCase {
|
public abstract class AbstractKotlinGotoTest extends KotlinLightCodeInsightFixtureTestCase {
|
||||||
protected void doSymbolTest(String path) {
|
protected void doSymbolTest(String path) {
|
||||||
myFixture.configureByFile(path);
|
myFixture.configureByFile(fileName());
|
||||||
checkGotoDirectives(new GotoSymbolModel2(getProject()), myFixture.getEditor());
|
checkGotoDirectives(new GotoSymbolModel2(getProject()), myFixture.getEditor());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doClassTest(String path) {
|
protected void doClassTest(String path) {
|
||||||
myFixture.configureByFile(path);
|
myFixture.configureByFile(fileName());
|
||||||
checkGotoDirectives(new GotoClassModel2(getProject()), myFixture.getEditor());
|
checkGotoDirectives(new GotoClassModel2(getProject()), myFixture.getEditor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,52 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.navigation;
|
|
||||||
|
|
||||||
import com.intellij.ide.util.gotoByName.GotoClassModel2;
|
|
||||||
import com.intellij.ide.util.gotoByName.GotoSymbolModel2;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.idea.navigation.GotoCheck.checkGotoDirectives;
|
|
||||||
|
|
||||||
public abstract class AbstractKotlinGotoTest extends KotlinLightCodeInsightFixtureTestCase {
|
|
||||||
protected void doSymbolTest(String path) {
|
|
||||||
myFixture.configureByFile(fileName());
|
|
||||||
checkGotoDirectives(new GotoSymbolModel2(getProject()), myFixture.getEditor());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doClassTest(String path) {
|
|
||||||
myFixture.configureByFile(fileName());
|
|
||||||
checkGotoDirectives(new GotoClassModel2(getProject()), myFixture.getEditor());
|
|
||||||
}
|
|
||||||
|
|
||||||
private String dirPath = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setUp() {
|
|
||||||
dirPath = KotlinTestUtils.getTestsRoot(getClass());
|
|
||||||
super.setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown() {
|
|
||||||
super.tearDown();
|
|
||||||
dirPath = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected String getTestDataPath() {
|
|
||||||
return dirPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected String fileName() {
|
|
||||||
return getTestName(true) + ".kt";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -27,7 +27,7 @@ abstract class AbstractNameSuggestionProviderTest : KotlinLightCodeInsightFixtur
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(path: String) {
|
||||||
val file = myFixture.configureByFile(path)
|
val file = myFixture.configureByFile(fileName())
|
||||||
val targetElement = TargetElementUtil.findTargetElement(
|
val targetElement = TargetElementUtil.findTargetElement(
|
||||||
myFixture.editor,
|
myFixture.editor,
|
||||||
TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
||||||
|
|||||||
-41
@@ -1,41 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.refactoring
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.TargetElementUtil
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.refactoring.rename.NameSuggestionProvider
|
|
||||||
import com.intellij.refactoring.rename.PreferrableNameSuggestionProvider
|
|
||||||
import junit.framework.TestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
|
|
||||||
abstract class AbstractNameSuggestionProviderTest : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
private fun getSuggestNames(element: PsiElement): List<String> {
|
|
||||||
val names = HashSet<String>()
|
|
||||||
for (provider in NameSuggestionProvider.EP_NAME.extensions) {
|
|
||||||
val info = provider.getSuggestedNames(element, null, names)
|
|
||||||
if (info != null) {
|
|
||||||
if (provider is PreferrableNameSuggestionProvider && !provider.shouldCheckOthers()) break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return names.sorted()
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
|
||||||
val file = myFixture.configureByFile(fileName())
|
|
||||||
val targetElement = TargetElementUtil.findTargetElement(
|
|
||||||
myFixture.editor,
|
|
||||||
TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
|
||||||
)!!
|
|
||||||
val expectedNames = InTextDirectivesUtils.findListWithPrefixes(file.text, "// SUGGESTED_NAMES: ")
|
|
||||||
val actualNames = getSuggestNames(targetElement)
|
|
||||||
TestCase.assertEquals(expectedNames, actualNames)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = ProjectDescriptorWithStdlibSources.INSTANCE
|
|
||||||
}
|
|
||||||
@@ -29,17 +29,17 @@ abstract class AbstractInlineTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
val fixture: JavaCodeInsightTestFixture
|
val fixture: JavaCodeInsightTestFixture
|
||||||
get() = myFixture
|
get() = myFixture
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
protected fun doTest(unused: String) {
|
||||||
val mainFile = File(path)
|
val mainFile = testDataFile()
|
||||||
val afterFile = File(path + ".after")
|
val afterFile = File(testDataPath, "${fileName()}.after")
|
||||||
|
|
||||||
val mainFileName = mainFile.name
|
val mainFileName = mainFile.name
|
||||||
val mainFileBaseName = FileUtil.getNameWithoutExtension(mainFileName)
|
val mainFileBaseName = FileUtil.getNameWithoutExtension(mainFileName)
|
||||||
val extraFiles = mainFile.parentFile.listFiles { _, name ->
|
val extraFiles = mainFile.parentFile.listFiles { _, name ->
|
||||||
name != mainFileName && name.startsWith("$mainFileBaseName.") && (name.endsWith(".kt") || name.endsWith(".java"))
|
name != mainFileName && name.startsWith("$mainFileBaseName.") && (name.endsWith(".kt") || name.endsWith(".java"))
|
||||||
}
|
}
|
||||||
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(path.replace(mainFileName, it.name)) }
|
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(it.name) }
|
||||||
val file = myFixture.configureByFile(path)
|
val file = myFixture.configureByFile(fileName())
|
||||||
|
|
||||||
val configured = configureCompilerOptions(file.text, project, module)
|
val configured = configureCompilerOptions(file.text, project, module)
|
||||||
|
|
||||||
|
|||||||
@@ -1,84 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.refactoring.inline
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.TargetElementUtil
|
|
||||||
import com.intellij.codeInsight.TargetElementUtil.ELEMENT_NAME_ACCEPTED
|
|
||||||
import com.intellij.codeInsight.TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED
|
|
||||||
import com.intellij.lang.refactoring.InlineActionHandler
|
|
||||||
import com.intellij.openapi.extensions.Extensions
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.refactoring.BaseRefactoringProcessor
|
|
||||||
import com.intellij.refactoring.util.CommonRefactoringUtil
|
|
||||||
import com.intellij.testFramework.UsefulTestCase
|
|
||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
|
||||||
import junit.framework.TestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
|
|
||||||
import org.jetbrains.kotlin.idea.test.rollbackCompilerOptions
|
|
||||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractInlineTest : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
val fixture: JavaCodeInsightTestFixture
|
|
||||||
get() = myFixture
|
|
||||||
|
|
||||||
protected fun doTest(path: String) {
|
|
||||||
val mainFile = File(path)
|
|
||||||
val afterFile = File(path + ".after")
|
|
||||||
|
|
||||||
val mainFileName = mainFile.name
|
|
||||||
val mainFileBaseName = FileUtil.getNameWithoutExtension(mainFileName)
|
|
||||||
val extraFiles = mainFile.parentFile.listFiles { _, name ->
|
|
||||||
name != mainFileName && name.startsWith("$mainFileBaseName.") && (name.endsWith(".kt") || name.endsWith(".java"))
|
|
||||||
}
|
|
||||||
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(path.replace(mainFileName, it.name)) }
|
|
||||||
val file = myFixture.configureByFile(fileName())
|
|
||||||
|
|
||||||
val configured = configureCompilerOptions(file.text, project, module)
|
|
||||||
|
|
||||||
try {
|
|
||||||
val afterFileExists = afterFile.exists()
|
|
||||||
|
|
||||||
val targetElement = TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED)!!
|
|
||||||
val handler = Extensions.getExtensions(InlineActionHandler.EP_NAME).firstOrNull { it.canInlineElement(targetElement) }
|
|
||||||
val expectedErrors = InTextDirectivesUtils.findLinesWithPrefixesRemoved(myFixture.file.text, "// ERROR: ")
|
|
||||||
if (handler != null) {
|
|
||||||
try {
|
|
||||||
runWriteAction { handler.inlineElement(myFixture.project, myFixture.editor, targetElement) }
|
|
||||||
|
|
||||||
UsefulTestCase.assertEmpty(expectedErrors)
|
|
||||||
KotlinTestUtils.assertEqualsToFile(afterFile, file.text)
|
|
||||||
for ((extraPsiFile, extraFile) in extraFilesToPsi) {
|
|
||||||
KotlinTestUtils.assertEqualsToFile(File("${extraFile.path}.after"), extraPsiFile.text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e: CommonRefactoringUtil.RefactoringErrorHintException) {
|
|
||||||
TestCase.assertFalse("Refactoring not available: ${e.message}", afterFileExists)
|
|
||||||
TestCase.assertEquals("Expected errors", 1, expectedErrors.size)
|
|
||||||
TestCase.assertEquals("Error message", expectedErrors[0].replace("\\n", "\n"), e.message)
|
|
||||||
}
|
|
||||||
catch (e: BaseRefactoringProcessor.ConflictsInTestsException) {
|
|
||||||
TestCase.assertFalse("Conflicts: ${e.message}", afterFileExists)
|
|
||||||
TestCase.assertEquals("Expected errors", 1, expectedErrors.size)
|
|
||||||
TestCase.assertEquals("Error message", expectedErrors[0].replace("\\n", "\n"), e.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TestCase.assertFalse("No refactoring handler available", afterFileExists)
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (configured) {
|
|
||||||
rollbackCompilerOptions(project, module)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.resolve
|
package org.jetbrains.kotlin.idea.resolve
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||||
import org.jetbrains.kotlin.idea.decompiler.classFile.KtClsFile
|
import org.jetbrains.kotlin.idea.decompiler.classFile.KtClsFile
|
||||||
@@ -12,21 +13,23 @@ import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|||||||
import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
private val FILE_WITH_KOTLIN_CODE = PluginTestCaseBase.TEST_DATA_DIR + "/resolve/referenceInJava/dependency/dependencies.kt"
|
private val FILE_WITH_KOTLIN_CODE = PluginTestCaseBase.TEST_DATA_DIR + "/resolve/referenceInJava/dependency/dependencies.kt"
|
||||||
|
|
||||||
abstract class AbstractReferenceResolveInJavaTest : AbstractReferenceResolveTest() {
|
abstract class AbstractReferenceResolveInJavaTest : AbstractReferenceResolveTest() {
|
||||||
override fun doTest(path: String) {
|
override fun doTest(path: String) {
|
||||||
assert(path.endsWith(".java")) { path }
|
val fileName = fileName()
|
||||||
myFixture.configureByFile(FILE_WITH_KOTLIN_CODE)
|
assert(fileName.endsWith(".java")) { fileName }
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByText("dependencies.kt", FileUtil.loadFile(File(FILE_WITH_KOTLIN_CODE), true))
|
||||||
|
myFixture.configureByFile(fileName)
|
||||||
performChecks()
|
performChecks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AbstractReferenceToCompiledKotlinResolveInJavaTest : AbstractReferenceResolveTest() {
|
abstract class AbstractReferenceToCompiledKotlinResolveInJavaTest : AbstractReferenceResolveTest() {
|
||||||
override fun doTest(path: String) {
|
override fun doTest(path: String) {
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByFile(fileName())
|
||||||
performChecks()
|
performChecks()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +40,13 @@ abstract class AbstractReferenceToCompiledKotlinResolveInJavaTest : AbstractRefe
|
|||||||
|
|
||||||
override fun checkResolvedTo(element: PsiElement) {
|
override fun checkResolvedTo(element: PsiElement) {
|
||||||
val navigationElement = element.navigationElement
|
val navigationElement = element.navigationElement
|
||||||
Assert.assertFalse("Reference should not navigate to a light element\nWas: ${navigationElement::class.java.simpleName}", navigationElement is KtLightElement<*, *>)
|
Assert.assertFalse(
|
||||||
Assert.assertTrue("Reference should navigate to a kotlin declaration\nWas: ${navigationElement::class.java.simpleName}", navigationElement is KtDeclaration || navigationElement is KtClsFile)
|
"Reference should not navigate to a light element\nWas: ${navigationElement::class.java.simpleName}",
|
||||||
|
navigationElement is KtLightElement<*, *>
|
||||||
|
)
|
||||||
|
Assert.assertTrue(
|
||||||
|
"Reference should navigate to a kotlin declaration\nWas: ${navigationElement::class.java.simpleName}",
|
||||||
|
navigationElement is KtDeclaration || navigationElement is KtClsFile
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-12
@@ -8,40 +8,36 @@ package org.jetbrains.kotlin.idea.resolve
|
|||||||
import junit.framework.AssertionFailedError
|
import junit.framework.AssertionFailedError
|
||||||
import org.jetbrains.kotlin.idea.navigation.NavigationTestUtils
|
import org.jetbrains.kotlin.idea.navigation.NavigationTestUtils
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractReferenceResolveInLibrarySourcesTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractReferenceResolveInLibrarySourcesTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
companion object {
|
companion object {
|
||||||
private val REF_CARET_MARKER = "<ref-caret>"
|
private val REF_CARET_MARKER = "<ref-caret>"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doTest(path: String) {
|
fun doTest(unused: String) {
|
||||||
val fixture = myFixture!!
|
val fixture = myFixture!!
|
||||||
|
|
||||||
fixture.configureByFile(path)
|
fixture.configureByFile(fileName())
|
||||||
|
|
||||||
val expectedResolveData = AbstractReferenceResolveTest.readResolveData(fixture.file!!.text, 0)
|
val expectedResolveData = AbstractReferenceResolveTest.readResolveData(fixture.file!!.text, 0)
|
||||||
|
|
||||||
val gotoData = NavigationTestUtils.invokeGotoImplementations(fixture.editor, fixture.file)!!
|
val gotoData = NavigationTestUtils.invokeGotoImplementations(fixture.editor, fixture.file)!!
|
||||||
Assert.assertEquals("Single target expected for origianl file", 1, gotoData.targets.size)
|
Assert.assertEquals("Single target expected for original file", 1, gotoData.targets.size)
|
||||||
|
|
||||||
val testedPsiElement = gotoData.targets[0].navigationElement
|
val testedPsiElement = gotoData.targets[0].navigationElement
|
||||||
val testedElementFile = testedPsiElement.containingFile!!
|
val testedElementFile = testedPsiElement.containingFile!!
|
||||||
|
|
||||||
val lineContext = InTextDirectivesUtils.findStringWithPrefixes(fixture.file!!.text, "CONTEXT:")
|
val lineContext = InTextDirectivesUtils.findStringWithPrefixes(fixture.file!!.text, "CONTEXT:")
|
||||||
if (lineContext == null) {
|
?: throw AssertionFailedError("'CONTEXT: ' directive is expected to set up position in library file: ${testedElementFile.name}")
|
||||||
throw AssertionFailedError("'CONTEXT: ' directive is expected to set up position in library file: ${testedElementFile.name}")
|
|
||||||
}
|
|
||||||
|
|
||||||
val inContextOffset = lineContext.indexOf(REF_CARET_MARKER)
|
val inContextOffset = lineContext.indexOf(REF_CARET_MARKER)
|
||||||
if (inContextOffset == -1) throw IllegalStateException("No '$REF_CARET_MARKER' marker found in 'CONTEXT: $lineContext'")
|
check(inContextOffset != -1) { "No '$REF_CARET_MARKER' marker found in 'CONTEXT: $lineContext'" }
|
||||||
|
|
||||||
val contextStr = lineContext.replace(REF_CARET_MARKER, "")
|
val contextStr = lineContext.replace(REF_CARET_MARKER, "")
|
||||||
val offsetInFile = testedElementFile.text!!.indexOf(contextStr)
|
val offsetInFile = testedElementFile.text!!.indexOf(contextStr)
|
||||||
if (offsetInFile == -1) throw IllegalStateException("Context '$contextStr' wasn't found in file ${testedElementFile.name}")
|
check(offsetInFile != -1) { "Context '$contextStr' wasn't found in file ${testedElementFile.name}" }
|
||||||
|
|
||||||
val offset = offsetInFile + inContextOffset
|
val offset = offsetInFile + inContextOffset
|
||||||
|
|
||||||
@@ -50,6 +46,4 @@ abstract class AbstractReferenceResolveInLibrarySourcesTest : KotlinLightCodeIns
|
|||||||
AbstractReferenceResolveTest.checkReferenceResolve(expectedResolveData, offset, reference)
|
AbstractReferenceResolveTest.checkReferenceResolve(expectedResolveData, offset, reference)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTestDataPath() : String = File(PluginTestCaseBase.getTestDataPathBase(), "/resolve/referenceInLib").path + File.separator
|
|
||||||
override fun fileName(): String = getTestName(true) + ".kt"
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -11,8 +11,9 @@ public abstract class AbstractReferenceToJavaWithWrongFileStructureTest extends
|
|||||||
@Override
|
@Override
|
||||||
protected void doTest(@NotNull String path) {
|
protected void doTest(@NotNull String path) {
|
||||||
//this line intentionally creates wrong file structure for java file
|
//this line intentionally creates wrong file structure for java file
|
||||||
myFixture.configureByFile(path.replace(".kt", ".java"));
|
String fileName = fileName();
|
||||||
myFixture.configureByFile(path);
|
myFixture.configureByFile(fileName.replace(".kt", ".java"));
|
||||||
|
myFixture.configureByFile(fileName);
|
||||||
performChecks();
|
performChecks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,16 +22,17 @@ import java.io.File
|
|||||||
|
|
||||||
abstract class AbstractResolveByStubTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractResolveByStubTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
protected fun doTest(testFileName: String) {
|
protected fun doTest(testFileName: String) {
|
||||||
if (InTextDirectivesUtils.isDirectiveDefined(File(testFileName).readText(), "NO_CHECK_SOURCE_VS_BINARY")) {
|
if (InTextDirectivesUtils.isDirectiveDefined(testDataFile().readText(), "NO_CHECK_SOURCE_VS_BINARY")) {
|
||||||
// If NO_CHECK_SOURCE_VS_BINARY is enabled, source vs binary descriptors differ, which means that we should not run this test:
|
// If NO_CHECK_SOURCE_VS_BINARY is enabled, source vs binary descriptors differ, which means that we should not run this test:
|
||||||
// it would compare descriptors resolved from sources (by stubs) with .txt, which describes binary descriptors
|
// it would compare descriptors resolved from sources (by stubs) with .txt, which describes binary descriptors
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
myFixture.configureByFile(testFileName)
|
val fileName = fileName()
|
||||||
|
myFixture.configureByFile(fileName)
|
||||||
val shouldFail = getTestName(false) == "ClassWithConstVal"
|
val shouldFail = getTestName(false) == "ClassWithConstVal"
|
||||||
AstAccessControl.testWithControlledAccessToAst(shouldFail, project, testRootDisposable) {
|
AstAccessControl.testWithControlledAccessToAst(shouldFail, project, testRootDisposable) {
|
||||||
performTest(testFileName)
|
performTest(testPath())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.stubs
|
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.AstAccessControl
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.PossiblyExternalAnnotationDescriptor
|
|
||||||
import org.jetbrains.kotlin.name.FqName
|
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.jetbrains.kotlin.test.util.DescriptorValidator.ValidationVisitor.errorTypesForbidden
|
|
||||||
import org.jetbrains.kotlin.test.util.RecursiveDescriptorComparator
|
|
||||||
import org.junit.Assert
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractResolveByStubTest : KotlinLightCodeInsightFixtureTestCase() {
|
|
||||||
protected fun doTest(testFileName: String) {
|
|
||||||
if (InTextDirectivesUtils.isDirectiveDefined(File(testFileName).readText(), "NO_CHECK_SOURCE_VS_BINARY")) {
|
|
||||||
// If NO_CHECK_SOURCE_VS_BINARY is enabled, source vs binary descriptors differ, which means that we should not run this test:
|
|
||||||
// it would compare descriptors resolved from sources (by stubs) with .txt, which describes binary descriptors
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
myFixture.configureByFile(fileName())
|
|
||||||
val shouldFail = getTestName(false) == "ClassWithConstVal"
|
|
||||||
AstAccessControl.testWithControlledAccessToAst(shouldFail, project, testRootDisposable) {
|
|
||||||
performTest(testFileName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
|
|
||||||
private fun performTest(path: String) {
|
|
||||||
val file = file as KtFile
|
|
||||||
val module = file.findModuleDescriptor()
|
|
||||||
val packageViewDescriptor = module.getPackage(FqName("test"))
|
|
||||||
Assert.assertFalse(packageViewDescriptor.isEmpty())
|
|
||||||
|
|
||||||
val fileToCompareTo = File(FileUtil.getNameWithoutExtension(path) + ".txt")
|
|
||||||
|
|
||||||
RecursiveDescriptorComparator.validateAndCompareDescriptorWithFile(
|
|
||||||
packageViewDescriptor,
|
|
||||||
RecursiveDescriptorComparator.DONT_INCLUDE_METHODS_OF_OBJECT
|
|
||||||
.filterRecursion(RecursiveDescriptorComparator.SKIP_BUILT_INS_PACKAGES)
|
|
||||||
.checkPrimaryConstructors(true)
|
|
||||||
.checkPropertyAccessors(true)
|
|
||||||
.withValidationStrategy(errorTypesForbidden())
|
|
||||||
.withRendererOptions { options ->
|
|
||||||
options.annotationFilter = { annotationDescriptor ->
|
|
||||||
annotationDescriptor !is PossiblyExternalAnnotationDescriptor || !annotationDescriptor.isIdeExternalAnnotation
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fileToCompareTo
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.stubs
|
|||||||
|
|
||||||
import com.intellij.psi.impl.DebugUtil
|
import com.intellij.psi.impl.DebugUtil
|
||||||
import com.intellij.psi.stubs.StubElement
|
import com.intellij.psi.stubs.StubElement
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.name.SpecialNames
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtFileStubBuilder
|
import org.jetbrains.kotlin.psi.stubs.elements.KtFileStubBuilder
|
||||||
@@ -16,13 +16,13 @@ import org.jetbrains.kotlin.test.KotlinTestUtils
|
|||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
abstract class AbstractStubBuilderTest : LightCodeInsightFixtureTestCase() {
|
abstract class AbstractStubBuilderTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
protected fun doTest(sourcePath: String) {
|
protected fun doTest(unused: String) {
|
||||||
val file = myFixture.configureByFile(sourcePath) as KtFile
|
val file = myFixture.configureByFile(fileName()) as KtFile
|
||||||
val jetStubBuilder = KtFileStubBuilder()
|
val ktStubBuilder = KtFileStubBuilder()
|
||||||
val lighterTree = jetStubBuilder.buildStubTree(file)
|
val lighterTree = ktStubBuilder.buildStubTree(file)
|
||||||
val stubTree = serializeStubToString(lighterTree)
|
val stubTree = serializeStubToString(lighterTree)
|
||||||
val expectedFile = sourcePath.replace(".kt", ".expected")
|
val expectedFile = testPath().replace(".kt", ".expected")
|
||||||
KotlinTestUtils.assertEqualsToFile(File(expectedFile), stubTree)
|
KotlinTestUtils.assertEqualsToFile(File(expectedFile), stubTree)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.test.KotlinTestUtils
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
abstract class AbstractPsiUnifierTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractPsiUnifierTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
fun doTest(filePath: String) {
|
fun doTest(unused: String) {
|
||||||
fun findPattern(file: KtFile): KtElement {
|
fun findPattern(file: KtFile): KtElement {
|
||||||
val selectionModel = myFixture.editor.selectionModel
|
val selectionModel = myFixture.editor.selectionModel
|
||||||
val start = selectionModel.selectionStart
|
val start = selectionModel.selectionStart
|
||||||
@@ -29,8 +29,7 @@ abstract class AbstractPsiUnifierTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
} as KtElement
|
} as KtElement
|
||||||
}
|
}
|
||||||
|
|
||||||
myFixture.configureByFile(filePath)
|
val file = myFixture.configureByFile(fileName()) as KtFile
|
||||||
val file = myFixture.file as KtFile
|
|
||||||
|
|
||||||
DirectiveBasedActionUtils.checkForUnexpectedErrors(file)
|
DirectiveBasedActionUtils.checkForUnexpectedErrors(file)
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ abstract class AbstractPsiUnifierTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
.match(file, KotlinPsiUnifier.DEFAULT)
|
.match(file, KotlinPsiUnifier.DEFAULT)
|
||||||
.map { it.range.getTextRange().substring(file.getText()!!) }
|
.map { it.range.getTextRange().substring(file.getText()!!) }
|
||||||
.joinToString("\n\n")
|
.joinToString("\n\n")
|
||||||
KotlinTestUtils.assertEqualsToFile(File("$filePath.match"), actualText)
|
KotlinTestUtils.assertEqualsToFile(File(testDataPath, "${fileName()}.match"), actualText)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor = getProjectDescriptorFromTestName()
|
override fun getProjectDescriptor(): LightProjectDescriptor = getProjectDescriptorFromTestName()
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.search;
|
package org.jetbrains.kotlin.search;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public abstract class AbstractInheritorsSearchTest extends AbstractSearcherTest {
|
public abstract class AbstractInheritorsSearchTest extends AbstractSearcherTest {
|
||||||
@@ -16,8 +14,4 @@ public abstract class AbstractInheritorsSearchTest extends AbstractSearcherTest
|
|||||||
checkClassWithDirectives(path);
|
checkClassWithDirectives(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getTestDataPath() {
|
|
||||||
return new File(PluginTestCaseBase.getTestDataPathBase(), "/search/inheritance").getPath() + File.separator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import com.intellij.psi.*;
|
|||||||
import com.intellij.psi.search.GlobalSearchScope;
|
import com.intellij.psi.search.GlobalSearchScope;
|
||||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||||
import com.intellij.testFramework.LightProjectDescriptor;
|
import com.intellij.testFramework.LightProjectDescriptor;
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
|
||||||
import com.intellij.util.Query;
|
import com.intellij.util.Query;
|
||||||
import kotlin.collections.CollectionsKt;
|
import kotlin.collections.CollectionsKt;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor;
|
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor;
|
||||||
import org.jetbrains.kotlin.idea.test.TestUtilsKt;
|
import org.jetbrains.kotlin.idea.test.TestUtilsKt;
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
@@ -24,9 +24,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class AbstractSearcherTest extends LightCodeInsightFixtureTestCase {
|
public abstract class AbstractSearcherTest extends KotlinLightCodeInsightFixtureTestCase {
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
TestUtilsKt.invalidateLibraryCache(getProject());
|
TestUtilsKt.invalidateLibraryCache(getProject());
|
||||||
}
|
}
|
||||||
@@ -75,14 +75,14 @@ public abstract class AbstractSearcherTest extends LightCodeInsightFixtureTestCa
|
|||||||
assertOrderedEquals(actualModified, expected);
|
assertOrderedEquals(actualModified, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkClassWithDirectives(@NotNull String path) throws IOException {
|
protected void checkClassWithDirectives(@NotNull String unused) throws IOException {
|
||||||
myFixture.configureByFile(path);
|
myFixture.configureByFile(fileName());
|
||||||
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(
|
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(
|
||||||
FileUtil.loadFile(new File(path), true), "// CLASS: ");
|
FileUtil.loadFile(testDataFile(), true), "// CLASS: ");
|
||||||
assertFalse("Specify CLASS directive in test file", directives.isEmpty());
|
assertFalse("Specify CLASS directive in test file", directives.isEmpty());
|
||||||
String superClassName = directives.get(0);
|
String superClassName = directives.get(0);
|
||||||
PsiClass psiClass = getPsiClass(superClassName);
|
PsiClass psiClass = getPsiClass(superClassName);
|
||||||
checkResult(path, ClassInheritorsSearch.search(psiClass, getProjectScope(), false));
|
checkResult(testPath(), ClassInheritorsSearch.search(psiClass, getProjectScope(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String stringRepresentation(Object member) {
|
private static String stringRepresentation(Object member) {
|
||||||
|
|||||||
@@ -18,19 +18,17 @@ import org.jetbrains.kotlin.idea.caches.lightClasses.IDELightClassConstructionCo
|
|||||||
import org.jetbrains.kotlin.idea.completion.test.withServiceRegistered
|
import org.jetbrains.kotlin.idea.completion.test.withServiceRegistered
|
||||||
import org.jetbrains.kotlin.idea.search.PsiBasedClassResolver
|
import org.jetbrains.kotlin.idea.search.PsiBasedClassResolver
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractAnnotatedMembersSearchTest : AbstractSearcherTest() {
|
abstract class AbstractAnnotatedMembersSearchTest : AbstractSearcherTest() {
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
override fun getProjectDescriptor(): LightProjectDescriptor {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doTest(path: String) {
|
fun doTest(unused: String) {
|
||||||
myFixture.configureByFile(path)
|
myFixture.configureByFile(fileName())
|
||||||
val fileText = FileUtil.loadFile(File(path), true)
|
val fileText = FileUtil.loadFile(testDataFile(), true)
|
||||||
val directives = InTextDirectivesUtils.findListWithPrefixes(fileText, "// ANNOTATION: ")
|
val directives = InTextDirectivesUtils.findListWithPrefixes(fileText, "// ANNOTATION: ")
|
||||||
|
|
||||||
TestCase.assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty())
|
TestCase.assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty())
|
||||||
@@ -42,7 +40,7 @@ abstract class AbstractAnnotatedMembersSearchTest : AbstractSearcherTest() {
|
|||||||
PsiBasedClassResolver.falseHits.set(0)
|
PsiBasedClassResolver.falseHits.set(0)
|
||||||
|
|
||||||
checkResult(
|
checkResult(
|
||||||
path,
|
testPath(),
|
||||||
AnnotatedElementsSearch.searchElements(
|
AnnotatedElementsSearch.searchElements(
|
||||||
psiClass,
|
psiClass,
|
||||||
projectScope,
|
projectScope,
|
||||||
@@ -62,9 +60,6 @@ abstract class AbstractAnnotatedMembersSearchTest : AbstractSearcherTest() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTestDataPath(): String {
|
|
||||||
return File(PluginTestCaseBase.getTestDataPathBase(), "/search/annotations").path + File.separator
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private object NoRealDelegatesComputed : StubComputationTracker {
|
private object NoRealDelegatesComputed : StubComputationTracker {
|
||||||
|
|||||||
@@ -12,20 +12,22 @@ import com.intellij.psi.search.searches.AnnotatedMembersSearch;
|
|||||||
import com.intellij.testFramework.LightProjectDescriptor;
|
import com.intellij.testFramework.LightProjectDescriptor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinJdkAndLibraryProjectDescriptor;
|
import org.jetbrains.kotlin.idea.test.KotlinJdkAndLibraryProjectDescriptor;
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner;
|
||||||
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@TestMetadata("idea/testData/search/junit/")
|
||||||
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
|
||||||
public class JUnitMembersSearcherTest extends AbstractSearcherTest {
|
public class JUnitMembersSearcherTest extends AbstractSearcherTest {
|
||||||
private static final LightProjectDescriptor junitProjectDescriptor =
|
private static final LightProjectDescriptor junitProjectDescriptor =
|
||||||
new KotlinJdkAndLibraryProjectDescriptor(new File(PathManager.getHomePath().replace(File.separatorChar, '/') + "/lib/junit-4.12.jar"));
|
new KotlinJdkAndLibraryProjectDescriptor(new File(PathManager.getHomePath().replace(File.separatorChar, '/') + "/lib/junit-4.12.jar"));
|
||||||
|
|
||||||
|
@TestMetadata("testJunit3.kt")
|
||||||
public void testJunit3() throws IOException {
|
public void testJunit3() throws IOException {
|
||||||
doJUnit3test();
|
doJUnit3test();
|
||||||
}
|
}
|
||||||
@@ -56,11 +58,6 @@ public class JUnitMembersSearcherTest extends AbstractSearcherTest {
|
|||||||
checkResult(getPathToFile(), AnnotatedMembersSearch.search(psiClass, getProjectScope()));
|
checkResult(getPathToFile(), AnnotatedMembersSearch.search(psiClass, getProjectScope()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getTestDataPath() {
|
|
||||||
return new File(PluginTestCaseBase.getTestDataPathBase(), "/search/junit").getPath() + File.separator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
protected LightProjectDescriptor getProjectDescriptor() {
|
protected LightProjectDescriptor getProjectDescriptor() {
|
||||||
|
|||||||
Reference in New Issue
Block a user