summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest.cc
diff options
context:
space:
mode:
authorBilly Donahue <BillyDonahue@users.noreply.github.com>2017-05-16 21:00:03 (GMT)
committerGitHub <noreply@github.com>2017-05-16 21:00:03 (GMT)
commit7cc548dcbf266d48c9b3fe8ec30c2f2ba8acb1d9 (patch)
tree8f92a22eb8633766fc7d2e689593bd100dc17824 /googletest/src/gtest.cc
parent078d5d930ad8b25b3c61556dc6de7ad13fa9a179 (diff)
parent09fd5b3ebfaac10b78bda664ec7f57fac74ef214 (diff)
downloadgoogletest-7cc548dcbf266d48c9b3fe8ec30c2f2ba8acb1d9.zip
googletest-7cc548dcbf266d48c9b3fe8ec30c2f2ba8acb1d9.tar.gz
googletest-7cc548dcbf266d48c9b3fe8ec30c2f2ba8acb1d9.tar.bz2
Merge pull request #1089 from nico/stdstring
Use std::string and ::string explicitly in gtest and gmock code.
Diffstat (limited to 'googletest/src/gtest.cc')
-rw-r--r--googletest/src/gtest.cc30
1 files changed, 14 insertions, 16 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index b0c98e8..de03212 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -633,7 +633,7 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
const char* /* substr_expr */,
const TestPartResultArray& results,
TestPartResult::Type type,
- const string& substr) {
+ const std::string& substr) {
const std::string expected(type == TestPartResult::kFatalFailure ?
"1 fatal failure" :
"1 non-fatal failure");
@@ -667,13 +667,10 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
// The constructor of SingleFailureChecker remembers where to look up
// test part results, what type of failure we expect, and what
// substring the failure message should contain.
-SingleFailureChecker:: SingleFailureChecker(
- const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr)
- : results_(results),
- type_(type),
- substr_(substr) {}
+SingleFailureChecker::SingleFailureChecker(const TestPartResultArray* results,
+ TestPartResult::Type type,
+ const std::string& substr)
+ : results_(results), type_(type), substr_(substr) {}
// The destructor of SingleFailureChecker verifies that the given
// TestPartResultArray contains exactly one failure that has the given
@@ -3654,13 +3651,14 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
if (++failures == 1) {
*stream << ">\n";
}
- const string location = internal::FormatCompilerIndependentFileLocation(
- part.file_name(), part.line_number());
- const string summary = location + "\n" + part.summary();
+ const std::string location =
+ internal::FormatCompilerIndependentFileLocation(part.file_name(),
+ part.line_number());
+ const std::string summary = location + "\n" + part.summary();
*stream << " <failure message=\""
<< EscapeXmlAttribute(summary.c_str())
<< "\" type=\"\">";
- const string detail = location + "\n" + part.message();
+ const std::string detail = location + "\n" + part.message();
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
*stream << "</failure>\n";
}
@@ -3759,8 +3757,8 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
// example, replaces "=" with "%3D". This algorithm is O(strlen(str))
// in both time and space -- important as the input str may contain an
// arbitrarily long test failure message and stack trace.
-string StreamingListener::UrlEncode(const char* str) {
- string result;
+std::string StreamingListener::UrlEncode(const char* str) {
+ std::string result;
result.reserve(strlen(str) + 1);
for (char ch = *str; ch != '\0'; ch = *++str) {
switch (ch) {
@@ -3848,8 +3846,8 @@ ScopedTrace::~ScopedTrace()
const char* const OsStackTraceGetterInterface::kElidedFramesMarker =
"... " GTEST_NAME_ " internal frames ...";
-string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/,
- int /*skip_count*/) {
+std::string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/,
+ int /*skip_count*/) {
return "";
}