Refactor intention test files enumerating, do not use deprecated filter method, which would get another behavior after dropping deprecated one.
This commit is contained in:
@@ -71,13 +71,13 @@ public abstract class AbstractInspectionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
setTestDataPath("${KotlinTestUtils.getHomeDirectory()}/$srcDir")
|
setTestDataPath("${KotlinTestUtils.getHomeDirectory()}/$srcDir")
|
||||||
|
|
||||||
val afterFiles = srcDir.listFiles { it.name == "inspectionData" }?.single()?.listFiles { it.extension == "after" } ?: emptyArray()
|
val afterFiles = srcDir.listFiles { it.name == "inspectionData" }?.single()?.listFiles { it.extension == "after" } ?: emptyArray()
|
||||||
val psiFiles = srcDir.walkTopDown().filter { it.name != "inspectionData" }.map {
|
val psiFiles = srcDir.walkTopDown().treeFilter { it.name != "inspectionData" }.map {
|
||||||
file ->
|
file ->
|
||||||
if (file.isDirectory) {
|
if (file.isDirectory) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
else if (file.extension != "kt") {
|
else if (file.extension != "kt") {
|
||||||
val filePath = file.getPath().substringAfter(srcDir.getPath()).replace("\\", "/")
|
val filePath = file.relativeTo(srcDir).replace('\\', '/')
|
||||||
configureByFile(filePath)
|
configureByFile(filePath)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -86,10 +86,10 @@ public abstract class AbstractInspectionTest : KotlinLightCodeInsightFixtureTest
|
|||||||
if (text.startsWith("package"))
|
if (text.startsWith("package"))
|
||||||
text
|
text
|
||||||
else
|
else
|
||||||
"package ${file.getName().removeSuffix(".kt")};$text"
|
"package ${file.nameWithoutExtension};$text"
|
||||||
configureByText(file.getName(), fileText)!!
|
configureByText(file.name, fileText)!!
|
||||||
}
|
}
|
||||||
}.filterNotNull().toArrayList()
|
}.filterNotNull().toList()
|
||||||
|
|
||||||
val isJs = srcDir.endsWith("js")
|
val isJs = srcDir.endsWith("js")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user