Adds a TestInfo to the unit test. Arguments: set_up_tc: pointer to the function that sets up the test case tear_down_tc: pointer to the function that tears down the test case test_info: the TestInfo object
| 1062 | // tear_down_tc: pointer to the function that tears down the test case |
| 1063 | // test_info: the TestInfo object |
| 1064 | void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc, |
| 1065 | Test::TearDownTestCaseFunc 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 | GetTestCase(test_info->test_case_name(), |
| 1081 | test_info->type_param(), |
| 1082 | set_up_tc, |
| 1083 | tear_down_tc)->AddTestInfo(test_info); |
| 1084 | } |
| 1085 | |
| 1086 | #if GTEST_HAS_PARAM_TEST |
| 1087 | // Returns ParameterizedTestCaseRegistry object used to keep track of |
nothing calls this directly
no test coverage detected