Run tests in read action and not in EDT thread
Otherwise test will fail because of runInReadActionWithWriteActionPriority call in EDT
This commit is contained in:
committed by
Dmitry Jemerov
parent
82a2a705fb
commit
bcf29e6fbf
+12
-4
@@ -16,16 +16,20 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.debugger
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.runReadAction
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase
|
||||
import org.jetbrains.kotlin.idea.refactoring.getLineNumber
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinCodeFragmentFactory
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.addDebugExpressionIntoTmpFileForExtractFunction
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtExpressionCodeFragment
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
abstract class AbstractBeforeExtractFunctionInsertionTest : LightCodeInsightTestCase() {
|
||||
|
||||
@@ -42,10 +46,14 @@ abstract class AbstractBeforeExtractFunctionInsertionTest : LightCodeInsightTest
|
||||
val allText = fragmentFile.text
|
||||
val fragmentText = if (imports.isBlank()) allText else allText.substringAfter(imports, allText)
|
||||
|
||||
val expressionList = addDebugExpressionIntoTmpFileForExtractFunction(
|
||||
myFile as KtFile,
|
||||
KtExpressionCodeFragment(getProject(), "fragment.kt", fragmentText, imports, elementAt),
|
||||
line)
|
||||
val expressionList = ApplicationManager.getApplication().executeOnPooledThread(Callable<List<KtExpression>> {
|
||||
runReadAction {
|
||||
addDebugExpressionIntoTmpFileForExtractFunction(
|
||||
myFile as KtFile,
|
||||
KtExpressionCodeFragment(getProject(), "fragment.kt", fragmentText, imports, elementAt),
|
||||
line)
|
||||
}
|
||||
}).get()
|
||||
|
||||
KotlinTestUtils.assertEqualsToFile(File(path + ".after"), expressionList.first().containingFile.text)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user