Skip to content

[c] Fix setting keyword type when matching Action or Outcome #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2025

Conversation

musicinmybrain
Copy link
Contributor

🤔 What's changed?

Sets the matched keyword type to Keyword_Action or Keyword_Outcome, rather than to Keyword_Unknown, when matching keywords of the respective types.

⚡️ What's your motivation?

When this PR is combined with #417, the C acceptance tests (make acceptance) pass. Together, these two PR’s constitute a partial fix for #412.

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

I was surprised I did not have to change Keyword_Unknown to Keyword_Conjunction for the and/but case, which seems to parallel the action and outcome cases. If I do change the and/but case, the acceptance tests fail.

bool and_result = match_step_keywords(token, Keyword_Conjunction, token_matcher->dialect->and_keywords);
bool but_result = match_step_keywords(token, Keyword_Conjunction, token_matcher->dialect->but_keywords);
if (and_result || but_result) {
if (final_result) {
token->matched_keyword_type = Keyword_Unknown;
}
final_result = true;
}

I would love to understand why I didn’t need to change this case.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes. N/A, fixes existing tests
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@mpkorstanje
Copy link
Contributor

Cheers! I'll update the changelog.

@mpkorstanje mpkorstanje merged commit 4693654 into cucumber:main Jun 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants