Implements ReturnPointee() and ReturnRefOfCopy().

This commit is contained in:
zhanyong.wan
2010-07-03 00:16:42 +00:00
parent 02c1505ebf
commit e3bd0981ca
4 changed files with 95 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ using testing::DeleteArg;
using testing::Invoke;
using testing::Return;
using testing::ReturnArg;
using testing::ReturnPointee;
using testing::SaveArg;
using testing::SetArgReferee;
using testing::SetArgumentPointee;
@@ -664,5 +665,14 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithIteratorArgument) {
EXPECT_EQ(letters, s);
}
TEST(ReturnPointeeTest, Works) {
int n = 42;
const Action<int()> a = ReturnPointee(&n);
EXPECT_EQ(42, a.Perform(make_tuple()));
n = 43;
EXPECT_EQ(43, a.Perform(make_tuple()));
}
} // namespace gmock_generated_actions_test
} // namespace testing