What did you do?
Consider the following unit test
func test_toNever_failingOnNil() async throws {
var sut: String? = "foo"
Task {
sut = nil
}
await expect(sut).toNever(equal("bar"))
}
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
expected to never equal <bar>, got <nil> (use beNil() to match nils)
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:
- Nimble: 13.2.1
- Xcode Version: 15.2 (15C500b)
- Swift Version: 5.9.2
Please also mention which package manager you used and its version. Delete the
other package managers in this list:
- Swift Package Manager: 5.9.0
Project that demonstrates the issue
NimbleIssueDemo.zip
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