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][NMBObjCMatcher] Use NMBPredicate #546
Conversation
242bfbd
to
c3c452b
Compare
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.
When you say "internal API migrations" I'm a little uncertain what you mean — aren't these public API? If you could elaborate on how this makes migration easier I'd love to understand.
return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) | ||
@objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBPredicate { | ||
return NMBPredicate { actualExpression in | ||
return try! beAKindOf(expected).satisfies(actualExpression).toObjectiveC() |
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.
Curious, can this closure be throwing? Would be nice to replace try!
with try
(although I'm not familiar with the possible failures here).
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.
Let's revisit that in a separate PR (targeting to master
branch).
Does
|
While those are public API surfaces, the point is to change those implementations (yes it's privete, implementation detail) to avoid using deperecated |
@@ -32,10 +32,10 @@ public func > (lhs: Expectation<NMBComparable>, rhs: NMBComparable?) { | |||
|
|||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) | |||
extension NMBObjCMatcher { | |||
@objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { | |||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in | |||
@objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBPredicate { |
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.
Ok so from what I can tell NMBObjCMatcher
and NMBPredicate
are separate classes that both conform to NMBMatcher
— so it should be non-source-breaking to replace NMBMatcher
with NMBPredicate
(more specific return type), but it's technically breaking to replace NMBObjCMatcher
with NMBPredicate
, because they don't share a common base class other than NSObject
. (Let me know if I'm missing something.)
It's probably unlikely to be a big deal, but worth considering.
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.
Hmm it's unfortunate that the NMBObjcMatcher
are exposed here instead of NMBMatcher
. I'm okay to exclude them in this PR.
c3c452b
to
8df083c
Compare
It turns out that actually those API changes were partially done in v7.0.1 (#428, 4f0dab8). |
8df083c
to
cb5e28b
Compare
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.
Current state of this looks good to me 👍
Thank you so much! |
[7.x][NMBObjCMatcher] Use NMBPredicate
This is
internalnon-breaking, implementations migrations for some public APIs.