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

Fix bug where expect(nil).toAlways(equal(0)) would erroneously pass #1121

Merged

Conversation

younata
Copy link
Member

@younata younata commented Feb 24, 2024

Fixes #1120

expect(nil).toAlways(equal(0)) would erroneously pass. Interestingly, expect(1).toAlways(equal(0)) would correctly fail. Given what changed here, I would have expected expect(1).toAlways(equal(0)) to erroneously pass as well. Yet that matcher correctly fails without this PR. 🤷🏻‍♀️

I don't quite know why nil is special here, I think it's related to an inversion in the ExpectationStyle as passed to execute and poll for toAlways and toNever. But I'm not 100% certain.

So, this fixes that refactor, and also adds logic to catch that the continuous polling matchers (toAlways/toNever) should immediately fail if the matcher doesn't match. Just to be certain there.

Minor version bump on release.

@younata younata force-pushed the bugfix/toNever_toAlways_should_immediately_fail_if_matcher_fails branch from 9d197e5 to 592ea7e Compare February 24, 2024 18:14
@younata younata merged commit 0a14466 into main Feb 25, 2024
15 checks passed
@younata younata deleted the bugfix/toNever_toAlways_should_immediately_fail_if_matcher_fails branch February 25, 2024 06:22
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Feb 26, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [Quick/Nimble](https://togithub.com/Quick/Nimble) | patch | `from:
"13.2.0"` -> `from: "13.2.1"` |

---

### Release Notes

<details>
<summary>Quick/Nimble (Quick/Nimble)</summary>

### [`v13.2.1`](https://togithub.com/Quick/Nimble/releases/tag/v13.2.1)

[Compare
Source](https://togithub.com/Quick/Nimble/compare/v13.2.0...v13.2.1)

Note: This version is not yet available in Cocoapods.

#### What's Changed

- Bump cocoapods from 1.14.3 to 1.15.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/Quick/Nimble/pull/1116](https://togithub.com/Quick/Nimble/pull/1116)
- Bump cocoapods from 1.15.0 to 1.15.2 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/Quick/Nimble/pull/1119](https://togithub.com/Quick/Nimble/pull/1119)
- Fix bug where expect(nil).toAlways(equal(0)) would erroneously pass by
[@&#8203;younata](https://togithub.com/younata) in
[https://github.com/Quick/Nimble/pull/1121](https://togithub.com/Quick/Nimble/pull/1121)

**Full Changelog**:
Quick/Nimble@v13.2.0...v13.2.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
noamfreeman pushed a commit to noamfreeman/Nimble that referenced this pull request Oct 14, 2024
…uick#1121)

* Fix bug where expect(nil).toAlways(equal(0)) would erroneously pass

* Work with earlier versions of swift
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.

expect(nil).toAlways(equal(0)) incorrectly succeeds
1 participant