-
Notifications
You must be signed in to change notification settings - Fork 69
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
static functions' expectations don't get cleared after a panic. #442
Comments
This happens because Mockall tries to avoid double-panicing. If a thread is already panicing, then we don't attempt to verify that all expectations have been satisfied. However, that has a side effect of not clearing expectations after a panic. You never would've noticed this behavior if you'd been using the standard Mutex, because subsequent tests would've gotten a PoisonError. But apparently you're using the unpoisonable Mutex from the example. I'll fix it. |
Even if a panic is in-progress. Originally we didn't drop them during panic, for fear of double-panicing. But there is already protection from double-panic in Common::drop. Not clearing expectations during a panic can cause surprising failures in one test case after a different test case panics. Fixes #442
Even if a panic is in-progress. Originally we didn't drop them during panic, for fear of double-panicing. But there is already protection from double-panic in Common::drop. Not clearing expectations during a panic can cause surprising failures in one test case after a different test case panics. Fixes #442
Even if a panic is in-progress. Originally we didn't drop them during panic, for fear of double-panicing. But there is already protection from double-panic in Common::drop. Not clearing expectations during a panic can cause surprising failures in one test case after a different test case panics. Fixes #442
I have an issue using mocks for static methods.
I was able to reproduce it with a slight modification of the tests (https://github.com/asomers/mockall/blob/master/mockall/examples/synchronization.rs):
returning
withreturn_once
.MockThing::one: Expectation(<anything>) called twice, but it returns by move
The text was updated successfully, but these errors were encountered: