c ++ googletest处理try-block中的异常

时间:2015-10-08 06:17:13

标签: c++ googletest

当我使用这样的结构启动我的gtest项目时,代码总是在throw语句处中断,就好像没有try-catch一样。 有没有办法改变行为以便在catch-block中继续?

DELETE FROM wp_posts WHERE post_type = 'product' AND date < '2015-09-24 11:00:00'

1 个答案:

答案 0 :(得分:0)

void errornousFunction()
{
    try 
    {
        int i = 5;
        throw i;
    }
    catch ( ... )
    {
        int i = 5;
    }
}

然后你可以尝试