From 2321b2a6757328bbf30b69af434c28dac3060b83 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Thu, 14 Oct 2010 06:51:27 +0000 Subject: Adds action SaveArgPointee. --- include/gmock/gmock-more-actions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/gmock/gmock-more-actions.h b/include/gmock/gmock-more-actions.h index e418505a..a547a648 100644 --- a/include/gmock/gmock-more-actions.h +++ b/include/gmock/gmock-more-actions.h @@ -36,6 +36,8 @@ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ +#include + #include "gmock/gmock-generated-actions.h" namespace testing { @@ -153,6 +155,14 @@ ACTION_TEMPLATE(SaveArg, *pointer = ::std::tr1::get(args); } +// Action SaveArgPointee(pointer) saves the value pointed to +// by the k-th (0-based) argument of the mock function to *pointer. +ACTION_TEMPLATE(SaveArgPointee, + HAS_1_TEMPLATE_PARAMS(int, k), + AND_1_VALUE_PARAMS(pointer)) { + *pointer = *::std::tr1::get(args); +} + // Action SetArgReferee(value) assigns 'value' to the variable // referenced by the k-th (0-based) argument of the mock function. ACTION_TEMPLATE(SetArgReferee, -- cgit v1.2.3