tesseract v5.3.3.20231005
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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 109 of file gtest_premature_exit_test.cc.

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