From 084ddecc9e10d14722523f2595116ef9765c2649 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Sat, 6 May 2023 16:31:34 +0200 Subject: [PATCH] Clean up some code in PlatformSpecRunner - In 'runFeature', the 'if (currentFeature.isSkipped())' code block is unnecessary, because it will never be executed, as 'runFeature' also will not be executed for skipped features. - In 'runSpec', add 'if (spec.isExcluded()) return;' analogous to the existing 'if (currentFeature.isExcluded()) return;' in 'runFeature', logically aligning the code structures in both methods. Relates to #1662. --- .../org/spockframework/runtime/PlatformSpecRunner.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spock-core/src/main/java/org/spockframework/runtime/PlatformSpecRunner.java b/spock-core/src/main/java/org/spockframework/runtime/PlatformSpecRunner.java index 53616a7a06..de259ee065 100644 --- a/spock-core/src/main/java/org/spockframework/runtime/PlatformSpecRunner.java +++ b/spock-core/src/main/java/org/spockframework/runtime/PlatformSpecRunner.java @@ -51,6 +51,8 @@ public void runSpec(SpockExecutionContext context, Runnable specRunner) { if (context.getErrorInfoCollector().hasErrors()) return; SpecInfo spec = context.getSpec(); + if (spec.isExcluded()) return; + supervisor.beforeSpec(spec); invoke(context, this, createMethodInfoForDoRunSpec(context, specRunner)); supervisor.afterSpec(spec); @@ -183,11 +185,6 @@ public void runFeature(SpockExecutionContext context, Runnable feature) { FeatureInfo currentFeature = context.getCurrentFeature(); if (currentFeature.isExcluded()) return; - if (currentFeature.isSkipped()) { - supervisor.featureSkipped(currentFeature); // todo notify in node isSkipped - return; - } - supervisor.beforeFeature(currentFeature); invoke(context, this, createMethodInfoForDoRunFeature(context, feature)); supervisor.afterFeature(currentFeature);