diff --git a/idea/idea-completion/testData/basic/multifile/ExtensionsForSmartCast/ExtensionsForSmartCast.kt b/idea/idea-completion/testData/basic/multifile/ExtensionsForSmartCast/ExtensionsForSmartCast.kt index 6eed5a2ba0d..d3847d3a088 100644 --- a/idea/idea-completion/testData/basic/multifile/ExtensionsForSmartCast/ExtensionsForSmartCast.kt +++ b/idea/idea-completion/testData/basic/multifile/ExtensionsForSmartCast/ExtensionsForSmartCast.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON val String.extensionProp1: Int get() = 1 val String.extensionProp2: Int get() = 1 diff --git a/idea/idea-completion/testData/basic/multifile/FileRefInStringLiteralNoPrefix/FileRefInStringLiteralNoPrefix.kt b/idea/idea-completion/testData/basic/multifile/FileRefInStringLiteralNoPrefix/FileRefInStringLiteralNoPrefix.kt index 5384956efdc..4221f011cb4 100644 --- a/idea/idea-completion/testData/basic/multifile/FileRefInStringLiteralNoPrefix/FileRefInStringLiteralNoPrefix.kt +++ b/idea/idea-completion/testData/basic/multifile/FileRefInStringLiteralNoPrefix/FileRefInStringLiteralNoPrefix.kt @@ -1,4 +1,3 @@ -// FIR_COMPARISON // NUMBER: 3 // EXIST: foo.txt // EXIST: bar.txt diff --git a/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt b/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt index 41ed500311a..5a434fb7f25 100644 --- a/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt +++ b/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON // this test tests correct substitution equality checking for generic functions import java.io.InputStreamReader diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt index 838305ed884..47709b2d1c5 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON package first class C { diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction/NotImportedExtensionFunction.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction/NotImportedExtensionFunction.kt index 9196f28dccb..6bf19fd09f3 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction/NotImportedExtensionFunction.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction/NotImportedExtensionFunction.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON package first fun firstFun() { diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelMultiFileJvmBasicCompletionTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelMultiFileJvmBasicCompletionTest.kt index 5597e90ae5f..79bd07ae89d 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelMultiFileJvmBasicCompletionTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/AbstractHighLevelMultiFileJvmBasicCompletionTest.kt @@ -6,26 +6,34 @@ package org.jetbrains.kotlin.idea.completion import com.intellij.codeInsight.completion.CompletionType -import org.jetbrains.kotlin.idea.completion.test.AbstractMultiFileJvmBasicCompletionTest -import org.jetbrains.kotlin.idea.completion.test.testCompletion +import com.intellij.testFramework.LightProjectDescriptor +import org.jetbrains.kotlin.idea.completion.test.KotlinFixtureCompletionBaseTestCase +import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.test.uitls.IgnoreTests -import java.nio.file.Path import java.nio.file.Paths +import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -abstract class AbstractHighLevelMultiFileJvmBasicCompletionTest : AbstractMultiFileJvmBasicCompletionTest() { - private val testDataFile: Path - get() = Paths.get(testDataPath, getTestName(false) + ".kt") +abstract class AbstractHighLevelMultiFileJvmBasicCompletionTest : KotlinFixtureCompletionBaseTestCase() { + override val captureExceptions: Boolean = false - override fun doTest(testPath: String) { - IgnoreTests.runTestIfEnabledByFileDirective(testDataFile, IgnoreTests.DIRECTIVES.FIR_COMPARISON) { - configureByFile(getTestName(false) + ".kt", "") - - testCompletion(file.text, JvmPlatforms.unspecifiedJvmPlatform, { completionType, invocationCount -> - setType(completionType) - complete(invocationCount) - myItems - }, CompletionType.BASIC, 0) + override fun executeTest(test: () -> Unit) { + IgnoreTests.runTestIfEnabledByFileDirective(testDataFile().toPath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON) { + test() } } + + override fun getTestDataPath(): String = Paths.get(super.getTestDataPath(), getTestName(false)).toString() + + override fun fileName(): String = getTestName(false) + ".kt" + + override fun setUpFixture(testPath: String) { + // We need to copy all files from the testDataPath (= "") to the tested project + myFixture.copyDirectoryToProject("", "") + super.setUpFixture(testPath) + } + + override fun defaultCompletionType(): CompletionType = CompletionType.BASIC + override fun getPlatform(): TargetPlatform = JvmPlatforms.unspecifiedJvmPlatform + override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE } \ No newline at end of file