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

Fixes expectation regression & failure bugs. #428

Merged
merged 7 commits into from Jun 6, 2017

Conversation

jeffh
Copy link
Member

@jeffh jeffh commented May 16, 2017

What's left:

Fix the failure cases that the failsWithErrorMessage fix reveals in NMBObjCMatcher. NMBObjCMatcher will need the same trinary behavior that Predicate has.

@@ -15,8 +15,8 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line:
var foundFailureMessage = false

for assertion in recorder.assertions {
lastFailure = assertion
if assertion.message.stringValue == msg {
if assertion.message.stringValue == msg && !assertion.success {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Where Violation: where clauses are preferred over a single if inside a for. (for_where)

}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

}
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

}
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

}
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

}.requireNonNil
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

/// error of the specified type
public func matchError<T: Error>(_ errorType: T.Type) -> Predicate<Error> {
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
let actualError: Error? = try actualExpression.evaluate()

setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType)
return errorMatchesNonNilFieldsOrClosure(actualError, errorType: errorType)
var matches = false
if let _ = actualError as? T {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Optional Binding Violation: Prefer != nil over let _ = (unused_optional_binding)

let location = actualExpression.location
let actualValue = try! actualExpression.evaluate()
failureMessage.postfixMessage = "be empty"


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

jeffh added 6 commits June 3, 2017 11:08
 - Fix regression where `expect(nil as [String]?).toEventuallyNot(beNil())` fails. (Closes Quick#424)
 - Fix bug in Nimble's internal failure checker: `failsWithErrorMessage`. (Closes Quick#425). Shout out to @chamander for finding the bug.
 - Fix `Error` failing to dispatch to `Equatable` equality checking (instead of `NSError`).

What's left:

Fix the failure cases that the `failsWithErrorMessage` fix reveals in `NMBObjCMatcher`. `NMBObjCMatcher` will need the same trinary behavior that `Predicate` has.
@jeffh jeffh changed the title WIP: Fixes expectation regression & failure bugs. Fixes expectation regression & failure bugs. Jun 3, 2017
@jeffh jeffh merged commit 660b1a4 into Quick:master Jun 6, 2017
@jeffh jeffh deleted the expectation-regression branch June 6, 2017 05:08
@jeffh jeffh modified the milestone: v7.0.2 (Next Release) Jul 18, 2017
Megal pushed a commit to Megal/Nimble that referenced this pull request Jul 31, 2019
Fixes expectation regression & failure bugs.
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.

Expectations are not behaving as expected! toEventuallyNot passes when it should not on Nimble 7.0.0
2 participants