Commit 7cc548dc authored by Billy Donahue's avatar Billy Donahue Committed by GitHub
Browse files

Merge pull request #1089 from nico/stdstring

Use std::string and ::string explicitly in gtest and gmock code.
parents 078d5d93 09fd5b3e
...@@ -883,11 +883,10 @@ class ExecDeathTest : public ForkingDeathTest { ...@@ -883,11 +883,10 @@ class ExecDeathTest : public ForkingDeathTest {
ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { } ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
virtual TestRole AssumeRole(); virtual TestRole AssumeRole();
private: private:
static ::std::vector<testing::internal::string> static ::std::vector<std::string> GetArgvsForDeathTestChildProcess() {
GetArgvsForDeathTestChildProcess() { ::std::vector<std::string> args = GetInjectableArgvs();
::std::vector<testing::internal::string> args = GetInjectableArgvs();
# if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) # if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
::std::vector<testing::internal::string> extra_args = ::std::vector<std::string> extra_args =
GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_(); GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_();
args.insert(args.end(), extra_args.begin(), extra_args.end()); args.insert(args.end(), extra_args.begin(), extra_args.end());
# endif // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) # endif // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
......
...@@ -426,7 +426,7 @@ class OsStackTraceGetterInterface { ...@@ -426,7 +426,7 @@ class OsStackTraceGetterInterface {
// in the trace. // in the trace.
// skip_count - the number of top frames to be skipped; doesn't count // skip_count - the number of top frames to be skipped; doesn't count
// against max_depth. // against max_depth.
virtual string CurrentStackTrace(int max_depth, int skip_count) = 0; virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0;
// UponLeavingGTest() should be called immediately before Google Test calls // UponLeavingGTest() should be called immediately before Google Test calls
// user code. It saves some information about the current stack that // user code. It saves some information about the current stack that
...@@ -446,7 +446,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface { ...@@ -446,7 +446,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
public: public:
OsStackTraceGetter() {} OsStackTraceGetter() {}
virtual string CurrentStackTrace(int max_depth, int skip_count); virtual std::string CurrentStackTrace(int max_depth, int skip_count);
virtual void UponLeavingGTest(); virtual void UponLeavingGTest();
private: private:
...@@ -1040,21 +1040,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { ...@@ -1040,21 +1040,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
virtual ~AbstractSocketWriter() {} virtual ~AbstractSocketWriter() {}
// Sends a string to the socket. // Sends a string to the socket.
virtual void Send(const string& message) = 0; virtual void Send(const std::string& message) = 0;
// Closes the socket. // Closes the socket.
virtual void CloseConnection() {} virtual void CloseConnection() {}
// Sends a string and a newline to the socket. // Sends a string and a newline to the socket.
void SendLn(const string& message) { void SendLn(const std::string& message) { Send(message + "\n"); }
Send(message + "\n");
}
}; };
// Concrete class for actually writing strings to a socket. // Concrete class for actually writing strings to a socket.
class SocketWriter : public AbstractSocketWriter { class SocketWriter : public AbstractSocketWriter {
public: public:
SocketWriter(const string& host, const string& port) SocketWriter(const std::string& host, const std::string& port)
: sockfd_(-1), host_name_(host), port_num_(port) { : sockfd_(-1), host_name_(host), port_num_(port) {
MakeConnection(); MakeConnection();
} }
...@@ -1065,7 +1063,7 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { ...@@ -1065,7 +1063,7 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
} }
// Sends a string to the socket. // Sends a string to the socket.
virtual void Send(const string& message) { virtual void Send(const std::string& message) {
GTEST_CHECK_(sockfd_ != -1) GTEST_CHECK_(sockfd_ != -1)
<< "Send() can be called only when there is a connection."; << "Send() can be called only when there is a connection.";
...@@ -1091,17 +1089,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { ...@@ -1091,17 +1089,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
} }
int sockfd_; // socket file descriptor int sockfd_; // socket file descriptor
const string host_name_; const std::string host_name_;
const string port_num_; const std::string port_num_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
}; // class SocketWriter }; // class SocketWriter
// Escapes '=', '&', '%', and '\n' characters in str as "%xx". // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
static string UrlEncode(const char* str); static std::string UrlEncode(const char* str);
StreamingListener(const string& host, const string& port) StreamingListener(const std::string& host, const std::string& port)
: socket_writer_(new SocketWriter(host, port)) { Start(); } : socket_writer_(new SocketWriter(host, port)) {
Start();
}
explicit StreamingListener(AbstractSocketWriter* socket_writer) explicit StreamingListener(AbstractSocketWriter* socket_writer)
: socket_writer_(socket_writer) { Start(); } : socket_writer_(socket_writer) { Start(); }
...@@ -1162,13 +1162,13 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener { ...@@ -1162,13 +1162,13 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
private: private:
// Sends the given message and a newline to the socket. // Sends the given message and a newline to the socket.
void SendLn(const string& message) { socket_writer_->SendLn(message); } void SendLn(const std::string& message) { socket_writer_->SendLn(message); }
// Called at the start of streaming to notify the receiver what // Called at the start of streaming to notify the receiver what
// protocol we are using. // protocol we are using.
void Start() { SendLn("gtest_streaming_protocol_version=1.0"); } void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
string FormatBool(bool value) { return value ? "1" : "0"; } std::string FormatBool(bool value) { return value ? "1" : "0"; }
const scoped_ptr<AbstractSocketWriter> socket_writer_; const scoped_ptr<AbstractSocketWriter> socket_writer_;
......
...@@ -93,7 +93,7 @@ const int kStdErrFileno = STDERR_FILENO; ...@@ -93,7 +93,7 @@ const int kStdErrFileno = STDERR_FILENO;
namespace { namespace {
template <typename T> template <typename T>
T ReadProcFileField(const string& filename, int field) { T ReadProcFileField(const std::string& filename, int field) {
std::string dummy; std::string dummy;
std::ifstream file(filename.c_str()); std::ifstream file(filename.c_str());
while (field-- > 0) { while (field-- > 0) {
...@@ -107,7 +107,7 @@ T ReadProcFileField(const string& filename, int field) { ...@@ -107,7 +107,7 @@ T ReadProcFileField(const string& filename, int field) {
// Returns the number of active threads, or 0 when there is an error. // Returns the number of active threads, or 0 when there is an error.
size_t GetThreadCount() { size_t GetThreadCount() {
const string filename = const std::string filename =
(Message() << "/proc/" << getpid() << "/stat").GetString(); (Message() << "/proc/" << getpid() << "/stat").GetString();
return ReadProcFileField<int>(filename, 19); return ReadProcFileField<int>(filename, 19);
} }
......
...@@ -633,7 +633,7 @@ AssertionResult HasOneFailure(const char* /* results_expr */, ...@@ -633,7 +633,7 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
const char* /* substr_expr */, const char* /* substr_expr */,
const TestPartResultArray& results, const TestPartResultArray& results,
TestPartResult::Type type, TestPartResult::Type type,
const string& substr) { const std::string& substr) {
const std::string expected(type == TestPartResult::kFatalFailure ? const std::string expected(type == TestPartResult::kFatalFailure ?
"1 fatal failure" : "1 fatal failure" :
"1 non-fatal failure"); "1 non-fatal failure");
...@@ -667,13 +667,10 @@ AssertionResult HasOneFailure(const char* /* results_expr */, ...@@ -667,13 +667,10 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
// The constructor of SingleFailureChecker remembers where to look up // The constructor of SingleFailureChecker remembers where to look up
// test part results, what type of failure we expect, and what // test part results, what type of failure we expect, and what
// substring the failure message should contain. // substring the failure message should contain.
SingleFailureChecker:: SingleFailureChecker( SingleFailureChecker::SingleFailureChecker(const TestPartResultArray* results,
const TestPartResultArray* results,
TestPartResult::Type type, TestPartResult::Type type,
const string& substr) const std::string& substr)
: results_(results), : results_(results), type_(type), substr_(substr) {}
type_(type),
substr_(substr) {}
// The destructor of SingleFailureChecker verifies that the given // The destructor of SingleFailureChecker verifies that the given
// TestPartResultArray contains exactly one failure that has the given // TestPartResultArray contains exactly one failure that has the given
...@@ -3654,13 +3651,14 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, ...@@ -3654,13 +3651,14 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
if (++failures == 1) { if (++failures == 1) {
*stream << ">\n"; *stream << ">\n";
} }
const string location = internal::FormatCompilerIndependentFileLocation( const std::string location =
part.file_name(), part.line_number()); internal::FormatCompilerIndependentFileLocation(part.file_name(),
const string summary = location + "\n" + part.summary(); part.line_number());
const std::string summary = location + "\n" + part.summary();
*stream << " <failure message=\"" *stream << " <failure message=\""
<< EscapeXmlAttribute(summary.c_str()) << EscapeXmlAttribute(summary.c_str())
<< "\" type=\"\">"; << "\" type=\"\">";
const string detail = location + "\n" + part.message(); const std::string detail = location + "\n" + part.message();
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
*stream << "</failure>\n"; *stream << "</failure>\n";
} }
...@@ -3759,8 +3757,8 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes( ...@@ -3759,8 +3757,8 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
// example, replaces "=" with "%3D". This algorithm is O(strlen(str)) // example, replaces "=" with "%3D". This algorithm is O(strlen(str))
// in both time and space -- important as the input str may contain an // in both time and space -- important as the input str may contain an
// arbitrarily long test failure message and stack trace. // arbitrarily long test failure message and stack trace.
string StreamingListener::UrlEncode(const char* str) { std::string StreamingListener::UrlEncode(const char* str) {
string result; std::string result;
result.reserve(strlen(str) + 1); result.reserve(strlen(str) + 1);
for (char ch = *str; ch != '\0'; ch = *++str) { for (char ch = *str; ch != '\0'; ch = *++str) {
switch (ch) { switch (ch) {
...@@ -3848,7 +3846,7 @@ ScopedTrace::~ScopedTrace() ...@@ -3848,7 +3846,7 @@ ScopedTrace::~ScopedTrace()
const char* const OsStackTraceGetterInterface::kElidedFramesMarker = const char* const OsStackTraceGetterInterface::kElidedFramesMarker =
"... " GTEST_NAME_ " internal frames ..."; "... " GTEST_NAME_ " internal frames ...";
string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/, std::string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/,
int /*skip_count*/) { int /*skip_count*/) {
return ""; return "";
} }
......
...@@ -505,7 +505,7 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) { ...@@ -505,7 +505,7 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
# if GTEST_HAS_GLOBAL_STRING # if GTEST_HAS_GLOBAL_STRING
const string regex_str(regex_c_str); const ::string regex_str(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex_str); EXPECT_DEATH(GlobalFunction(), regex_str);
# endif // GTEST_HAS_GLOBAL_STRING # endif // GTEST_HAS_GLOBAL_STRING
......
...@@ -236,7 +236,7 @@ using ::stdext::hash_multiset; ...@@ -236,7 +236,7 @@ using ::stdext::hash_multiset;
// Prints a value to a string using the universal value printer. This // Prints a value to a string using the universal value printer. This
// is a helper for testing UniversalPrinter<T>::Print() for various types. // is a helper for testing UniversalPrinter<T>::Print() for various types.
template <typename T> template <typename T>
string Print(const T& value) { std::string Print(const T& value) {
::std::stringstream ss; ::std::stringstream ss;
UniversalPrinter<T>::Print(value, &ss); UniversalPrinter<T>::Print(value, &ss);
return ss.str(); return ss.str();
...@@ -246,7 +246,7 @@ string Print(const T& value) { ...@@ -246,7 +246,7 @@ string Print(const T& value) {
// value printer. This is a helper for testing // value printer. This is a helper for testing
// UniversalPrinter<T&>::Print() for various types. // UniversalPrinter<T&>::Print() for various types.
template <typename T> template <typename T>
string PrintByRef(const T& value) { std::string PrintByRef(const T& value) {
::std::stringstream ss; ::std::stringstream ss;
UniversalPrinter<T&>::Print(value, &ss); UniversalPrinter<T&>::Print(value, &ss);
return ss.str(); return ss.str();
...@@ -383,7 +383,7 @@ TEST(PrintBuiltInTypeTest, FloatingPoints) { ...@@ -383,7 +383,7 @@ TEST(PrintBuiltInTypeTest, FloatingPoints) {
// Since ::std::stringstream::operator<<(const void *) formats the pointer // Since ::std::stringstream::operator<<(const void *) formats the pointer
// output differently with different compilers, we have to create the expected // output differently with different compilers, we have to create the expected
// output first and use it as our expectation. // output first and use it as our expectation.
static string PrintPointer(const void *p) { static std::string PrintPointer(const void* p) {
::std::stringstream expected_result_stream; ::std::stringstream expected_result_stream;
expected_result_stream << p; expected_result_stream << p;
return expected_result_stream.str(); return expected_result_stream.str();
...@@ -596,7 +596,7 @@ TEST(PrintPointerTest, MemberFunctionPointer) { ...@@ -596,7 +596,7 @@ TEST(PrintPointerTest, MemberFunctionPointer) {
// The difference between this and Print() is that it ensures that the // The difference between this and Print() is that it ensures that the
// argument is a reference to an array. // argument is a reference to an array.
template <typename T, size_t N> template <typename T, size_t N>
string PrintArrayHelper(T (&a)[N]) { std::string PrintArrayHelper(T (&a)[N]) {
return Print(a); return Print(a);
} }
...@@ -649,7 +649,7 @@ TEST(PrintArrayTest, WConstCharArrayWithTerminatingNul) { ...@@ -649,7 +649,7 @@ TEST(PrintArrayTest, WConstCharArrayWithTerminatingNul) {
// Array of objects. // Array of objects.
TEST(PrintArrayTest, ObjectArray) { TEST(PrintArrayTest, ObjectArray) {
string a[3] = { "Hi", "Hello", "Ni hao" }; std::string a[3] = {"Hi", "Hello", "Ni hao"};
EXPECT_EQ("{ \"Hi\", \"Hello\", \"Ni hao\" }", PrintArrayHelper(a)); EXPECT_EQ("{ \"Hi\", \"Hello\", \"Ni hao\" }", PrintArrayHelper(a));
} }
...@@ -831,7 +831,7 @@ TEST(PrintStlContainerTest, HashMultiMap) { ...@@ -831,7 +831,7 @@ TEST(PrintStlContainerTest, HashMultiMap) {
map1.insert(make_pair(5, false)); map1.insert(make_pair(5, false));
// Elements of hash_multimap can be printed in any order. // Elements of hash_multimap can be printed in any order.
const string result = Print(map1); const std::string result = Print(map1);
EXPECT_TRUE(result == "{ (5, true), (5, false) }" || EXPECT_TRUE(result == "{ (5, true), (5, false) }" ||
result == "{ (5, false), (5, true) }") result == "{ (5, false), (5, true) }")
<< " where Print(map1) returns \"" << result << "\"."; << " where Print(map1) returns \"" << result << "\".";
...@@ -842,9 +842,9 @@ TEST(PrintStlContainerTest, HashMultiMap) { ...@@ -842,9 +842,9 @@ TEST(PrintStlContainerTest, HashMultiMap) {
#if GTEST_HAS_HASH_SET_ #if GTEST_HAS_HASH_SET_
TEST(PrintStlContainerTest, HashSet) { TEST(PrintStlContainerTest, HashSet) {
hash_set<string> set1; hash_set<int> set1;
set1.insert("hello"); set1.insert(1);
EXPECT_EQ("{ \"hello\" }", Print(set1)); EXPECT_EQ("{ 1 }", Print(set1));
} }
TEST(PrintStlContainerTest, HashMultiSet) { TEST(PrintStlContainerTest, HashMultiSet) {
...@@ -853,8 +853,8 @@ TEST(PrintStlContainerTest, HashMultiSet) { ...@@ -853,8 +853,8 @@ TEST(PrintStlContainerTest, HashMultiSet) {
hash_multiset<int> set1(a, a + kSize); hash_multiset<int> set1(a, a + kSize);
// Elements of hash_multiset can be printed in any order. // Elements of hash_multiset can be printed in any order.
const string result = Print(set1); const std::string result = Print(set1);
const string expected_pattern = "{ d, d, d, d, d }"; // d means a digit. const std::string expected_pattern = "{ d, d, d, d, d }"; // d means a digit.
// Verifies the result matches the expected pattern; also extracts // Verifies the result matches the expected pattern; also extracts
// the numbers in the result. // the numbers in the result.
...@@ -879,11 +879,8 @@ TEST(PrintStlContainerTest, HashMultiSet) { ...@@ -879,11 +879,8 @@ TEST(PrintStlContainerTest, HashMultiSet) {
#endif // GTEST_HAS_HASH_SET_ #endif // GTEST_HAS_HASH_SET_
TEST(PrintStlContainerTest, List) { TEST(PrintStlContainerTest, List) {
const string a[] = { const std::string a[] = {"hello", "world"};
"hello", const list<std::string> strings(a, a + 2);
"world"
};
const list<string> strings(a, a + 2);
EXPECT_EQ("{ \"hello\", \"world\" }", Print(strings)); EXPECT_EQ("{ \"hello\", \"world\" }", Print(strings));
} }
...@@ -1039,9 +1036,10 @@ TEST(PrintTr1TupleTest, VariousSizes) { ...@@ -1039,9 +1036,10 @@ TEST(PrintTr1TupleTest, VariousSizes) {
// VC++ 2010's implementation of tuple of C++0x is deficient, requiring // VC++ 2010's implementation of tuple of C++0x is deficient, requiring
// an explicit type cast of NULL to be used. // an explicit type cast of NULL to be used.
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, string> testing::internal::Int64, float, double, const char*, void*,
t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, std::string>
ImplicitCast_<void*>(NULL), "10"); t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL),
"10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
Print(t10)); Print(t10));
...@@ -1098,9 +1096,10 @@ TEST(PrintStdTupleTest, VariousSizes) { ...@@ -1098,9 +1096,10 @@ TEST(PrintStdTupleTest, VariousSizes) {
// VC++ 2010's implementation of tuple of C++0x is deficient, requiring // VC++ 2010's implementation of tuple of C++0x is deficient, requiring
// an explicit type cast of NULL to be used. // an explicit type cast of NULL to be used.
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, string> testing::internal::Int64, float, double, const char*, void*,
t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, std::string>
ImplicitCast_<void*>(NULL), "10"); t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL),
"10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
Print(t10)); Print(t10));
...@@ -1204,13 +1203,13 @@ TEST(PrintReferenceTest, PrintsAddressAndValue) { ...@@ -1204,13 +1203,13 @@ TEST(PrintReferenceTest, PrintsAddressAndValue) {
// reference. // reference.
TEST(PrintReferenceTest, HandlesFunctionPointer) { TEST(PrintReferenceTest, HandlesFunctionPointer) {
void (*fp)(int n) = &MyFunction; void (*fp)(int n) = &MyFunction;
const string fp_pointer_string = const std::string fp_pointer_string =
PrintPointer(reinterpret_cast<const void*>(&fp)); PrintPointer(reinterpret_cast<const void*>(&fp));
// We cannot directly cast &MyFunction to const void* because the // We cannot directly cast &MyFunction to const void* because the
// standard disallows casting between pointers to functions and // standard disallows casting between pointers to functions and
// pointers to objects, and some compilers (e.g. GCC 3.4) enforce // pointers to objects, and some compilers (e.g. GCC 3.4) enforce
// this limitation. // this limitation.
const string fp_string = PrintPointer(reinterpret_cast<const void*>( const std::string fp_string = PrintPointer(reinterpret_cast<const void*>(
reinterpret_cast<internal::BiggestInt>(fp))); reinterpret_cast<internal::BiggestInt>(fp)));
EXPECT_EQ("@" + fp_pointer_string + " " + fp_string, EXPECT_EQ("@" + fp_pointer_string + " " + fp_string,
PrintByRef(fp)); PrintByRef(fp));
...@@ -1542,12 +1541,12 @@ TEST(UniversalPrintTest, WorksForCString) { ...@@ -1542,12 +1541,12 @@ TEST(UniversalPrintTest, WorksForCString) {
const char* s1 = "abc"; const char* s1 = "abc";
::std::stringstream ss1; ::std::stringstream ss1;
UniversalPrint(s1, &ss1); UniversalPrint(s1, &ss1);
EXPECT_EQ(PrintPointer(s1) + " pointing to \"abc\"", string(ss1.str())); EXPECT_EQ(PrintPointer(s1) + " pointing to \"abc\"", std::string(ss1.str()));
char* s2 = const_cast<char*>(s1); char* s2 = const_cast<char*>(s1);
::std::stringstream ss2; ::std::stringstream ss2;
UniversalPrint(s2, &ss2); UniversalPrint(s2, &ss2);
EXPECT_EQ(PrintPointer(s2) + " pointing to \"abc\"", string(ss2.str())); EXPECT_EQ(PrintPointer(s2) + " pointing to \"abc\"", std::string(ss2.str()));
const char* s3 = NULL; const char* s3 = NULL;
::std::stringstream ss3; ::std::stringstream ss3;
...@@ -1636,4 +1635,3 @@ TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTersely) { ...@@ -1636,4 +1635,3 @@ TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTersely) {
} // namespace gtest_printers_test } // namespace gtest_printers_test
} // namespace testing } // namespace testing
...@@ -86,9 +86,9 @@ class StreamingListenerTest : public Test { ...@@ -86,9 +86,9 @@ class StreamingListenerTest : public Test {
class FakeSocketWriter : public StreamingListener::AbstractSocketWriter { class FakeSocketWriter : public StreamingListener::AbstractSocketWriter {
public: public:
// Sends a string to the socket. // Sends a string to the socket.
virtual void Send(const string& message) { output_ += message; } virtual void Send(const std::string& message) { output_ += message; }
string output_; std::string output_;
}; };
StreamingListenerTest() StreamingListenerTest()
...@@ -98,7 +98,7 @@ class StreamingListenerTest : public Test { ...@@ -98,7 +98,7 @@ class StreamingListenerTest : public Test {
CodeLocation(__FILE__, __LINE__), 0, NULL) {} CodeLocation(__FILE__, __LINE__), 0, NULL) {}
protected: protected:
string* output() { return &(fake_sock_writer_->output_); } std::string* output() { return &(fake_sock_writer_->output_); }
FakeSocketWriter* const fake_sock_writer_; FakeSocketWriter* const fake_sock_writer_;
StreamingListener streamer_; StreamingListener streamer_;
...@@ -7703,4 +7703,3 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) { ...@@ -7703,4 +7703,3 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE(SkipPrefix("world!", &p)); EXPECT_FALSE(SkipPrefix("world!", &p));
EXPECT_EQ(str, p); EXPECT_EQ(str, p);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment