Convert IntentionTestGenerated to light fixture test case

This commit is contained in:
Dmitry Jemerov
2017-03-22 18:56:05 +01:00
parent 5af423f1b4
commit b24ce04dea
8 changed files with 34 additions and 84 deletions
@@ -104,9 +104,7 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
protected fun getProjectDescriptorFromFileDirective(): LightProjectDescriptor {
if (!isAllFilesPresentInTest()) {
try {
val metadata = this::class.findAnnotation<TestMetadata>()
val basePath = metadata?.value ?: testDataPath
val fileText = FileUtil.loadFile(File(basePath, fileName()), true)
val fileText = FileUtil.loadFile(File(testDataPath, fileName()), true)
val withLibraryDirective = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fileText, "WITH_LIBRARY:")
if (!withLibraryDirective.isEmpty()) {
@@ -157,4 +155,8 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
managerEx.fireAfterActionPerformed(action, dataContext, event)
return true
}
override fun getTestDataPath(): String {
return this::class.findAnnotation<TestMetadata>()?.value ?: super.getTestDataPath()
}
}