Rename MOCK_PROTECT_FUNCTION_SIG to MOCK_PROTECT_SIGNATURE

Shorter and avoids the abbreviation
This commit is contained in:
Alexander Grund 2022-01-25 18:05:06 +01:00
parent 95ec79f8f1
commit df10c59d21
No known key found for this signature in database
GPG key ID: AA48A0760367A42B
5 changed files with 13 additions and 13 deletions

View file

@ -13,8 +13,8 @@ Released -
* Allow auto-deducing signature in `MOCK_METHOD_(NON_)CONST` * Allow auto-deducing signature in `MOCK_METHOD_(NON_)CONST`
* Replaced Boost facilities with std:: equivalents where existing in C++14 * Replaced Boost facilities with std:: equivalents where existing in C++14
* Removed MOCK_*_TPL as they are no longer required, use the non _TPL variant even for templates * Removed MOCK_*_TPL as they are no longer required, use the non _TPL variant even for templates
* Added MOCK_PROTECT_FUNCTION_SIG to pass function signatures with commas in the return type * Added MOCK_PROTECT_SIGNATURE to pass function signatures with commas in the return type
* Remove support for protecting function signatures via BOOST_IDENTITY_TYPE, use MOCK_PROTECT_FUNCTION_SIG instead * Remove support for protecting function signatures via BOOST_IDENTITY_TYPE, use MOCK_PROTECT_SIGNATURE instead
[endsect] [endsect]

View file

@ -221,8 +221,8 @@ namespace member_function_example_8 {
//[ member_function_example_8 //[ member_function_example_8
MOCK_CLASS(mock_class) MOCK_CLASS(mock_class)
{ {
// the signature must be wrapped in MOCK_PROTECT_FUNCTION_SIG if the return type contains a comma // the signature must be wrapped in MOCK_PROTECT_SIGNATURE if the return type contains a comma
MOCK_METHOD(method, 0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>())) MOCK_METHOD(method, 0, MOCK_PROTECT_SIGNATURE(std::map<int, int>()))
}; };
//] //]

View file

@ -19,9 +19,9 @@
#include <type_traits> #include <type_traits>
namespace mock { namespace detail { namespace mock { namespace detail {
/// Used in MOCK_PROTECT_FUNCTION_SIG to unwrap the passed function signature /// Used in MOCK_PROTECT_SIGNATURE to unwrap the passed function signature
template<typename T> template<typename T>
using unwrap_function_sig_t = std::remove_pointer_t<parameter_type_t<T>>; using unwrap_signature_t = std::remove_pointer_t<parameter_type_t<T>>;
}} // namespace mock::detail }} // namespace mock::detail
#define MOCK_HELPER(t) t##_mock(mock::detail::root, BOOST_PP_STRINGIZE(t)) #define MOCK_HELPER(t) t##_mock(mock::detail::root, BOOST_PP_STRINGIZE(t))

View file

@ -24,9 +24,9 @@
/// Define a class deriving from a base class /// Define a class deriving from a base class
#define MOCK_BASE_CLASS(name, ...) struct name : __VA_ARGS__, mock::object, mock::detail::base<__VA_ARGS__> #define MOCK_BASE_CLASS(name, ...) struct name : __VA_ARGS__, mock::object, mock::detail::base<__VA_ARGS__>
/// MOCK_PROTECT_FUNCTION_SIG( signature ) /// MOCK_PROTECT_SIGNATURE( signature )
/// Use this with MOCK_FUNCTION/MOCK_*_METHOD if the return type contains commas /// Use this with MOCK_FUNCTION/MOCK_*_METHOD if the return type contains commas
#define MOCK_PROTECT_FUNCTION_SIG(...) mock::detail::unwrap_function_sig_t<void(__VA_ARGS__)> #define MOCK_PROTECT_SIGNATURE(...) mock::detail::unwrap_signature_t<void(__VA_ARGS__)>
/// MOCK_FUNCTOR( name, signature ) /// MOCK_FUNCTOR( name, signature )
/// Define a callable variable/member /// Define a callable variable/member

View file

@ -312,11 +312,11 @@ BOOST_FIXTURE_TEST_CASE(mock_static_function_is_named, mock_error_fixture)
namespace { namespace {
MOCK_CLASS(round_parenthesized_signature) MOCK_CLASS(round_parenthesized_signature)
{ {
MOCK_METHOD(m0, 0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>()), m0) MOCK_METHOD(m0, 0, MOCK_PROTECT_SIGNATURE(std::map<int, int>()), m0)
MOCK_STATIC_METHOD(m1, 0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>()), m1) MOCK_STATIC_METHOD(m1, 0, MOCK_PROTECT_SIGNATURE(std::map<int, int>()), m1)
MOCK_FUNCTOR(f0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>())); MOCK_FUNCTOR(f0, MOCK_PROTECT_SIGNATURE(std::map<int, int>()));
}; };
MOCK_FUNCTION(fun0, 0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>()), fun0) MOCK_FUNCTION(fun0, 0, MOCK_PROTECT_SIGNATURE(std::map<int, int>()), fun0)
} // namespace } // namespace
namespace { namespace {
@ -363,7 +363,7 @@ MOCK_BASE_CLASS(comma_base, std::map<int, int>)
MOCK_FUNCTION(fun1, 0, void()) MOCK_FUNCTION(fun1, 0, void())
MOCK_FUNCTION(fun2, 0, void(), fun2) MOCK_FUNCTION(fun2, 0, void(), fun2)
MOCK_FUNCTION(fun3, 0, MOCK_PROTECT_FUNCTION_SIG(std::map<int, int>())) MOCK_FUNCTION(fun3, 0, MOCK_PROTECT_SIGNATURE(std::map<int, int>()))
MOCK_FUNCTOR(f_variadic, std::map<int, int>()); MOCK_FUNCTOR(f_variadic, std::map<int, int>());
} // namespace } // namespace