Rewrite AbstractQuickFixTest based on light fixture test case
Don't reconfigure runtime before every test. For consistency, mark tests that require the runtime with directives instead of relying on test file names.
This commit is contained in:
+13
-6
@@ -49,6 +49,8 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
||||
|
||||
protected val module: Module get() = myFixture.module
|
||||
|
||||
protected open val captureExceptions = true
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
|
||||
@@ -61,12 +63,14 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
||||
|
||||
invalidateLibraryCache(project)
|
||||
|
||||
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
|
||||
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
|
||||
exceptions.addIfNotNull(t)
|
||||
super.processError(message, t, details, logger)
|
||||
}
|
||||
})
|
||||
if (captureExceptions) {
|
||||
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
|
||||
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
|
||||
exceptions.addIfNotNull(t)
|
||||
super.processError(message, t, details, logger)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
@@ -116,6 +120,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_KOTLIN_TEST")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_KOTLIN_TEST
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_FULL_JDK")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
|
||||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
||||
Reference in New Issue
Block a user