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

Always drop static methods' Expectations during Drop #443

Merged
merged 1 commit into from
Dec 25, 2022

Conversation

asomers
Copy link
Owner

@asomers asomers commented Dec 23, 2022

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
@asomers
Copy link
Owner Author

asomers commented Dec 23, 2022

@DGolubets does this fix your problem?

@DGolubets
Copy link

@asomers Yes, it does. Thanks a lot!

@asomers asomers merged commit 70a89ae into master Dec 25, 2022
@asomers asomers deleted the clear_expectations_on_panic branch December 25, 2022 00:48
asomers added a commit that referenced this pull request Sep 13, 2023
PR #443 ensured that static methods' expectations would be cleared on
Drop.  But it was only tested for methods that paniced due to too few
method calls.  For methods with too many calls it actually introduced a
double-panic.  Double panics are bad; they lead to processes getting
SIGABRT.  This was a regression in Mockall 0.11.4.

Fixes #491
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.

static functions' expectations don't get cleared after a panic.
2 participants