lairworks / nas2d-core

NAS2D is an open source, object oriented 2D game development framework written in portable C++.
http://nas2d.lairworks.com
zlib License
10 stars 6 forks source link

Fix undefined behavior using gMock #1159

Open DanRStevens opened 2 weeks ago

DanRStevens commented 2 weeks ago

https://google.github.io/googletest/gmock_for_dummies.html#expectation-ordering

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.

We have code with interleaved calls to EXPECT_CALL and tested methods in the following files:

Note that this often appears to work, though there is no guarantee it will work.