| 14 | #include <algorithm> |
| 15 | |
| 16 | CTestInfo::CTestInfo() |
| 17 | { |
| 18 | const ::testing::TestInfo *pTestInfo = |
| 19 | ::testing::UnitTest::GetInstance()->current_test_info(); |
| 20 | |
| 21 | // Typed tests have test names like "TestName/0" and "TestName/1", which would result in invalid filenames. |
| 22 | // Replace the string after the first slash with the name of the typed test and use hyphen instead of slash. |
| 23 | char aTestCaseName[128]; |
| 24 | str_copy(aTestCaseName, pTestInfo->test_case_name()); |
| 25 | for(int i = 0; i < str_length(aTestCaseName); i++) |
| 26 | { |
| 27 | if(aTestCaseName[i] == '/') |
| 28 | { |
| 29 | aTestCaseName[i] = '-'; |
| 30 | aTestCaseName[i + 1] = '\0'; |
| 31 | str_append(aTestCaseName, pTestInfo->type_param()); |
| 32 | break; |
| 33 | } |
| 34 | } |
| 35 | str_format(m_aFilenamePrefix, sizeof(m_aFilenamePrefix), "%s.%s-%d", |
| 36 | aTestCaseName, pTestInfo->name(), process_id()); |
| 37 | Filename(m_aFilename, sizeof(m_aFilename), ".tmp"); |
| 38 | } |
| 39 | |
| 40 | void CTestInfo::Filename(char *pBuffer, size_t BufferLength, const char *pSuffix) |
| 41 | { |
nothing calls this directly
no test coverage detected