How to expect program exit in gtest?
问题 I'm testing some code that uses CHECK from glog and I'd like to test that this check fails in certain scenarios. My code looks like: void MyClass::foo() { // stuff... // It's actually important that the binary gets aborted if this flag is false CHECK(some_flag) << "flag must be true"; // more stuff... } I've done some research into gtest and how I might be able to test for this. I found EXPECT_FATAL_FALIURE , EXPECT_NONFATAL_FAILURE , and HAS_FATAL_FAILURE but I haven't managed to figure out