FIR IDE: Fix tests in idea-fir

This commit is contained in:
Ilya Kirillov
2020-05-26 12:39:13 +03:00
parent ba7e953760
commit c6ae916b24
10 changed files with 55 additions and 25 deletions
@@ -77,20 +77,25 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
override fun setUp() {
super.setUp()
enableKotlinOfficialCodeStyle(project)
// We do it here to avoid possible initialization problems
// UnusedSymbolInspection() calls IDEA UnusedDeclarationInspection() in static initializer,
// which in turn registers some extensions provoking "modifications aren't allowed during highlighting"
// when done lazily
UnusedSymbolInspection()
if (!isFirPlugin) {
// We do it here to avoid possible initialization problems
// UnusedSymbolInspection() calls IDEA UnusedDeclarationInspection() in static initializer,
// which in turn registers some extensions provoking "modifications aren't allowed during highlighting"
// when done lazily
UnusedSymbolInspection()
}
runPostStartupActivitiesOnce(project)
VfsRootAccess.allowRootAccess(project, KotlinTestUtils.getHomeDirectory())
editorTrackerProjectOpened(project)
invalidateLibraryCache(project)
if (!isFirPlugin) {
invalidateLibraryCache(project)
}
if (captureExceptions) {
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.test;
@@ -102,4 +91,8 @@ public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCod
//noinspection Convert2MethodRef
KotlinTestUtils.runTestWithThrowable(this, () -> super.runTest());
}
protected boolean isFirPlugin() {
return false;
}
}
@@ -14,12 +14,15 @@ import java.io.File
import kotlin.reflect.full.findAnnotation
abstract class KotlinLightPlatformCodeInsightFixtureTestCase : LightPlatformCodeInsightFixtureTestCase() {
protected open fun isFirPlugin(): Boolean = false
override fun setUp() {
super.setUp()
enableKotlinOfficialCodeStyle(project)
runPostStartupActivitiesOnce(project)
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory())
invalidateLibraryCache(project)
if (!isFirPlugin()) {
invalidateLibraryCache(project)
}
}
override fun tearDown() = runAll(