-
Notifications
You must be signed in to change notification settings - Fork 213
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
Create containsAllIn matcher #2369
Comments
On thing that makes this tricky is that to match the semantics of other Iterable matchers in this package we'd want to support some looseness which means that a given element in the checked value could match more than one element of the expectation.
My first greedy approach to solve this didn't work since the |
looks like |
Closes #72 - Add `mustMatchEveryValue` to the implementation for unordered matches. - Implement containsAll as an unorderedMatches which does allows extra values in the checked iterable.
Closes #72 - Add `allowUnmatchedValues` to the implementation for unordered matches. - Implement containsAll as an unorderedMatches which does allows extra values in the checked iterable.
Thanks for the quick fix, Nate! :-) |
Closes dart-lang/matcher#72 - Add `allowUnmatchedValues` to the implementation for unordered matches. - Implement containsAll as an unorderedMatches which does allows extra values in the checked iterable.
One of the matchers I use often in Java's truth library is "containsAllIn". I've found myself needing something like this in Dart a few times now.
A comparison of matchers in Truth vs. this package (credit @natebosch):
containsExactlyElementsIn(...)
->unorderedEquals(...)
containsExactlyElementsIn(...).inOrder()
->orderedEquals(...)
containsAll(Iterable matchers)
=>allOf(matchers.map(contains).toList())
containsAllOf(...).inOrder()
->containsAllInOrder(...)
containsAllIn
-> Does not existThe text was updated successfully, but these errors were encountered: