Remove custom runtime configure from AbstractParameterInfoTest
This commit is contained in:
@@ -21,11 +21,12 @@ import com.intellij.codeInsight.hint.ShowParameterInfoHandler
|
|||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiWhiteSpace
|
import com.intellij.psi.PsiWhiteSpace
|
||||||
import com.intellij.testFramework.IdeaTestUtil
|
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||||
import org.jetbrains.kotlin.idea.test.*
|
import org.jetbrains.kotlin.idea.test.JdkAndMockLibraryProjectDescriptor
|
||||||
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
|
import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
||||||
@@ -37,11 +38,9 @@ abstract class AbstractParameterInfoTest : LightCodeInsightFixtureTestCase() {
|
|||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
override fun getProjectDescriptor(): LightProjectDescriptor {
|
||||||
val root = KotlinTestUtils.getTestsRoot(this::class.java)
|
val root = KotlinTestUtils.getTestsRoot(this::class.java)
|
||||||
if (root.contains("Lib")) {
|
if (root.contains("Lib")) {
|
||||||
return JdkAndMockLibraryProjectDescriptor(
|
return JdkAndMockLibraryProjectDescriptor("$root/sharedLib", true, true, false, false)
|
||||||
"$root/sharedLib", true, true, false, false
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ProjectDescriptorWithStdlibSources.INSTANCE
|
return ProjectDescriptorWithStdlibSources.INSTANCE
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,13 +53,6 @@ abstract class AbstractParameterInfoTest : LightCodeInsightFixtureTestCase() {
|
|||||||
myFixture.configureByFile(fileName)
|
myFixture.configureByFile(fileName)
|
||||||
|
|
||||||
val file = myFixture.file as KtFile
|
val file = myFixture.file as KtFile
|
||||||
val isWithRuntime = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// WITH_RUNTIME") != null
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (isWithRuntime) {
|
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myFixture.module, PluginTestCaseBase.mockJdk())
|
|
||||||
}
|
|
||||||
|
|
||||||
val lastChild = file.allChildren.filter { it !is PsiWhiteSpace }.last()
|
val lastChild = file.allChildren.filter { it !is PsiWhiteSpace }.last()
|
||||||
val expectedResultText = when (lastChild.node.elementType) {
|
val expectedResultText = when (lastChild.node.elementType) {
|
||||||
KtTokens.BLOCK_COMMENT -> lastChild.text.substring(2, lastChild.text.length - 2).trim()
|
KtTokens.BLOCK_COMMENT -> lastChild.text.substring(2, lastChild.text.length - 2).trim()
|
||||||
@@ -93,13 +85,9 @@ abstract class AbstractParameterInfoTest : LightCodeInsightFixtureTestCase() {
|
|||||||
val parameterInfoUIContext = MockParameterInfoUIContext(parameterOwner, updateContext.currentParameter)
|
val parameterInfoUIContext = MockParameterInfoUIContext(parameterOwner, updateContext.currentParameter)
|
||||||
|
|
||||||
mockCreateParameterInfoContext.itemsToShow?.forEach {
|
mockCreateParameterInfoContext.itemsToShow?.forEach {
|
||||||
handler.updateUI(it, parameterInfoUIContext)}
|
handler.updateUI(it, parameterInfoUIContext)
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals(expectedResultText, parameterInfoUIContext.resultText)}
|
Assert.assertEquals(expectedResultText, parameterInfoUIContext.resultText)
|
||||||
finally {
|
|
||||||
if (isWithRuntime) {
|
|
||||||
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(myFixture.module, IdeaTestUtil.getMockJdk17())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user