具有R值的方法的样机

时间:2018-07-15 07:01:47

标签: c++11 gmock

我的模拟具有具有r值的方法:

MOCK_METHOD1(createMainWindow, std::shared_ptr<WindowsInterface>(std::unique_ptr<mirror::utils::FileMappingWrapper> &&));

在阅读了这篇文章:Workaround for gmock to support rvalue reference之后,我将其更改为:

std::shared_ptr<WindowsInterface> createMainWindow(std::unique_ptr<mirror::utils::FileMappingWrapper> &&fmw)
{
    return _createMainWindow(fmw);
}
MOCK_METHOD1(_createMainWindow, std::shared_ptr<WindowsInterface>(std::unique_ptr<mirror::utils::FileMappingWrapper> &));

但这给了我一个错误,试图在方法createMainWindow上设置EXPECT_CALL:

error: ‘class testing::Mocks::NCursesWindowsFactoryMock’ has no member named ‘gmock_createMainWindow’; did you mean ‘gmock__createMainWindow’?

有什么想法吗?谢谢

0 个答案:

没有答案