-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Test with toNever(equal(<non nil value>)) fails on encountering nil #1123
Comments
@younata thanks for your efforts maintaining this project. Noticed this behaviour in 13.2.1. 13.2.0 a test case with above scenario passes. I am unfamiliar with Nimble's codebase to verify if the issue surfaced is an expected behaviour that was fixed in 13.2.1. If so please let me know, I will close this issue. |
toNever(equal(<non nil value>))
fails on encountering nil
toNever(equal(<non nil value>))
fails on encountering niltoNever(equal(<non nil value>))
fails on encountering nil
toNever(equal(<non nil value>))
fails on encountering nil
After thinking on this for a bit, here's my conclusion: This issue is actually that you expect Usually, Considering that Objective-C is not used nearly as much as Swift is, we should probably special-case on Objective-C for the Relatedly, I've been meaning to do a bunch of work so that Matchers have to explicitly declare that they take in Optionals to operate on them (and similarly, that All of this work is a breaking change, and something that will require a new major version. I'm going to close this, and add another issue to specifically re-examine how we treat nils in Nimble. Until then, as a very silly workaround, you could do an inline expression in expect { value ?? "bar" }.toNever(equal("foo")). |
What did you do?
Consider the following unit test
What did you expect to happen?
The test to pass since the expectation set to never be equal to bar is true. Here my intent is to test for value to never equate to 'bar', it becoming nil is also a valid expectation.
What actually happened instead?
Test fails with
If I follow the suggestion from error message, I will greatly alter the intent of the test.
Environment
List the software versions you're using:
Please also mention which package manager you used and its version. Delete the
other package managers in this list:
Project that demonstrates the issue
NimbleIssueDemo.zip
The text was updated successfully, but these errors were encountered: