【发布时间】:2022-07-26 10:05:31
【问题描述】:
static bool helper(int a){
// do something here
return true;
}
class ProxyMock : public Proxy
{
public:
MOCK_METHOD1(functionA, bool(
int a
));
};
TEST(xxx, xxx){
ProxyMock mock;
int a;
EXPECT_CALL(mock, functionA(5)).WillOnce(testing::Invoke(helper(a));
}
当使用参数(5)调用模拟对象的functionA时,我想调用一个静态全局函数helper,它接受我想要的参数。
编译时出现错误:
'function' cannot be used as a function 在EXPECT_CALL 行中。怎么了?
【问题讨论】:
-
错误信息是否更详细?
标签: c++ googletest googlemock