rollbear / trompeloeil

Header only C++14 mocking framework
Boost Software License 1.0
802 stars 85 forks source link

Wrong Expectaition message #320

Open Thurnheer opened 10 months ago

Thurnheer commented 10 months ago

Instead of reporting a missmatch in the function call it reports a missing function call Expected exhaust.update(Configuration{PERIOD, 5ms}) to be called once, actually never called.

See godbolt link to bug

The only difference in the left version to the right version of the code is line 154 where the right version has the correct expected value and the left version has a wrong value.

Expected behaviour on the left version would be call with wrong arguments

rollbear commented 10 months ago

This is a known problem. Unfortunately I am not sure that it is possible to solve.

When the mismatch happens, it throws an exception. That exception causes the expectation object for the other function to be destroyed, which makes it to be reported as never called.