小编ste*_*ves的帖子

使用googlemock时出现SEH异常

我开始使用googlemock与googletest,但我得到了一个我无法弄清楚的SEH例外.

错误消息是:

unknown file: error: SEH exception with code 0xc0000005 thrown in the test body.
Run Code Online (Sandbox Code Playgroud)

我已经在SO和其他地方读过一些类似的问题,但我还没有找到这样一个简单例子的答案.

即这发生在我的真实代码上,但我也在下面这个非常简单的例子中重现了错误.我正在使用MSVC2008构建.

重现错误的代码:

#include "gtest/gtest.h"
#include "gmock/gmock.h"

#include <iostream>

using testing::Exactly;

class Production
{
public:
    virtual ~Production() {};
    virtual void fn() = 0;
};

class ProductionCode : public Production
{
public:
    virtual ~ProductionCode() {};
    void fn() 
    {
        std::cout << "CALLED ProductionCode::fn" << std::endl;
    }
};

class MockProduction : public Production
{
public:
    virtual ~MockProduction() {};
    MOCK_METHOD0(fn, void());
};

class ProductionUser
{
public:
    void methodUnderTest(Production *p) …
Run Code Online (Sandbox Code Playgroud)

c++ googlemock

7
推荐指数
1
解决办法
7483
查看次数

标签 统计

c++ ×1

googlemock ×1