You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Important note: gMock requires expectations to be set before the mock functions are called, otherwise the behavior is undefined. Do not alternate between calls to EXPECT_CALL() and calls to the mock functions, and do not set any expectations on a mock after passing the mock to an API.
However, googlemock's own unit tests are violating this requirement, thus invoking Undefined Behavior:
Describe the issue
The documentation states:
However, googlemock's own unit tests are violating this requirement, thus invoking Undefined Behavior:
https://github.com/google/googletest/blob/main/googlemock/test/gmock-actions_test.cc#L1472
https://github.com/google/googletest/blob/main/googlemock/test/gmock-actions_test.cc#L1867
https://github.com/google/googletest/blob/main/googlemock/test/gmock-actions_test.cc#L1907
https://github.com/google/googletest/blob/main/googlemock/test/gmock-matchers-arithmetic_test.cc#L1189
https://github.com/google/googletest/blob/main/googlemock/test/gmock-matchers-comparisons_test.cc#L1060
https://github.com/google/googletest/blob/main/googlemock/test/gmock-matchers-containers_test.cc#L1648
https://github.com/google/googletest/blob/main/googlemock/test/gmock-matchers-containers_test.cc#L1776
https://github.com/google/googletest/blob/main/googlemock/test/gmock-matchers-containers_test.cc#L2107
https://github.com/google/googletest/blob/main/googlemock/test/gmock-spec-builders_test.cc#L305
https://github.com/google/googletest/blob/main/googlemock/test/gmock-spec-builders_test.cc#L2422
There are two alternatives moving forward:
Steps to reproduce the problem
N/A
What version of GoogleTest are you using?
trunk
What operating system and version are you using?
N/A
What compiler and version are you using?
N/A
What build system are you using?
N/A
Additional context
No response