more verbose test diagnostics

GitOrigin-RevId: 41ea26d38c68238bcc2890a4d511aaadbdb92108
This commit is contained in:
Alexey Kudravtsev
2024-10-03 13:45:06 +02:00
committed by intellij-monorepo-bot
parent b05b2ce42a
commit ecf22d34c8
3 changed files with 13 additions and 12 deletions

View File

@@ -94,6 +94,6 @@ public class EmptyIntentionInspectionQuickFixTest extends LightQuickFixTestCase
return;
}
}
fail("Missed inspection setting action");
fail("Missing EditInspectionToolsSettingsAction; all emptyActions="+emptyActions);
}
}

View File

@@ -245,7 +245,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
val fixDescription = localFixTextString?.let { "with specified text '$localFixTextString'" } ?: ""
if (localFixTextString != "none") {
assertTrue("Fix $fixDescription not found among ${allLocalFixActions.size} actions available:\n $availableDescription",
assertTrue("Fix '$fixDescription' not found among ${allLocalFixActions.size} actions available:\n $availableDescription",
localFixActions.isNotEmpty()
)
}

View File

@@ -146,18 +146,19 @@ object DirectiveBasedActionUtils {
actionsToExclude,
) { expectedActionsDirectives, actualActionsDirectives ->
if (expectedActionsDirectives != actualActionsDirectives) {
val actual = fileText.let { text ->
val lines = text.split('\n')
val firstActionIndex = lines.indexOfFirst { it.startsWith(ACTION_DIRECTIVE) }.takeIf { it != -1 }
val textWithoutActions = lines.filterNot { it.startsWith(ACTION_DIRECTIVE) }
textWithoutActions.subList(0, firstActionIndex ?: 1)
.plus(actualActionsDirectives)
.plus(textWithoutActions.drop(firstActionIndex ?: 1))
.joinToString("\n")
}
assertEqualsToFile(
description = "Some unexpected actions available at current position. Use '$ACTION_DIRECTIVE' directive",
description = "Some unexpected actions available at current position. Use '$ACTION_DIRECTIVE' directive in $file",
expected = file,
actual = fileText.let { text ->
val lines = text.split('\n')
val firstActionIndex = lines.indexOfFirst { it.startsWith(ACTION_DIRECTIVE) }.takeIf { it != -1 }
val textWithoutActions = lines.filterNot { it.startsWith(ACTION_DIRECTIVE) }
textWithoutActions.subList(0, firstActionIndex ?: 1)
.plus(actualActionsDirectives)
.plus(textWithoutActions.drop(firstActionIndex ?: 1))
.joinToString("\n")
}
actual = actual
)
}
}