Formats a source file path and a line number as they would appear in an error message from the compiler used to compile this code.
| 8230 | // Formats a source file path and a line number as they would appear |
| 8231 | // in an error message from the compiler used to compile this code. |
| 8232 | GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) { |
| 8233 | const char* const file_name = file == NULL ? kUnknownFile : file; |
| 8234 | |
| 8235 | if (line < 0) { |
| 8236 | return String::Format("%s:", file_name).c_str(); |
| 8237 | } |
| 8238 | #ifdef _MSC_VER |
| 8239 | return String::Format("%s(%d):", file_name, line).c_str(); |
| 8240 | #else |
| 8241 | return String::Format("%s:%d:", file_name, line).c_str(); |
| 8242 | #endif // _MSC_VER |
| 8243 | } |
| 8244 | |
| 8245 | // Formats a file location for compiler-independent XML output. |
| 8246 | // Although this function is not platform dependent, we put it next to |
no test coverage detected