vmcpherson / googlemock

Automatically exported from code.google.com/p/googlemock
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CheatSheet tweak for showing how to do the mock #108

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Change the CheatSheet where you show the mock example:
template <typename Elem>
class MockStack : public StackInterface<Elem> {
  ...
  MOCK_CONST_METHOD0_T(GetSize, int());
  MOCK_METHOD1_T(Push, void(const Elem& x));
};

and make sure to put public: in there. eg:

template <typename Elem>
class MockStack : public StackInterface<Elem> {
public:
  ...
  MOCK_CONST_METHOD0_T(GetSize, int());
  MOCK_METHOD1_T(Push, void(const Elem& x));
};

otherwise you get private mock methods. I had no idea what the macros did
and didn't konw if they did magic with scoping.

The Dummies page says this in the text and the example but I didn't think I
was a dummy.

Original issue reported on code.google.com by mr.ga...@gmail.com on 14 Apr 2010 at 1:46

GoogleCodeExporter commented 9 years ago

Original comment by w...@google.com on 14 Apr 2010 at 5:37