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 Signal unit test undefined behavior (gmock) #1184

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

DanRStevens
Copy link
Collaborator

Closes #1159

Remove redundant EXPECT_CALL. The implicit Times(1) makes the call with Times(0) redundant.

Removing the redundant call removes undefined behavior caused by setting an expectation after a call to the mock handler.

Split up the unit tests so there is only one expectation per test.

The original `EXPECT_CALL` already has an implicit `Times(1)`, so there is no need for a second `EXPECT_CALL` with an explicit `Times(0)`.

This also removes an `EXPECT_CALL` after a call to a mock handler, which would be undefined behavior. Thus this removes the undefined behavior.
@DanRStevens DanRStevens merged commit f3614d4 into main Jan 2, 2025
8 checks passed
@DanRStevens DanRStevens deleted the fixSignalUnitTestUndefinedBehavior branch January 2, 2025 12:49
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.

Fix undefined behavior using gMock
1 participant