Skip to content

Commit

Permalink
fix: managed dirty glue for #2902
Browse files Browse the repository at this point in the history
  • Loading branch information
U117293 authored and U117293 committed Oct 16, 2024
1 parent 9521ea1 commit 7426d84
Showing 1 changed file with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ void prepareGlue(Locale locale) throws DuplicateStepDefinitionException {
stepDefinitionsHashCode = stepDefinitionsHashCodeNew;
}

stepDefinitionsChanged = true; // TODO comment this line to make build
// fail, e.g. due to
// io.cucumber.core.plugin.PrettyFormatterTest.should_handle_scenario_outline

// TODO: separate prepared and unprepared glue into different classes
if (parameterTypesDefinitionsChanged) {
// parameters changed from the previous scenario => re-register them
Expand Down Expand Up @@ -367,7 +363,7 @@ void prepareGlue(Locale locale) throws DuplicateStepDefinitionException {
throw new DuplicateStepDefinitionException(previous, stepDefinition);
}
stepDefinitionsByPattern.put(coreStepDefinition.getExpression().getSource(), coreStepDefinition);
emitStepDefined(coreStepDefinition);
emitStepDefined(coreStepDefinition); // FIXME if step definition are cached, the StepDefinedEvent is not emitted anymore, so io.cucumber.core.runtime.RuntimeTest#generates_events_for_glue_and_scenario_scoped_glue fails
});
}

Expand Down Expand Up @@ -515,19 +511,22 @@ private List<PickleStepDefinitionMatch> stepDefinitionMatches(URI uri, Step step
}

void removeScenarioScopedGlue() {
removeScenarioScopedGlue(beforeHooks);
removeScenarioScopedGlue(beforeStepHooks);
removeScenarioScopedGlue(afterHooks);
removeScenarioScopedGlue(afterStepHooks);
removeScenarioScopedGlue(stepDefinitions);
removeScenarioScopedGlue(dataTableTypeDefinitions);
removeScenarioScopedGlue(docStringTypeDefinitions);
removeScenarioScopedGlue(parameterTypeDefinitions);
removeScenarioScopedGlue(defaultParameterTransformers);
removeScenarioScopedGlue(defaultDataTableEntryTransformers);
removeScenarioScopedGlue(defaultDataTableCellTransformers);

stepDefinitionsByPattern.clear();
boolean dirty = false;
dirty |= removeScenarioScopedGlue(beforeHooks);
dirty |= removeScenarioScopedGlue(beforeStepHooks);
dirty |= removeScenarioScopedGlue(afterHooks);
dirty |= removeScenarioScopedGlue(afterStepHooks);
dirty |= removeScenarioScopedGlue(stepDefinitions);
dirty |= removeScenarioScopedGlue(dataTableTypeDefinitions);
dirty |= removeScenarioScopedGlue(docStringTypeDefinitions);
dirty |= removeScenarioScopedGlue(parameterTypeDefinitions);
dirty |= removeScenarioScopedGlue(defaultParameterTransformers);
dirty |= removeScenarioScopedGlue(defaultDataTableEntryTransformers);
dirty |= removeScenarioScopedGlue(defaultDataTableCellTransformers);

if (dirty) {
stepDefinitionsByPattern.clear();
}

}

Expand Down

0 comments on commit 7426d84

Please sign in to comment.