From df10c59d21f6933d929c0ddf2cfca41376f6fb72 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 25 Jan 2022 18:05:06 +0100 Subject: [PATCH] Rename MOCK_PROTECT_FUNCTION_SIG to MOCK_PROTECT_SIGNATURE Shorter and avoids the abbreviation --- doc/changelog.qbk | 4 ++-- doc/example/reference.cpp | 4 ++-- include/turtle/detail/mock_impl.hpp | 4 ++-- include/turtle/mock.hpp | 4 ++-- test/test_mock.cpp | 10 +++++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/changelog.qbk b/doc/changelog.qbk index df78622..c608e81 100644 --- a/doc/changelog.qbk +++ b/doc/changelog.qbk @@ -13,8 +13,8 @@ Released - * Allow auto-deducing signature in `MOCK_METHOD_(NON_)CONST` * 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 -* Added MOCK_PROTECT_FUNCTION_SIG 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 +* 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_SIGNATURE instead [endsect] diff --git a/doc/example/reference.cpp b/doc/example/reference.cpp index b29a4cf..2b19a4e 100644 --- a/doc/example/reference.cpp +++ b/doc/example/reference.cpp @@ -221,8 +221,8 @@ namespace member_function_example_8 { //[ member_function_example_8 MOCK_CLASS(mock_class) { - // 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())) + // the signature must be wrapped in MOCK_PROTECT_SIGNATURE if the return type contains a comma + MOCK_METHOD(method, 0, MOCK_PROTECT_SIGNATURE(std::map())) }; //] diff --git a/include/turtle/detail/mock_impl.hpp b/include/turtle/detail/mock_impl.hpp index 79f5d59..606568c 100644 --- a/include/turtle/detail/mock_impl.hpp +++ b/include/turtle/detail/mock_impl.hpp @@ -19,9 +19,9 @@ #include 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 - using unwrap_function_sig_t = std::remove_pointer_t>; + using unwrap_signature_t = std::remove_pointer_t>; }} // namespace mock::detail #define MOCK_HELPER(t) t##_mock(mock::detail::root, BOOST_PP_STRINGIZE(t)) diff --git a/include/turtle/mock.hpp b/include/turtle/mock.hpp index c77b560..9e78a4f 100644 --- a/include/turtle/mock.hpp +++ b/include/turtle/mock.hpp @@ -24,9 +24,9 @@ /// Define a class deriving from a base class #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 -#define MOCK_PROTECT_FUNCTION_SIG(...) mock::detail::unwrap_function_sig_t +#define MOCK_PROTECT_SIGNATURE(...) mock::detail::unwrap_signature_t /// MOCK_FUNCTOR( name, signature ) /// Define a callable variable/member diff --git a/test/test_mock.cpp b/test/test_mock.cpp index 51f6620..a61c305 100644 --- a/test/test_mock.cpp +++ b/test/test_mock.cpp @@ -312,11 +312,11 @@ BOOST_FIXTURE_TEST_CASE(mock_static_function_is_named, mock_error_fixture) namespace { MOCK_CLASS(round_parenthesized_signature) { - MOCK_METHOD(m0, 0, MOCK_PROTECT_FUNCTION_SIG(std::map()), m0) - MOCK_STATIC_METHOD(m1, 0, MOCK_PROTECT_FUNCTION_SIG(std::map()), m1) - MOCK_FUNCTOR(f0, MOCK_PROTECT_FUNCTION_SIG(std::map())); + MOCK_METHOD(m0, 0, MOCK_PROTECT_SIGNATURE(std::map()), m0) + MOCK_STATIC_METHOD(m1, 0, MOCK_PROTECT_SIGNATURE(std::map()), m1) + MOCK_FUNCTOR(f0, MOCK_PROTECT_SIGNATURE(std::map())); }; -MOCK_FUNCTION(fun0, 0, MOCK_PROTECT_FUNCTION_SIG(std::map()), fun0) +MOCK_FUNCTION(fun0, 0, MOCK_PROTECT_SIGNATURE(std::map()), fun0) } // namespace namespace { @@ -363,7 +363,7 @@ MOCK_BASE_CLASS(comma_base, std::map) MOCK_FUNCTION(fun1, 0, void()) MOCK_FUNCTION(fun2, 0, void(), fun2) -MOCK_FUNCTION(fun3, 0, MOCK_PROTECT_FUNCTION_SIG(std::map())) +MOCK_FUNCTION(fun3, 0, MOCK_PROTECT_SIGNATURE(std::map())) MOCK_FUNCTOR(f_variadic, std::map()); } // namespace