Adds a TestInfo to the unit test. Arguments: set_up_tc: pointer to the function that sets up the test suite tear_down_tc: pointer to the function that tears down the test suite test_info: the TestInfo object
| 1062 | // tear_down_tc: pointer to the function that tears down the test suite |
| 1063 | // test_info: the TestInfo object |
| 1064 | void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc, |
| 1065 | internal::TearDownTestSuiteFunc tear_down_tc, |
| 1066 | TestInfo* test_info) { |
| 1067 | // In order to support thread-safe death tests, we need to |
| 1068 | // remember the original working directory when the test program |
| 1069 | // was first invoked. We cannot do this in RUN_ALL_TESTS(), as |
| 1070 | // the user may have changed the current directory before calling |
| 1071 | // RUN_ALL_TESTS(). Therefore we capture the current directory in |
| 1072 | // AddTestInfo(), which is called to register a TEST or TEST_F |
| 1073 | // before main() is reached. |
| 1074 | if (original_working_dir_.IsEmpty()) { |
| 1075 | original_working_dir_.Set(FilePath::GetCurrentDir()); |
| 1076 | GTEST_CHECK_(!original_working_dir_.IsEmpty()) |
| 1077 | << "Failed to get the current working directory."; |
| 1078 | } |
| 1079 | |
| 1080 | GetTestSuite(test_info->test_suite_name(), test_info->type_param(), |
| 1081 | set_up_tc, tear_down_tc) |
| 1082 | ->AddTestInfo(test_info); |
| 1083 | } |
| 1084 | |
| 1085 | // Returns ParameterizedTestSuiteRegistry object used to keep track of |
| 1086 | // value-parameterized tests and instantiate and register them. |
nothing calls this directly
no test coverage detected