summaryrefslogtreecommitdiff
path: root/src/gtest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtest.cc')
-rw-r--r--src/gtest.cc36
1 files changed, 8 insertions, 28 deletions
diff --git a/src/gtest.cc b/src/gtest.cc
index 78f113e..35e1dbd 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -818,17 +818,6 @@ TimeInMillis GetTimeInMillis() {
// class String
-// Returns the input enclosed in double quotes if it's not NULL;
-// otherwise returns "(null)". For example, "\"Hello\"" is returned
-// for input "Hello".
-//
-// This is useful for printing a C string in the syntax of a literal.
-//
-// Known issue: escape sequences are not handled yet.
-String String::ShowCStringQuoted(const char* c_str) {
- return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
-}
-
// Copies at most length characters from str into a newly-allocated
// piece of memory of size length+1. The memory is allocated with new[].
// A terminating null byte is written to the memory, and a pointer to it
@@ -1169,8 +1158,8 @@ AssertionResult CmpHelperSTREQ(const char* expected_expression,
return EqFailure(expected_expression,
actual_expression,
- String::ShowCStringQuoted(expected),
- String::ShowCStringQuoted(actual),
+ PrintToString(expected),
+ PrintToString(actual),
false);
}
@@ -1185,8 +1174,8 @@ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
return EqFailure(expected_expression,
actual_expression,
- String::ShowCStringQuoted(expected),
- String::ShowCStringQuoted(actual),
+ PrintToString(expected),
+ PrintToString(actual),
true);
}
@@ -1534,15 +1523,6 @@ String String::ShowWideCString(const wchar_t * wide_c_str) {
return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
}
-// Similar to ShowWideCString(), except that this function encloses
-// the converted string in double quotes.
-String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
- if (wide_c_str == NULL) return String("(null)");
-
- return String::Format("L\"%s\"",
- String::ShowWideCString(wide_c_str).c_str());
-}
-
// Compares two wide C strings. Returns true iff they have the same
// content.
//
@@ -1568,8 +1548,8 @@ AssertionResult CmpHelperSTREQ(const char* expected_expression,
return EqFailure(expected_expression,
actual_expression,
- String::ShowWideCStringQuoted(expected),
- String::ShowWideCStringQuoted(actual),
+ PrintToString(expected),
+ PrintToString(actual),
false);
}
@@ -1584,8 +1564,8 @@ AssertionResult CmpHelperSTRNE(const char* s1_expression,
return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
<< s2_expression << "), actual: "
- << String::ShowWideCStringQuoted(s1)
- << " vs " << String::ShowWideCStringQuoted(s2);
+ << PrintToString(s1)
+ << " vs " << PrintToString(s2);
}
// Compares two C strings, ignoring case. Returns true iff they have