From 2ed2211db99ab4f3e4d11078c78ad48a5b692f02 Mon Sep 17 00:00:00 2001 From: Joshua Cannon Date: Mon, 7 Oct 2019 13:56:47 -0500 Subject: Use FormatFileLocation for streaming file and line --- googlemock/src/gmock-spec-builders.cc | 3 ++- googletest/src/gtest-test-part.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index f9d3434..317b8cb 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -34,6 +34,7 @@ // EXPECT_CALL). #include "gmock/gmock-spec-builders.h" +#include "gtest/internal/gtest-port.h" #include #include // NOLINT @@ -70,7 +71,7 @@ GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, const char* file, int line, const std::string& message) { ::std::ostringstream s; - s << file << ":" << line << ": " << message << ::std::endl; + s << internal::FormatFileLocation(file, line) << " " << message << ::std::endl; Log(severity, s.str(), 0); } diff --git a/googletest/src/gtest-test-part.cc b/googletest/src/gtest-test-part.cc index 178317a..9c5bcc6 100644 --- a/googletest/src/gtest-test-part.cc +++ b/googletest/src/gtest-test-part.cc @@ -31,6 +31,7 @@ // The Google C++ Testing and Mocking Framework (Google Test) #include "gtest/gtest-test-part.h" +#include "gtest/internal/gtest-port.h" #include "src/gtest-internal-inl.h" namespace testing { @@ -46,7 +47,7 @@ std::string TestPartResult::ExtractSummary(const char* message) { // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os << result.file_name() << ":" << result.line_number() << ": " + return os << internal::FormatFileLocation(result.file_name(), result.line_number()) << " " << (result.type() == TestPartResult::kSuccess ? "Success" : result.type() == TestPartResult::kSkip -- cgit v0.12