Skip to content

Commit

Permalink
Clean up some code in PlatformSpecRunner
Browse files Browse the repository at this point in the history
- 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 spockframework#1662.
  • Loading branch information
kriegaex committed May 6, 2023
1 parent e1833e9 commit 084ddec
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 084ddec

Please sign in to comment.