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

#1184 Add shouldHaveSingleElement matcher with predicate #1186

Merged
merged 5 commits into from
Feb 9, 2020
Merged

#1184 Add shouldHaveSingleElement matcher with predicate #1186

merged 5 commits into from
Feb 9, 2020

Conversation

simonenkoi
Copy link
Contributor

Closes: #1184

@sksamuel
Copy link
Member

sksamuel commented Feb 3, 2020

Thansk for the PR. I was thinking more that this matcher would not use the lambda to test for one element that passes the predicate (but allows more), but that there's a single element and then executes the lambda. What do you think?

@simonenkoi
Copy link
Contributor Author

Yes, it makes perfect sense and seems usable. I think if it was confusing for me from the ticket's description, it can be confusing for users too. Can we think about better naming?
Maybe it makes more sense to extend shouldBeSingleton matcher with a lambda parameter?

@sksamuel
Copy link
Member

sksamuel commented Feb 3, 2020 via email

@simonenkoi
Copy link
Contributor Author

@sksamuel I've added a new matcher shouldBeSingleton { block } to keep it consistent. Please, let me know if you insist on shouldBeSingleElement naming. Should I revert shouldHaveSingleElement { predicate } matcher changes?

…o feature/1184-add-should-have-single-element-matcher-with-predicate
@sksamuel
Copy link
Member

sksamuel commented Feb 9, 2020

Lets go with your naming.

@sksamuel sksamuel merged commit 0421f55 into kotest:master Feb 9, 2020
@simonenkoi simonenkoi deleted the feature/1184-add-should-have-single-element-matcher-with-predicate branch February 16, 2020 09:20
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.

New collections matcher
2 participants