summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorAaron Jacobs <jacobsa@google.com>2022-05-11 03:08:19 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-05-11 03:08:51 (GMT)
commit6386897feb0a3f4fbe104fe1fa4570ec8158d9e5 (patch)
treecb6d08bbb74311f40fb3784b50c60b8478ee0ab6 /googlemock
parentbda85449f48f2d80a494c8c07766b6aba3170f3b (diff)
downloadgoogletest-6386897feb0a3f4fbe104fe1fa4570ec8158d9e5.zip
googletest-6386897feb0a3f4fbe104fe1fa4570ec8158d9e5.tar.gz
googletest-6386897feb0a3f4fbe104fe1fa4570ec8158d9e5.tar.bz2
gmock-actions: make OnceAction public.
So that it can be referenced in conversion operators for actions that need to know the concrete return type. PiperOrigin-RevId: 447889344 Change-Id: I643d3298bc8effd08741282a956c221f9d67d378
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/include/gmock/gmock-actions.h14
-rw-r--r--googlemock/test/gmock-actions_test.cc2
2 files changed, 8 insertions, 8 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index c83a99a..e022c12 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -322,16 +322,18 @@ struct is_callable_r_impl<void_t<call_result_t<F, Args...>>, R, F, Args...>
template <typename R, typename F, typename... Args>
using is_callable_r = is_callable_r_impl<void, R, F, Args...>;
+} // namespace internal
+
// Specialized for function types below.
template <typename F>
class OnceAction;
// An action that can only be used once.
//
-// This is what is accepted by WillOnce, which doesn't require the underlying
-// action to be copy-constructible (only move-constructible), and promises to
-// invoke it as an rvalue reference. This allows the action to work with
-// move-only types like std::move_only_function in a type-safe manner.
+// This is accepted by WillOnce, which doesn't require the underlying action to
+// be copy-constructible (only move-constructible), and promises to invoke it as
+// an rvalue reference. This allows the action to work with move-only types like
+// std::move_only_function in a type-safe manner.
//
// For example:
//
@@ -501,8 +503,6 @@ class OnceAction<Result(Args...)> final {
std::function<Result(Args...)> function_;
};
-} // namespace internal
-
// When an unexpected function call is encountered, Google Mock will
// let it return a default value if the user has specified one for its
// return type, or if the return type has a built-in default value;
@@ -742,7 +742,7 @@ class Action<R(Args...)> {
// An action can be used as a OnceAction, since it's obviously safe to call it
// once.
- operator internal::OnceAction<F>() const { // NOLINT
+ operator OnceAction<F>() const { // NOLINT
// Return a OnceAction-compatible callable that calls Perform with the
// arguments it is provided. We could instead just return fun_, but then
// we'd need to handle the IsDoDefault() case separately.
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index db112f1..7313b78 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -1920,7 +1920,7 @@ TEST(MockMethodTest, ActionSwallowsAllArguments) {
struct ActionWithTemplatedConversionOperators {
template <typename... Args>
- operator internal::OnceAction<int(Args...)>() && { // NOLINT
+ operator OnceAction<int(Args...)>() && { // NOLINT
return [] { return 17; };
}