我有嘲笑接口匹配的std :: wstring的在googlemocks EXPECT_CALL
// Interface
class MyInterface
{
void get(const std::wstring& param) = 0;
}
// Mock interface
class MyInterfaceMock : public MyInterface
{
MOCK_METHOD1(get, void(const std::wstring& param));
}
Exemplaric測試方法:
...
EXPECT_CALL(myInterfaceMock, L"hello");
當我編譯它(vs2015)我得到的消息
錯誤C2664:'testing :: internal :: MockSpec ...:不能將參數1從'const wchar_t [6]'轉換爲'const testing :: Matcher &'
跟消息: 原因:不能從 '常量爲wchar_t [7]' 到 'const的測試::匹配器'
轉換當我使用的std :: string代替的std :: wstring的的一切工作正常。有誰知道爲什麼std :: wstring不能匹配?
什麼版本的google-mock?目前的? – PiotrNycz
我正在使用gmock-1.6.0 – anhoppe