-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
[7.x] Refactor contain
matcher using Predicate.simple
#573
Conversation
if let actual = try actualExpression.evaluate() { | ||
return items.all { | ||
let matches = items.all { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary in this PR, but wondering if we can rename this to allSatisfy
and make it a compatibility shim for Swift < 4.2? https://github.com/apple/swift-evolution/blob/master/proposals/0207-containsOnly.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally makes sense 👍
return items.all { item in | ||
return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in | ||
guard let actual = try actualExpression.evaluate() else { return .fail } | ||
let matches = items.all { item in | ||
return item != nil && actual.contains(item!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on restructuring this to avoid the force-unwrap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 9bbe098.
Replacing `Predicate.fromDeprecatedClosure`.
380f957
to
9bbe098
Compare
[7.x] Refactor `contain` matcher using `Predicate.simple`
Replacing
Predicate.fromDeprecatedClosure
.