Remove usage of BOOST_IDENTITY_TYPE from official docs

Replaced by MOCK_PROTECT_FUNCTION_SIG
This commit is contained in:
Alexander Grund 2022-01-25 16:07:19 +01:00
parent 374482367f
commit 51fcd4f4b9
No known key found for this signature in database
GPG key ID: AA48A0760367A42B

View file

@ -225,11 +225,20 @@ namespace member_function_example_8 {
//[ member_function_example_8
MOCK_CLASS(mock_class)
{
MOCK_METHOD(
method, 0, BOOST_IDENTITY_TYPE((std::map<int, int>()))) // the signature must be wrapped in BOOST_IDENTITY_TYPE if
// the return type contains a comma
// the signature must be wrapped in MOCK_PROTECT_FUNCTION_SIG if the return type contains a comma
MOCK_METHOD(method, 0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>()))
};
//]
MOCK_CLASS(legacy_mock_class)
{
MOCK_METHOD(method, 0, BOOST_IDENTITY_TYPE((std::map<int, int>())))
};
static_assert(std::is_same<decltype(std::declval<mock_class>().method()), std::map<int, int>>::value,
"Wrong return value");
static_assert(std::is_same<decltype(std::declval<legacy_mock_class>().method()), std::map<int, int>>::value,
"Wrong return value");
} // namespace member_function_example_8
#ifdef BOOST_MSVC