36 #include "gtest/gtest.h"
46 class PrematureExitTest :
public Test {
56 premature_exit_file_path_ =
GetEnv(
"TEST_PREMATURE_EXIT_FILE");
59 if (premature_exit_file_path_ ==
nullptr) {
60 premature_exit_file_path_ =
"";
65 bool PrematureExitFileExists()
const {
69 const char* premature_exit_file_path_;
72 typedef PrematureExitTest PrematureExitDeathTest;
79 TEST_F(PrematureExitDeathTest, FileExistsDuringExecutionOfDeathTest) {
80 if (*premature_exit_file_path_ ==
'\0') {
89 if (PrematureExitFileExists()) {
97 TEST_F(PrematureExitTest, PrematureExitFileExistsDuringTestExecution) {
98 if (*premature_exit_file_path_ ==
'\0') {
103 <<
" file " << premature_exit_file_path_
104 <<
" should exist during test execution, but doesn't.";
109 int main(
int argc,
char **argv) {
115 const char*
const filepath =
GetEnv(
"TEST_PREMATURE_EXIT_FILE");
116 if (filepath !=
nullptr && *filepath !=
'\0') {
119 "File %s shouldn't exist after the test program finishes, but does.",