【发布时间】:2016-11-25 14:22:28
【问题描述】:
我有模拟界面
// Interface
class MyInterface
{
void get(const std::wstring& param) = 0;
}
// Mock interface
class MyInterfaceMock : public MyInterface
{
MOCK_METHOD1(get, void(const std::wstring& param));
}
示例测试方法:
...
EXPECT_CALL(myInterfaceMock, L"hello");
当我编译它时(vs2015)我收到消息
错误 C2664: 'testing::internal::MockSpec...: 无法将参数 1 从 'const wchar_t [6]' 转换为 'const testing::Matcher &'
接着是消息: 原因:无法从 'const wchar_t [7]' 转换为 'const testing::Matcher'
当我使用 std::string 代替 std::wstring 时,一切正常。有人知道为什么 std::wstring 不能匹配吗?
【问题讨论】:
-
什么版本的 google-mock?当前的?
-
我正在使用 gmock-1.6.0
标签: c++ stl googlemock wstring