cucumber / cucumber-cpp

Support for writing Cucumber step definitions in C++
MIT License
306 stars 131 forks source link

Fix regression on optional regex submatches #221

Closed ala-ableton closed 5 years ago

ala-ableton commented 5 years ago

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 4dec371ca9a379cf762b32e94949d2bd39f2d77e (the parent commit of a7ff906ab379a055f4d9d06e1efdf00fc9434e72) 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

Checklist:

ala-ableton commented 5 years ago

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 commented 5 years ago

Coverage Status

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

ala-ableton commented 5 years ago

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

ala-ableton commented 5 years ago

@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 commented 5 years ago

I'll probablyintend to merge it somewhere later this week

aslakhellesoy commented 5 years ago

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:

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