Document how actions store data by copy

This commit is contained in:
Mathieu Champlon 2015-04-08 22:29:31 +02:00
parent 41de7236c4
commit d1e0c96ff3
3 changed files with 30 additions and 4 deletions

View file

@ -798,6 +798,25 @@ BOOST_AUTO_TEST_CASE( demonstrates_configuring_actions )
#endif
namespace action_example_2
{
//[ action_example_2
MOCK_CLASS( mock_class )
{
MOCK_METHOD( method, 0, int&() )
};
BOOST_AUTO_TEST_CASE( demonstrates_configuring_actions_with_references )
{
mock_class c;
int i = 0;
MOCK_EXPECT( c.method ).returns( boost::ref( i ) ); // wrap i to store a reference
c.method() = 42; // really change i and not just the stored copy
BOOST_CHECK_EQUAL( 42, i ); // indeed
}
//]
}
namespace verification_example_1
{
//[ verification_example_1