Reputation: 21510
Is there a way I can mock an rvalue qualified method with gmock? Something like the following?
class Something {
public:
virtual void test() &&;
};
class MockSomething : public Something {
public:
MOCK_METHOD(void, test, (), (&&, override));
};
Trying this seems to give me a bunch of weird compiler errors that complain about, what it looks like, are preprocessed tokens. I can also not figure out how to make the older numbered mocking macros (eg. MOCK_METHOD1
, MOCK_METHOD2
, etc) work...
Thanks!
Upvotes: 2
Views: 511
Reputation: 1692
ref(...) - Marks the method with the reference qualification specified. Required if overriding a method that has reference qualifications. Eg ref(&) or ref(&&).
Source: https://google.github.io/googletest/gmock_cook_book.html
Upvotes: 1