Formats a file location for compiler-independent XML output. Although this function is not platform dependent, we put it next to FormatFileLocation in order to contrast the two functions. Note that FormatCompilerIndependentFileLocation() does NOT append colon to the file location it produces, unlike FormatFileLocation().
| 8248 | // Note that FormatCompilerIndependentFileLocation() does NOT append colon |
| 8249 | // to the file location it produces, unlike FormatFileLocation(). |
| 8250 | GTEST_API_ ::std::string FormatCompilerIndependentFileLocation( |
| 8251 | const char* file, int line) { |
| 8252 | const char* const file_name = file == NULL ? kUnknownFile : file; |
| 8253 | |
| 8254 | if (line < 0) |
| 8255 | return file_name; |
| 8256 | else |
| 8257 | return String::Format("%s:%d", file_name, line).c_str(); |
| 8258 | } |
| 8259 | |
| 8260 | |
| 8261 | GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line) |