用gmock模拟右值限定方法



有没有一种方法可以用gmock模拟一个右值限定的方法?以下内容?

class Something {
public:
virtual void test() &&;
};
class MockSomething : public Something {
public:
MOCK_METHOD(void, test, (), (&&, override));
};

尝试这样做似乎会给我带来一堆奇怪的编译器错误,这些错误抱怨说,它看起来像是预处理的令牌。我也不知道如何使旧编号的模拟宏(例如MOCK_METHOD1MOCK_METHOD2等(工作。。。

谢谢!

ref(...) - Marks the method with the reference qualification specified. Required if overriding a method that has reference qualifications. Eg ref(&) or ref(&&).

来源:https://google.github.io/googletest/gmock_cook_book.html

最新更新