fixup! Ignore other diagnostics that can appear during test run

For example when commonMain depends on commonTest there will be
CommonMainWithDependsOnDiagnostic diagnostic reported.

Or running gradle build on linux with apple targets inside will report
DisabledKotlinNativeTargets diagnostic.

KotlinSourceSetTreeDependsOnMismatchTest is not interested in them
This commit is contained in:
Anton Lakotka
2023-06-15 12:42:25 +02:00
committed by Space Team
parent acf8f5b26b
commit 3774bafc72
@@ -28,7 +28,9 @@ class KotlinSourceSetTreeDependsOnMismatchTest {
}
}
project.evaluate()
return project.kotlinToolingDiagnosticsCollector.getDiagnosticsForProject(project).toList()
return project.kotlinToolingDiagnosticsCollector
.getDiagnosticsForProject(project)
.filter { it.id == KotlinSourceSetTreeDependsOnMismatch.id } // ignore other diagnostics that can appear as well
}
private fun checkSingleBadSourceSetDependency(
@@ -55,9 +57,7 @@ class KotlinSourceSetTreeDependsOnMismatchTest {
@Test
fun `commonMain cant depend on commonTest`() = checkSingleBadSourceSetDependency(
dependent = "commonMain",
dependency = "commonTest",
KotlinSourceSetTreeDependsOnMismatch("commonMain", "commonTest"),
CommonMainWithDependsOnDiagnostic()
dependency = "commonTest"
)
@Test