proxygen
gtest_premature_exit_test.cc File Reference
#include <stdio.h>
#include "gtest/gtest.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 110 of file gtest_premature_exit_test.cc.

References testing::internal::posix::GetEnv(), testing::InitGoogleTest(), and RUN_ALL_TESTS().

110  {
111  InitGoogleTest(&argc, argv);
112  const int exit_code = RUN_ALL_TESTS();
113 
114  // Test that the premature-exit file is deleted upon return from
115  // RUN_ALL_TESTS().
116  const char* const filepath = GetEnv("TEST_PREMATURE_EXIT_FILE");
117  if (filepath != NULL && *filepath != '\0') {
118  if (PrematureExitTest::FileExists(filepath)) {
119  printf(
120  "File %s shouldn't exist after the test program finishes, but does.",
121  filepath);
122  return 1;
123  }
124  }
125 
126  return exit_code;
127 }
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:2232
char ** argv
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: gtest.cc:5370
const char * GetEnv(const char *name)
Definition: gtest-port.h:2387