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.
| 977 | // Formats a source file path and a line number as they would appear |
| 978 | // in an error message from the compiler used to compile this code. |
| 979 | GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) { |
| 980 | const std::string file_name(file == nullptr ? kUnknownFile : file); |
| 981 | |
| 982 | if (line < 0) { |
| 983 | return file_name + ":"; |
| 984 | } |
| 985 | #ifdef _MSC_VER |
| 986 | return file_name + "(" + StreamableToString(line) + "):"; |
| 987 | #else |
| 988 | return file_name + ":" + StreamableToString(line) + ":"; |
| 989 | #endif // _MSC_VER |
| 990 | } |
| 991 | |
| 992 | // Formats a file location for compiler-independent XML output. |
| 993 | // Although this function is not platform dependent, we put it next to |
no test coverage detected