eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.22k stars 170 forks source link

Fix msvc Spy() and destructor mocking #312

Closed FranckRJ closed 1 year ago

FranckRJ commented 1 year ago

Should close #54, #131 and #279.

Basically we call some member function like memberPtr(instance) at some places instead of doing (instance->*memberPtr)(). It worked with GCC / Clang but not with MSVC (sometimes it worked but it wasn't 100% reliable). Two of these places where when spying functions and mocking destructors. I removed these to use the correct form of calling instead.

I found one more usage of the wrong form of calling, it's for the default destructor (and only for MSVC), but because it's a member function that takes no argument and return nothing and do nothing it seems to be fine.

coveralls commented 1 year ago

Coverage Status

Coverage: 99.925% (+0.0001%) from 99.925% when pulling f26afcccde3c93db1cf352a23b7683bceef72c3d on fix-msvc-spy-and-dtor-mock into 0cb7a755b9fa762867b8794ef7a1134e751338db on dev.

FranckRJ commented 1 year ago

I'll merge this ASAP because it blocking for improving the CI (can't launch MSVC tests).

malcolmdavey commented 1 year ago

Thanks. I didn't get to the bottom of those issues myself