Unconfigure runtime to avoid affecting further tests
This commit is contained in:
@@ -75,10 +75,12 @@ public abstract class AbstractQuickFixMultiFileTest extends KotlinDaemonAnalyzer
|
|||||||
File mainFile = new File(testDataPath + beforeFileName);
|
File mainFile = new File(testDataPath + beforeFileName);
|
||||||
final String originalFileText = FileUtil.loadFile(mainFile, true);
|
final String originalFileText = FileUtil.loadFile(mainFile, true);
|
||||||
|
|
||||||
if (InTextDirectivesUtils.findStringWithPrefixes(originalFileText, "// WITH_RUNTIME") != null) {
|
boolean withRuntime = InTextDirectivesUtils.isDirectiveDefined(originalFileText, "// WITH_RUNTIME");
|
||||||
|
if (withRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk());
|
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (withExtraFile) {
|
if (withExtraFile) {
|
||||||
File mainFileDir = mainFile.getParentFile();
|
File mainFileDir = mainFile.getParentFile();
|
||||||
assert mainFileDir != null;
|
assert mainFileDir != null;
|
||||||
@@ -141,6 +143,12 @@ public abstract class AbstractQuickFixMultiFileTest extends KotlinDaemonAnalyzer
|
|||||||
}
|
}
|
||||||
}, "", "");
|
}, "", "");
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
if (withRuntime) {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||||
public void doAction(String text, boolean actionShouldBeAvailable, String testFullPath)
|
public void doAction(String text, boolean actionShouldBeAvailable, String testFullPath)
|
||||||
|
|||||||
+7
-1
@@ -142,7 +142,8 @@ public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTe
|
|||||||
|
|
||||||
val file = fixture.configureByFile(mainFile.getName()) as JetFile
|
val file = fixture.configureByFile(mainFile.getName()) as JetFile
|
||||||
|
|
||||||
if (InTextDirectivesUtils.findStringWithPrefixes(file.getText(), "// WITH_RUNTIME") != null) {
|
val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(file.getText(), "// WITH_RUNTIME") != null
|
||||||
|
if (addKotlinRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,5 +157,10 @@ public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTe
|
|||||||
val message = if (e is ConflictsInTestsException) e.getMessages().sort().joinToString(" ") else e.getMessage()
|
val message = if (e is ConflictsInTestsException) e.getMessages().sort().joinToString(" ") else e.getMessage()
|
||||||
JetTestUtils.assertEqualsToFile(conflictFile, message?.replace("\n", " ") ?: e.javaClass.getName())
|
JetTestUtils.assertEqualsToFile(conflictFile, message?.replace("\n", " ") ?: e.javaClass.getName())
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
if (addKotlinRuntime) {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,9 +80,6 @@ public abstract class AbstractJetMoveTest : MultiFileTestCase() {
|
|||||||
|
|
||||||
val config = JsonParser().parse(FileUtil.loadFile(File(path), true)) as JsonObject
|
val config = JsonParser().parse(FileUtil.loadFile(File(path), true)) as JsonObject
|
||||||
|
|
||||||
if (config["withRuntime"]?.getAsBoolean() ?: false) {
|
|
||||||
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
|
||||||
}
|
|
||||||
|
|
||||||
val action = MoveAction.valueOf(config.getString("type"))
|
val action = MoveAction.valueOf(config.getString("type"))
|
||||||
|
|
||||||
@@ -90,6 +87,12 @@ public abstract class AbstractJetMoveTest : MultiFileTestCase() {
|
|||||||
val mainFilePath = config.getNullableString("mainFile")!!
|
val mainFilePath = config.getNullableString("mainFile")!!
|
||||||
|
|
||||||
val conflictFile = File(testDir + "/conflicts.txt")
|
val conflictFile = File(testDir + "/conflicts.txt")
|
||||||
|
|
||||||
|
val withRuntime = config["withRuntime"]?.getAsBoolean() ?: false
|
||||||
|
if (withRuntime) {
|
||||||
|
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
||||||
|
}
|
||||||
|
|
||||||
doTest({ rootDir, rootAfter ->
|
doTest({ rootDir, rootAfter ->
|
||||||
val mainFile = rootDir.findFileByRelativePath(mainFilePath)!!
|
val mainFile = rootDir.findFileByRelativePath(mainFilePath)!!
|
||||||
val mainPsiFile = PsiManager.getInstance(getProject()!!).findFile(mainFile)!!
|
val mainPsiFile = PsiManager.getInstance(getProject()!!).findFile(mainFile)!!
|
||||||
@@ -119,6 +122,10 @@ public abstract class AbstractJetMoveTest : MultiFileTestCase() {
|
|||||||
FileDocumentManager.getInstance().saveAllDocuments()
|
FileDocumentManager.getInstance().saveAllDocuments()
|
||||||
|
|
||||||
EditorFactory.getInstance()!!.releaseEditor(editor)
|
EditorFactory.getInstance()!!.releaseEditor(editor)
|
||||||
|
|
||||||
|
if (withRuntime) {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTestDirName(true))
|
getTestDirName(true))
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ class RunConfigurationTest: CodeInsightTestCase() {
|
|||||||
|
|
||||||
ConfigLibraryUtil.configureKotlinRuntime(createModuleResult.module, PluginTestCaseBase.fullJdk())
|
ConfigLibraryUtil.configureKotlinRuntime(createModuleResult.module, PluginTestCaseBase.fullJdk())
|
||||||
|
|
||||||
|
try {
|
||||||
val expectedClasses = ArrayList<String>()
|
val expectedClasses = ArrayList<String>()
|
||||||
val actualClasses = ArrayList<String>()
|
val actualClasses = ArrayList<String>()
|
||||||
|
|
||||||
@@ -123,7 +124,11 @@ class RunConfigurationTest: CodeInsightTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Assert.assertEquals(expectedClasses, actualClasses);
|
Assert.assertEquals(expectedClasses, actualClasses)
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinRuntime(createModuleResult.module, PluginTestCaseBase.fullJdk())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createConfigurationFromMain(mainFqn: String): JetRunConfiguration {
|
private fun createConfigurationFromMain(mainFqn: String): JetRunConfiguration {
|
||||||
|
|||||||
@@ -52,10 +52,12 @@ public abstract class AbstractJetPsiUnifierTest: JetLightCodeInsightFixtureTestC
|
|||||||
myFixture.configureByFile(filePath)
|
myFixture.configureByFile(filePath)
|
||||||
val file = myFixture.getFile() as JetFile
|
val file = myFixture.getFile() as JetFile
|
||||||
|
|
||||||
if (InTextDirectivesUtils.findStringWithPrefixes(file.getText(), "// WITH_RUNTIME") != null) {
|
val withRuntime = InTextDirectivesUtils.findStringWithPrefixes(file.getText(), "// WITH_RUNTIME") != null
|
||||||
|
if (withRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
ConfigLibraryUtil.configureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
DirectiveBasedActionUtils.checkForUnexpectedErrors(file)
|
DirectiveBasedActionUtils.checkForUnexpectedErrors(file)
|
||||||
|
|
||||||
val actualText =
|
val actualText =
|
||||||
@@ -66,6 +68,12 @@ public abstract class AbstractJetPsiUnifierTest: JetLightCodeInsightFixtureTestC
|
|||||||
.joinToString("\n\n")
|
.joinToString("\n\n")
|
||||||
JetTestUtils.assertEqualsToFile(File("$filePath.match"), actualText)
|
JetTestUtils.assertEqualsToFile(File("$filePath.match"), actualText)
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
if (withRuntime) {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinRuntime(myModule, PluginTestCaseBase.fullJdk())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor = JetLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor(): LightProjectDescriptor = JetLightProjectDescriptor.INSTANCE
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user