From 3774bafc72516352e6727a7856c98c9fee0d1048 Mon Sep 17 00:00:00 2001 From: Anton Lakotka Date: Thu, 15 Jun 2023 12:42:25 +0200 Subject: [PATCH] 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 --- .../KotlinSourceSetTreeDependsOnMismatchTest.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/diagnosticsTests/KotlinSourceSetTreeDependsOnMismatchTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/diagnosticsTests/KotlinSourceSetTreeDependsOnMismatchTest.kt index 59968537bb8..e1768b4262a 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/diagnosticsTests/KotlinSourceSetTreeDependsOnMismatchTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/diagnosticsTests/KotlinSourceSetTreeDependsOnMismatchTest.kt @@ -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