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

Distinguish between "no match" and "match with no groups" #358

Closed
aslakhellesoy opened this issue Apr 10, 2018 · 3 comments · Fixed by #359
Closed

Distinguish between "no match" and "match with no groups" #358

aslakhellesoy opened this issue Apr 10, 2018 · 3 comments · Fixed by #359
Assignees

Comments

@aslakhellesoy
Copy link
Contributor

I could be wrong, but it seems to me that there is no distinction between "no match":

https://github.com/cucumber/cucumber/blob/662b3662422c5301f685999704d9dd38e6341757/cucumber-expressions/go/regular_expression_test.go#L45-L47

And when there is a match with no groups:

https://github.com/cucumber/cucumber/blob/662b3662422c5301f685999704d9dd38e6341757/cucumber-expressions/go/regular_expression_test.go#L61-L63

The other implementations return null for the former and [] for the latter. How will Cucumber know which case it is if we always get []?

@charlierudolph
Copy link
Member

For the first test we should check if nil, and the second could check not nil built is empty.

require.Nil(t, Match(t, "hello", "world"))
match := Match(t, `Across the line\(s\)`, "Across the line(s)")
require.NotNil(t, match)
require.Empty(t, match)

I'll try adding this today

@charlierudolph
Copy link
Member

I think Empty passes with nil and empty arrays

@lock
Copy link

lock bot commented Apr 10, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants