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

Remove BasicMatcher and NonNilBasicMatcher #109

Closed
modocache opened this issue Mar 16, 2015 · 0 comments · Fixed by #124
Closed

Remove BasicMatcher and NonNilBasicMatcher #109

modocache opened this issue Mar 16, 2015 · 0 comments · Fixed by #124

Comments

@modocache
Copy link
Member

See the discussion for details: #95 (comment)

Basically, implementing "meta-matchers" (matchers that are composed from other matchers, like allPass() and Guanaco's haveSucceeded() and haveFailed() is made difficult by the fact that matchers could be one of three distinct, unrelated types: Matcher, BasicMatcher, and NonNilBasicMatcher.

It should be easy to define a function that takes a matcher without defining three signatures, like allPass() does:

public func allPass<U,V where U: SequenceType, V: NonNilBasicMatcher, U.Generator.Element == V.ValueType>(matcher: V) -> NonNilMatcherFunc<U>
public func allPass<U,V where U: SequenceType, V: BasicMatcher, U.Generator.Element == V.ValueType>(matcher: V) -> NonNilMatcherFunc<U>
public func allPass<U,V where U: SequenceType, V: Matcher, U.Generator.Element == V.ValueType>(matcher: V) -> NonNilMatcherFunc<U>

In the linked discussion, @jeffh elaborates:

Yeah, there needs to be some changes to simplify the internals. I think the removal of BasicMatcher and NonNilBasicMatcher would be preferred in some way. There also needs a reinvestigation if the Swift compiler still gives an obscure message when a generic does match optionals. Having the matcher be able to specify that while Nimble's expectation and matcher protocols be ignorant of that detail would be best.

jeffh added a commit that referenced this issue May 1, 2015
Breaking Changes:
- `FullMatcherFunc` requires inverting `doesNotMatch`
- Removed `BasicMatcher` and `NonNilBasicMatcher` protocols.
- `MatcherFunc` implements `Matcher` protocol
- `NonNilMatcherFunc` implemented `Matcher` protocol. This also now checks for nil-ness instead of a wrapper.
- Removed `fullMatcherFromBasicMatcher` and `basicMatcherWithFailureMessage`
- Removed most matcher wrappers: `NonNilBasicMatcherWrapper`, `NonNilMatcherWrapper`, `BasicMatcherWrapper`, `FullMatcherWrapper`

Internal Changes:
- Added `expectTo` and `expectToNot` which is most of the internal implementation of `Expectation.to` and `Expectation.toNot`.
- Matchers no longer need to know about wrappers for Objective-C support.
- Removed redundant `allPass` implementations

All the public matchers remain unchanged from the normal consumer
perspective.

I'd like feedback on this PR.

Closes #109.
@jeffh jeffh closed this as completed in #124 May 3, 2015
phatblat pushed a commit to phatblat/Nimble that referenced this issue May 3, 2020
Adds conditional support for falling back to XCTest-style names of tests.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant