Fix incorrectly configured IDE tests

The important changes are in ideaTestUtils.kt:
`configureByFiles` must be called on the relative to testData dir path,
otherwise java files in the project belong to src/idea/testData/.../A.java
instead of src/A.java and can't be found in the root package

New updates in resolution when resolving A() call is now asking whether
<root>.A exists in PsiPackage::getClasses instead of
PsiPackage::findClassByShortName that can find a class even if it's located
in the wrong directory
This commit is contained in:
Denis Zharkov
2017-08-29 12:27:17 +03:00
parent 5b01a32bd3
commit 12b348ae48
7 changed files with 15 additions and 26 deletions
@@ -22,6 +22,8 @@ import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestMetadata
import kotlin.reflect.full.findAnnotation
abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeInsightFixtureTestCase() {
private var kotlinInternalModeOriginalValue: Boolean = false
@@ -44,4 +46,6 @@ abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeI
super.tearDown()
}
}
}
override fun getTestDataPath(): String = this::class.findAnnotation<TestMetadata>()?.value ?: super.getTestDataPath()
}