Skip to content

Fix regression on optional regex submatches #221

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

Conversation

ala-ableton
Copy link
Contributor

@ala-ableton ala-ableton commented Apr 30, 2019

Summary

Fixes a regression that was introduced in commit a7ff906 (Regex: use iterators for match results).

Details

Until commit a7ff906, the vector returned by RegexMatch::getSubmatches() contained an empty string item for each optional submatch that didn't match. Commit a7ff906 broke that behavior by skipping any submatch that didn't match.

How Has This Been Tested?

I added a test (matchesRegexWithOptionalSubmatches) to tests/unit/RegexTest.cpp.
I cherry-picked this test on top of 4dec371 (the parent commit of a7ff906) and verified that it was passing. I then verified that this test doesn't pass on top of the latest master without the corresponding change in src/Regex.cpp.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • It is my own work, its copyright is implicitly assigned to the project and no substantial part of it has been copied from other sources (including Stack Overflow). In rare occasions this is acceptable, like in CMake modules where the original copyright information should be kept.
  • I'm using the same code standards as the existing code (indentation, spacing, variable naming, ...).
  • I've added tests for my code.
  • I have verified whether my change requires changes to the documentation
  • My change either requires no documentation change or I've updated the documentation accordingly.
  • My branch has been rebased to master, keeping only relevant commits.

@ala-ableton
Copy link
Contributor Author

ala-ableton commented Apr 30, 2019

I have no clue about whether I should make any changes to the documentation (including CHANGELOG.md), so I left the 2 check boxes un-ticked for now.

@coveralls
Copy link

coveralls commented Apr 30, 2019

Coverage Status

Coverage increased (+0.01%) to 62.47% when pulling e7b8f64 on AbletonAppDev:fix-regression-on-optional-regex-submatches into ee740d2 on cucumber:master.

ala-ableton referenced this pull request in AbletonAppDev/cucumber-cpp Apr 30, 2019
This regression was introduced in commit a7ff906 (Regex: use iterators
for match results).
@ala-ableton ala-ableton force-pushed the fix-regression-on-optional-regex-submatches branch from 318a002 to 34345b3 Compare May 7, 2019 08:08
@ala-ableton
Copy link
Contributor Author

Following the recent merges of #216 and #215, I've rebased and force-pushed my branch.
@muggenhor, @paoloambrosio: please review, thanks!

This regression was introduced in commit a7ff906 (Regex: use iterators
for match results).
@ala-ableton ala-ableton force-pushed the fix-regression-on-optional-regex-submatches branch from 34345b3 to e7b8f64 Compare May 7, 2019 08:11
Copy link
Contributor

@muggenhor muggenhor left a comment

Choose a reason for hiding this comment

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

Thanks for your PR, this looks good!

@ala-ableton
Copy link
Contributor Author

ala-ableton commented May 10, 2019

@muggenhor: thank you for the review! Can you take care of merging this PR, or should we wait for @paoloambrosio to also have a look?

@muggenhor
Copy link
Contributor

muggenhor commented May 13, 2019

I'll probablyintend to merge it somewhere later this week

Copy link
Member

@paoloambrosio paoloambrosio left a comment

Choose a reason for hiding this comment

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

I'm late to the party, but top quality PR! 👍

@muggenhor muggenhor merged commit e7b8f64 into cucumber:master May 25, 2019
@aslakhellesoy
Copy link
Contributor

Hi @ala-ableton,

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

@ala-ableton ala-ableton deleted the fix-regression-on-optional-regex-submatches branch May 27, 2019 08:01
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