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
| 1053 | // tear_down_tc: pointer to the function that tears down the test case |
| 1054 | // test_info: the TestInfo object |
| 1055 | void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc, |
| 1056 | Test::TearDownTestCaseFunc tear_down_tc, |
| 1057 | TestInfo* test_info) { |
| 1058 | // In order to support thread-safe death tests, we need to |
| 1059 | // remember the original working directory when the test program |
| 1060 | // was first invoked. We cannot do this in RUN_ALL_TESTS(), as |
| 1061 | // the user may have changed the current directory before calling |
| 1062 | // RUN_ALL_TESTS(). Therefore we capture the current directory in |
| 1063 | // AddTestInfo(), which is called to register a TEST or TEST_F |
| 1064 | // before main() is reached. |
| 1065 | if (original_working_dir_.IsEmpty()) { |
| 1066 | original_working_dir_.Set(FilePath::GetCurrentDir()); |
| 1067 | GTEST_CHECK_(!original_working_dir_.IsEmpty()) |
| 1068 | << "Failed to get the current working directory."; |
| 1069 | } |
| 1070 | |
| 1071 | GetTestCase(test_info->test_case_name(), |
| 1072 | test_info->type_param(), |
| 1073 | set_up_tc, |
| 1074 | tear_down_tc)->AddTestInfo(test_info); |
| 1075 | } |
| 1076 | |
| 1077 | #if GTEST_HAS_PARAM_TEST |
| 1078 | // Returns ParameterizedTestCaseRegistry object used to keep track of |
nothing calls this directly
no test coverage detected