Skip to content
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

Restore support for matching a scenario by multiline step argument line numbers #239

Merged
merged 3 commits into from
Oct 25, 2022

Conversation

botandrose
Copy link
Contributor

Description

The Cucumber 4.0 release introduced some regressions in matching scenarios by line numbers other than the exact scenario line. The feature line, tag line, background lines, and step lines all stopped matching their related scenario(s). More context at cucumber/cucumber-ruby#1469

This PR builds on top of #238 to also match multiline arguments like tables and docstrings. Note that I didn't update the CHANGELOG because I think this falls within the changelog line added in the previous PR.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

@botandrose
Copy link
Contributor Author

@luke-hill @mattwynne I have some free time coming up if this needs any work. WDYT?

@luke-hill
Copy link
Contributor

I have probably done about 2-3 hours on cucumber over the last month, owing to real life stuff.

I can maybe get around to contributing here or offering some insight later in the month. If you're ok to continue solo I can check it in a while.

@mattwynne mattwynne self-requested a review October 20, 2022 14:42
Copy link
Member

@mattwynne mattwynne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Some minor suggestions for tweaks but this looks great, thanks for figuring it out!

@@ -51,6 +51,14 @@ def action_location
@action.location
end

def matching_locations
if multiline_arg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the multiline_arg prop defaults to an Test::EmptyMultilineArgument (a null object) so I don't think you need this conditional.

@@ -79,6 +79,13 @@ def to_str
to_s
end

def select_down(lines_count)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this!

What about just calling it select and taking the thing that has a lines_count. Might read a bit nicer on the calling code?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or merge?

[location.merge(multiline_arg)]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah actually select has other meanings in Ruby

@botandrose
Copy link
Contributor Author

@mattwynne Okay, just pushed a commit incorporating your suggestions. Ready to merge?

Then I can move onto a new PR plugging the last few holes in the larger scenario-matching regression.

@mattwynne mattwynne merged commit d58eb01 into cucumber:main Oct 25, 2022
@aslakhellesoy
Copy link
Contributor

Hi @botandrose,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@mattwynne
Copy link
Member

Superb, thanks @botandrose!

@mattwynne
Copy link
Member

You can use branches in this repo now for PRs, if you prefer.

@botandrose botandrose deleted the match_multiline_args branch October 25, 2022 17:01
@botandrose botandrose restored the match_multiline_args branch October 25, 2022 17:01
@botandrose botandrose deleted the match_multiline_args branch September 17, 2023 14:22
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.

5 participants