mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Document how actions store data by copy
This commit is contained in:
parent
41de7236c4
commit
d1e0c96ff3
3 changed files with 30 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue