From 94e1c0e9feb53daa681875c2beb1b7f096093c6c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 6 Sep 2023 16:30:26 +0200 Subject: [PATCH] Tests: fix unmute check for fake override rebuilder tests Assertion thrown in `check` was wrapped into something and ignored at the call site, for some reason. So the "Looks like this test can be unmuted..." error was never happening for this test. --- ...egenWithIrFakeOverrideGeneratorSuppressor.kt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/CodegenWithIrFakeOverrideGeneratorSuppressor.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/CodegenWithIrFakeOverrideGeneratorSuppressor.kt index aea60e89580..0b56ab7ba6f 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/CodegenWithIrFakeOverrideGeneratorSuppressor.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/CodegenWithIrFakeOverrideGeneratorSuppressor.kt @@ -10,23 +10,18 @@ import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.ENABLE_IR_FAKE import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION import org.jetbrains.kotlin.test.model.AfterAnalysisChecker import org.jetbrains.kotlin.test.services.TestServices -import org.jetbrains.kotlin.test.services.assertions import org.jetbrains.kotlin.test.services.moduleStructure class CodegenWithIrFakeOverrideGeneratorSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) { - override fun check(failedAssertions: List) { - if (!mainDirectiveEnabled) return - if (failedAssertions.isEmpty() && suppressDirectiveEnabled) { - testServices.assertions.fail { - "Looks like this test can be unmuted. Remove $IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION directive " - } - } - } - override fun suppressIfNeeded(failedAssertions: List): List { return when { !mainDirectiveEnabled -> failedAssertions - suppressDirectiveEnabled -> emptyList() + suppressDirectiveEnabled -> + if (failedAssertions.isEmpty()) + listOf( + AssertionError("Looks like this test can be unmuted. Remove $IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION directive.").wrap() + ) + else emptyList() else -> failedAssertions } }