24,855
社区成员
发帖
与我相关
我的任务
分享
class FooEnvironment : public testing::Environment
{
public:
virtual void SetUp()
{
bool ret = init();
EXPECT_EQ(ret, true);
}
virtual void TearDown()
{
}
protected:
tMiddleBaseCfg base_cfg;
};
int main(int argc, char ** argv)
{
FooEnvironment* foo_env = new FooEnvironment;
testing::AddGlobalTestEnvironment(foo_env);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
virtual void SetUp()
{
EXPECT_EQ(true, false);
}
但是执行结果是这样的
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
..\test\test.cpp(21): error: Expected: true
To be equal to: false
[----------] 2 tests from 集成测试
[ RUN ] 集成测试.1
[ OK ] 集成测试.1 (0 ms)
[ RUN ] 集成测试.2
[ OK ] 集成测试.2 (0 ms)
[----------] 2 tests from 集成测试 (2 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (9 ms total)
[ PASSED ] 2 tests.
[ FAILED ] 0 tests, listed below:
0 FAILED TESTS
虽然提示有error,但是最后汇总信息那里并没有error提示