Minor: remove unnecessary callback from checkFiles

Filter list of files on call-sites instead
This commit is contained in:
Dmitry Savvinov
2020-01-14 15:14:21 +03:00
parent 3dfad4f0c3
commit a02e5d452f
2 changed files with 7 additions and 13 deletions
@@ -41,12 +41,10 @@ class GradleMultiplatformHighlightingTest : GradleImportingTestCase() {
val project = myTestFixture.project val project = myTestFixture.project
checkFiles( checkFiles(
files, files.filter { it.extension == "kt" },
project, project,
object : GradleDaemonAnalyzerTestCase(testLineMarkers = true, checkWarnings = true, checkInfos = false) {} object : GradleDaemonAnalyzerTestCase(testLineMarkers = true, checkWarnings = true, checkInfos = false) {}
) { file -> )
file.extension == "kt"
}
} }
override fun testDataDirName(): String { override fun testDataDirName(): String {
@@ -72,19 +70,17 @@ abstract class GradleDaemonAnalyzerTestCase(
internal fun checkFiles( internal fun checkFiles(
files: List<VirtualFile>, files: List<VirtualFile>,
project: Project, project: Project,
analyzer: GradleDaemonAnalyzerTestCase, analyzer: GradleDaemonAnalyzerTestCase
fileFilter: (VirtualFile) -> Boolean
) { ) {
var atLeastOneFile = false var atLeastOneFile = false
val kotlinFiles = files.filter(fileFilter)
val content = mutableMapOf<VirtualFile, String>() val content = mutableMapOf<VirtualFile, String>()
kotlinFiles.forEach { file -> files.forEach { file ->
val (_, textWithTags) = configureEditorByExistingFile(file, project) val (_, textWithTags) = configureEditorByExistingFile(file, project)
atLeastOneFile = true atLeastOneFile = true
content[file] = textWithTags content[file] = textWithTags
} }
Assert.assertTrue(atLeastOneFile) Assert.assertTrue(atLeastOneFile)
kotlinFiles.forEach { file -> files.forEach { file ->
val (editor, _) = configureEditorByExistingFile(file, project, content[file]) val (editor, _) = configureEditorByExistingFile(file, project, content[file])
analyzer.checkHighlighting(project, editor) analyzer.checkHighlighting(project, editor)
} }
@@ -29,16 +29,14 @@ class ImportAndCheckHighlighting : MultiplePluginVersionGradleImportingTestCase(
importProject() importProject()
val project = myTestFixture.project val project = myTestFixture.project
checkFiles( checkFiles(
files, files.filter { it.extension == "kt" || it.extension == "java" },
project, project,
object : GradleDaemonAnalyzerTestCase( object : GradleDaemonAnalyzerTestCase(
testLineMarkers = testLineMarkers, testLineMarkers = testLineMarkers,
checkWarnings = checkWarnings, checkWarnings = checkWarnings,
checkInfos = false checkInfos = false
) {} ) {}
) { file -> )
file.extension == "kt" || file.extension == "java"
}
} }
override fun testDataDirName(): String { override fun testDataDirName(): String {