Removed support for directly mocking a protected member function

Taking a function pointer on a base member protected function is actually invalid.
This could work with a pointer on the derived class member function, that is &derived::method instead of &base::method however there is no way to pass the derived class from MOCK_BASE_CLASS to the mock::detail::base helper if template classes are to be supported.

Anyway the now documented workaround is simple enough and the same as for private member functions.

As a side note the changes from ed36823235 might not be needed any more…
This commit is contained in:
Mathieu Champlon 2018-03-29 15:39:15 +02:00 committed by Mathieu Champlon
parent caef00d2e3
commit 4455222a62
5 changed files with 22 additions and 23 deletions

View file

@ -12,18 +12,21 @@
namespace
{
//[ limitations_private_method_problem
//[ limitations_protected_private_method_problem
class base
{
private:
virtual void method() = 0;
virtual void method_1() = 0;
private:
virtual void method_2() = 0;
};
//]
//[ limitations_private_method_solution
//[ limitations_protected_private_method_solution
MOCK_BASE_CLASS( mock_base, base )
{
MOCK_METHOD( method, 0, void() )
MOCK_METHOD( method_1, 0, void() )
MOCK_METHOD( method_2, 0, void() )
};
//]
}