diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2017-08-14 15:29:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-14 15:29:51 -0700 |
commit | 08b1a1f73cec48481ec3e477e8c247e7aa534df5 (patch) | |
tree | 7d9b6428b2661baf08c8e50bbd9fa2eac6b54816 /googlemock/docs/CookBook.md | |
parent | 3f3a3ada2022a8b4255b408ef5d2ab439e987c08 (diff) | |
parent | e0fc65c5fbfe4e50a0369d032e9b2811b4b7db77 (diff) | |
download | googletest-08b1a1f73cec48481ec3e477e8c247e7aa534df5.tar.gz googletest-08b1a1f73cec48481ec3e477e8c247e7aa534df5.tar.bz2 googletest-08b1a1f73cec48481ec3e477e8c247e7aa534df5.zip |
Merge branch 'master' into master
Diffstat (limited to 'googlemock/docs/CookBook.md')
-rw-r--r-- | googlemock/docs/CookBook.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/googlemock/docs/CookBook.md b/googlemock/docs/CookBook.md index 34387c0e..6ea7f3a9 100644 --- a/googlemock/docs/CookBook.md +++ b/googlemock/docs/CookBook.md @@ -18,8 +18,9 @@ You must always put a mock method definition (`MOCK_METHOD*`) in a `public:` section of the mock class, regardless of the method being mocked being `public`, `protected`, or `private` in the base class. This allows `ON_CALL` and `EXPECT_CALL` to reference the mock function -from outside of the mock class. (Yes, C++ allows a subclass to change -the access level of a virtual function in the base class.) Example: +from outside of the mock class. (Yes, C++ allows a subclass to specify +a different access level than the base class on a virtual function.) +Example: ``` class Foo { @@ -1681,7 +1682,7 @@ This also works when the argument is an output iterator: ``` using ::testing::_; -using ::testing::SeArrayArgument; +using ::testing::SetArrayArgument; class MockRolodex : public Rolodex { public: @@ -2366,7 +2367,7 @@ Now there’s one topic we haven’t covered: how do you set expectations on `Sh // When one calls ShareBuzz() on the MockBuzzer like this, the call is // forwarded to DoShareBuzz(), which is mocked. Therefore this statement // will trigger the above EXPECT_CALL. - mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal), + mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal), ::base::Now()); ``` @@ -2405,7 +2406,7 @@ Now, the mock `DoShareBuzz()` method is free to save the buzz argument for later ``` std::unique_ptr<Buzz> intercepted_buzz; EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _)) - .WillOnce(Invoke([&intercepted_buzz](Buzz* buzz, Time timestamp) { + .WillOnce(Invoke([&intercepted_buzz](Buzz* buzz, Time timestamp) { // Save buzz in intercepted_buzz for analysis later. intercepted_buzz.reset(buzz); return false; |