AbstractExtractionTest: fix for invalid files
`configureByFile` should be run after other configurations (like `configureKotlinRuntimeAndSdk`) because they could make configured file invalid
This commit is contained in:
committed by
Nikolay Krasko
parent
dd45780de9
commit
ab0c081897
+3
-3
@@ -339,15 +339,15 @@ abstract class AbstractExtractionTest : KotlinLightCodeInsightFixtureTestCase()
|
|||||||
name != mainFileName && name.startsWith("$mainFileBaseName.") && (name.endsWith(".kt") || name.endsWith(".java"))
|
name != mainFileName && name.startsWith("$mainFileBaseName.") && (name.endsWith(".kt") || name.endsWith(".java"))
|
||||||
}
|
}
|
||||||
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(it.name) }
|
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(it.name) }
|
||||||
val file = fixture.configureByFile(mainFileName)
|
val fileText = FileUtil.loadFile(File(path), true)
|
||||||
|
|
||||||
val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// WITH_RUNTIME") != null
|
val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// WITH_RUNTIME") != null
|
||||||
if (addKotlinRuntime) {
|
if (addKotlinRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkExtract(ExtractTestFiles(path, file, extraFilesToPsi), checkAdditionalAfterdata, action)
|
checkExtract(ExtractTestFiles(path, fixture.configureByFile(mainFileName), extraFilesToPsi), checkAdditionalAfterdata, action)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (addKotlinRuntime) {
|
if (addKotlinRuntime) {
|
||||||
|
|||||||
Reference in New Issue
Block a user