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.
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 expectedexpect(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
andpoll
fortoAlways
andtoNever
. 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.