tests: extract closeAndDeleteProject, move to testUtils
This commit is contained in:
@@ -16,9 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.test
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.roots.ModifiableRootModel
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.util.Consumer
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
@@ -65,3 +67,6 @@ public fun JetFile.dumpTextWithErrors(): String {
|
||||
return header + getText()
|
||||
}
|
||||
|
||||
public fun closeAndDeleteProject(): Unit =
|
||||
ApplicationManager.getApplication().runWriteAction() { LightPlatformTestCase.closeAndDeleteProject() }
|
||||
|
||||
|
||||
+3
-9
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.decompiler.navigation;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources;
|
||||
import org.jetbrains.kotlin.idea.test.TestPackage;
|
||||
|
||||
public class NavigateToStdlibSourceRegressionTest extends NavigateToLibraryRegressionTest {
|
||||
/**
|
||||
@@ -34,16 +33,11 @@ public class NavigateToStdlibSourceRegressionTest extends NavigateToLibraryRegre
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
// Workaround for IDEA's bug during tests.
|
||||
// After tests IDEA disposes VirtualFiles within LocalFileSystem, but doesn't rebuild indices.
|
||||
// This causes library source files to be impossible to find via indices
|
||||
super.tearDown();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LightPlatformTestCase.closeAndDeleteProject();
|
||||
}
|
||||
});
|
||||
TestPackage.closeAndDeleteProject();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+3
-9
@@ -16,13 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.decompiler.navigation
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.idea.JetFileType
|
||||
import org.jetbrains.kotlin.idea.test.KotlinCodeInsightTestCase
|
||||
import org.jetbrains.kotlin.idea.test.ModuleKind
|
||||
import org.jetbrains.kotlin.idea.test.closeAndDeleteProject
|
||||
import org.jetbrains.kotlin.idea.test.configureAs
|
||||
|
||||
public class NavigateToStdlibSourceTest : KotlinCodeInsightTestCase() {
|
||||
@@ -51,16 +50,11 @@ public class NavigateToStdlibSourceTest : KotlinCodeInsightTestCase() {
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
// Copied verbatim from NavigateToStdlibSourceRegressionTest.
|
||||
super.tearDown()
|
||||
// Workaround for IDEA's bug during tests.
|
||||
// After tests IDEA disposes VirtualFiles within LocalFileSystem, but doesn't rebuild indices.
|
||||
// This causes library source files to be impossible to find via indices
|
||||
super.tearDown()
|
||||
ApplicationManager.getApplication().runWriteAction(object : Runnable {
|
||||
override fun run() {
|
||||
LightPlatformTestCase.closeAndDeleteProject()
|
||||
}
|
||||
})
|
||||
closeAndDeleteProject()
|
||||
}
|
||||
|
||||
protected fun configureAndResolve(
|
||||
|
||||
Reference in New Issue
Block a user