Refactor AbstractHighLevelMultiFileJvmBasicCompletionTest
Use `KotlinFixtureCompletionBaseTestCase` base because it can override `getProjectDescriptor`, so the tests will see full JDK Without it, there were problems when classes from JDK appeared in the completion (`Serialization`, for example)
This commit is contained in:
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_COMPARISON
|
||||||
val String.extensionProp1: Int get() = 1
|
val String.extensionProp1: Int get() = 1
|
||||||
val String.extensionProp2: Int get() = 1
|
val String.extensionProp2: Int get() = 1
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// FIR_COMPARISON
|
|
||||||
// NUMBER: 3
|
// NUMBER: 3
|
||||||
// EXIST: foo.txt
|
// EXIST: foo.txt
|
||||||
// EXIST: bar.txt
|
// EXIST: bar.txt
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_COMPARISON
|
||||||
// this test tests correct substitution equality checking for generic functions
|
// this test tests correct substitution equality checking for generic functions
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_COMPARISON
|
||||||
package first
|
package first
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_COMPARISON
|
||||||
package first
|
package first
|
||||||
|
|
||||||
fun firstFun() {
|
fun firstFun() {
|
||||||
|
|||||||
+23
-15
@@ -6,26 +6,34 @@
|
|||||||
package org.jetbrains.kotlin.idea.completion
|
package org.jetbrains.kotlin.idea.completion
|
||||||
|
|
||||||
import com.intellij.codeInsight.completion.CompletionType
|
import com.intellij.codeInsight.completion.CompletionType
|
||||||
import org.jetbrains.kotlin.idea.completion.test.AbstractMultiFileJvmBasicCompletionTest
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.idea.completion.test.testCompletion
|
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.platform.jvm.JvmPlatforms
|
||||||
import org.jetbrains.kotlin.test.uitls.IgnoreTests
|
import org.jetbrains.kotlin.test.uitls.IgnoreTests
|
||||||
import java.nio.file.Path
|
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
|
|
||||||
abstract class AbstractHighLevelMultiFileJvmBasicCompletionTest : AbstractMultiFileJvmBasicCompletionTest() {
|
abstract class AbstractHighLevelMultiFileJvmBasicCompletionTest : KotlinFixtureCompletionBaseTestCase() {
|
||||||
private val testDataFile: Path
|
override val captureExceptions: Boolean = false
|
||||||
get() = Paths.get(testDataPath, getTestName(false) + ".kt")
|
|
||||||
|
|
||||||
override fun doTest(testPath: String) {
|
override fun executeTest(test: () -> Unit) {
|
||||||
IgnoreTests.runTestIfEnabledByFileDirective(testDataFile, IgnoreTests.DIRECTIVES.FIR_COMPARISON) {
|
IgnoreTests.runTestIfEnabledByFileDirective(testDataFile().toPath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON) {
|
||||||
configureByFile(getTestName(false) + ".kt", "")
|
test()
|
||||||
|
|
||||||
testCompletion(file.text, JvmPlatforms.unspecifiedJvmPlatform, { completionType, invocationCount ->
|
|
||||||
setType(completionType)
|
|
||||||
complete(invocationCount)
|
|
||||||
myItems
|
|
||||||
}, CompletionType.BASIC, 0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user