diff --git a/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject-1.kt b/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject-1.kt index 1119b0cc187..75e3e6e9f52 100644 --- a/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON fun foo() { KtCla } diff --git a/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject.kt.after b/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject.kt.after index 6d7ef7edcad..bba8cb0b6e5 100644 --- a/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/ClassWithClassObject.kt.after @@ -1,5 +1,6 @@ import pack.KtClass +// FIR_COMPARISON fun foo() { KtClass } diff --git a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter-1.kt b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter-1.kt index 8decb697b9a..78a6ae3ccc3 100644 --- a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON fun foo() { val s = "fosomething" } \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter.kt.after b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter.kt.after index fdf63abc146..2106baa1ea9 100644 --- a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralEnter.kt.after @@ -1,3 +1,4 @@ +// FIR_COMPARISON fun foo() { val s = "foo.txtsomething" } \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab-1.kt b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab-1.kt index 8decb697b9a..78a6ae3ccc3 100644 --- a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON fun foo() { val s = "fosomething" } \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab.kt.after b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab.kt.after index 36b8d1dcc22..7bf160fd686 100644 --- a/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/FileRefInStringLiteralTab.kt.after @@ -1,3 +1,4 @@ +// FIR_COMPARISON fun foo() { val s = "foo.txt" } \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda-1.kt b/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda-1.kt index d6793e38555..8b87a9a5034 100644 --- a/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON object XXX { fun authorize(handler: String.() -> Unit) { } } diff --git a/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda.kt.after b/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda.kt.after index 084f27b1cf6..97af9145e45 100644 --- a/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/GlobalFunctionImportInLambda.kt.after @@ -1,5 +1,6 @@ import ppp.globalFun +// FIR_COMPARISON object XXX { fun authorize(handler: String.() -> Unit) { } } diff --git a/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject-1.kt b/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject-1.kt index 2fcd84a7022..9e3b2455486 100644 --- a/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON package some import test.SomeTestObject diff --git a/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject.kt.after b/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject.kt.after index 2fcd84a7022..9e3b2455486 100644 --- a/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/ImportAlreadyImportedObject.kt.after @@ -1,3 +1,4 @@ +// FIR_COMPARISON package some import test.SomeTestObject diff --git a/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport-1.kt b/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport-1.kt index 91b78bb9e45..ce3ca200bce 100644 --- a/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON package classimporttest fun test() { diff --git a/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport.kt.after b/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport.kt.after index f7e2b77de94..f1e2bcb1a6c 100644 --- a/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/JetClassCompletionImport.kt.after @@ -1,3 +1,4 @@ +// FIR_COMPARISON package classimporttest import forimport.TTTest diff --git a/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict-1.kt b/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict-1.kt index 261ca171968..5a2d1998635 100644 --- a/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict-1.kt +++ b/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict-1.kt @@ -1,3 +1,4 @@ +// FIR_COMPARISON package a class Goo { diff --git a/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict.kt.after b/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict.kt.after index 430297a0d7e..c55c3b6a359 100644 --- a/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict.kt.after +++ b/idea/idea-completion/testData/handlers/multifile/PropertyFunctionConflict.kt.after @@ -1,3 +1,4 @@ +// FIR_COMPARISON package a import a.b.foo diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionMultifileHandlerTest.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionMultifileHandlerTest.kt index 4f7693f45f4..7fe6c35e821 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionMultifileHandlerTest.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionMultifileHandlerTest.kt @@ -17,7 +17,7 @@ import org.junit.runner.RunWith import java.io.File @RunWith(JUnit3WithIdeaConfigurationRunner::class) -class CompletionMultiFileHandlerTest : KotlinFixtureCompletionBaseTestCase() { +open class CompletionMultiFileHandlerTest : KotlinFixtureCompletionBaseTestCase() { fun testExtensionFunctionImport() { doTest() } @@ -118,8 +118,11 @@ class CompletionMultiFileHandlerTest : KotlinFixtureCompletionBaseTestCase() { doTest() } - fun doTest(completionChar: Char = '\n', vararg extraFileNames: String, tailText: String? = null) { - val fileName = getTestName(false) + private fun doTest(completionChar: Char = '\n', vararg extraFileNames: String, tailText: String? = null) { + doTest(getTestName(false), completionChar, extraFileNames, tailText) + } + + open fun doTest(fileName: String, completionChar: Char, extraFileNames: Array, tailText: String?) { val defaultFiles = listOf("$fileName-1.kt", "$fileName-2.kt") val filteredFiles = defaultFiles.filter { File(testDataPath, it).exists() } diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/HighLevelCompletionMultifileHandlerTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/HighLevelCompletionMultifileHandlerTest.kt new file mode 100644 index 00000000000..1c7e0f147f4 --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/test/handlers/HighLevelCompletionMultifileHandlerTest.kt @@ -0,0 +1,32 @@ +/* + * 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.handlers + +import com.intellij.testFramework.LightProjectDescriptor +import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor +import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner +import org.jetbrains.kotlin.test.uitls.IgnoreTests +import org.junit.runner.RunWith +import java.nio.file.Paths + +@RunWith(JUnit3WithIdeaConfigurationRunner::class) +class HighLevelCompletionMultifileHandlerTest : CompletionMultiFileHandlerTest() { + + /** + * This is a temporary solution! This test should be rewritten to be generated! + */ + override fun doTest(fileName: String, completionChar: Char, extraFileNames: Array, tailText: String?) { + val testFile = Paths.get(testDataPath, "$fileName-1.kt") + + IgnoreTests.runTestIfEnabledByFileDirective(testFile, IgnoreTests.DIRECTIVES.FIR_COMPARISON) { + super.doTest(fileName, completionChar, extraFileNames, tailText) + } + } + + override val captureExceptions: Boolean = false + + override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE +}