From 16619571667f48338c90fae02de611febc6fbf69 Mon Sep 17 00:00:00 2001 From: Adam Semenenko <152864218+adam-enko@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:34:18 +0100 Subject: [PATCH] !fixup [Gradle] refactor Gradle task assertion utils for clarity - Rename/update to differentiate between 'executed' tasks vs tasks that are not in the task graph - de-duplicate assertTasksNotExecuted() / assertTasksAreNotInTaskGraph() they both did the same thing - re-use code for verifying all tasks have a specific outcome - add a more helpful failed assertion message if the task isn't found - rename 'tasks' to 'taskPaths' for clarity --- .../org/jetbrains/kotlin/gradle/testbase/tasksAssertions.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/tasksAssertions.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/tasksAssertions.kt index 1373035d9d9..1b091b2e7a2 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/tasksAssertions.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/tasksAssertions.kt @@ -12,8 +12,8 @@ import kotlin.test.assertNotNull /** * Asserts given tasks are not present in the build task graph. * - * (Note this is different from asserting tasks are not executed - Tasks with outcomes - * [TaskOutcome.SKIPPED] and [TaskOutcome.UP_TO_DATE] will be in the task graph, but + * (Note: 'not in task graph' has a different meaning to 'not executed'. + * Tasks with outcomes [TaskOutcome.SKIPPED] and [TaskOutcome.UP_TO_DATE] will be in the task graph, but * are not considered 'executed'). */ fun BuildResult.assertTasksAreNotInTaskGraph(vararg taskPaths: String) { @@ -51,7 +51,7 @@ fun BuildResult.assertAnyTaskHasBeenExecuted(taskPaths: Set) { taskOutcomes.values.any { it == TaskOutcome.SUCCESS } ) { printBuildOutput() - "Expected at least one Task of ($taskPaths) had outcome 'SUCCESS', but none did. Actual: $taskOutcomes" + "Expected at least one Task of $taskPaths had outcome 'SUCCESS', but none did. Actual outcomes: $taskOutcomes" } }