summaryrefslogtreecommitdiff
path: root/src/gtest-internal-inl.h
diff options
context:
space:
mode:
authorjgm@google.com <jgm@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2012-11-15 15:47:38 +0000
committerjgm@google.com <jgm@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2012-11-15 15:47:38 +0000
commit03c314931649a999b0cf5deb0a434a1009157416 (patch)
tree640cd727bab672105c57f563091dc58b7a81a1be /src/gtest-internal-inl.h
parent5d9f11fe81eaca3989ec7e8dbfe5b31608a75121 (diff)
downloadgtest-03c314931649a999b0cf5deb0a434a1009157416.tar.gz
gtest-03c314931649a999b0cf5deb0a434a1009157416.tar.bz2
gtest-03c314931649a999b0cf5deb0a434a1009157416.tar.xz
Unfortunately, the svn repo is a bit out of date. This commit contains 8
changes that haven't made it to svn. The descriptions of each change are listed below. - Fixes some python shebang lines. - Add ElementsAreArray overloads to gmock. ElementsAreArray now makes a copy of its input elements before the conversion to a Matcher. ElementsAreArray can now take a vector as input. ElementsAreArray can now take an iterator pair as input. - Templatize MatchAndExplain to allow independent string types for the matcher and matchee. I also templatized the ConstCharPointer version of MatchAndExplain to avoid calls with "char*" from using the new templated MatchAndExplain. - Fixes the bug where the constructor of the return type of ElementsAre() saves a reference instead of a copy of the arguments. - Extends ElementsAre() to accept arrays whose sizes aren't known. - Switches gTest's internal FilePath class from testing::internal::String to std::string. testing::internal::String was introduced when gTest couldn't depend on std::string. It's now deprecated. - Switches gTest & gMock from using testing::internal::String objects to std::string. Some static methods of String are still in use. We may be able to remove some but not all of them. In particular, String::Format() should eventually be removed as it truncates the result at 4096 characters, often causing problems. git-svn-id: http://googletest.googlecode.com/svn/trunk@628 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'src/gtest-internal-inl.h')
-rw-r--r--src/gtest-internal-inl.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h
index 350ade0..54717c9 100644
--- a/src/gtest-internal-inl.h
+++ b/src/gtest-internal-inl.h
@@ -202,20 +202,20 @@ class GTestFlagSaver {
bool also_run_disabled_tests_;
bool break_on_failure_;
bool catch_exceptions_;
- String color_;
- String death_test_style_;
+ std::string color_;
+ std::string death_test_style_;
bool death_test_use_fork_;
- String filter_;
- String internal_run_death_test_;
+ std::string filter_;
+ std::string internal_run_death_test_;
bool list_tests_;
- String output_;
+ std::string output_;
bool print_time_;
bool pretty_;
internal::Int32 random_seed_;
internal::Int32 repeat_;
bool shuffle_;
internal::Int32 stack_trace_depth_;
- String stream_result_to_;
+ std::string stream_result_to_;
bool throw_on_failure_;
} GTEST_ATTRIBUTE_UNUSED_;
@@ -242,7 +242,7 @@ GTEST_API_ char* CodePointToUtf8(UInt32 code_point, char* str);
// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
// and contains invalid UTF-16 surrogate pairs, values in those pairs
// will be encoded as individual Unicode characters from Basic Normal Plane.
-GTEST_API_ String WideStringToUtf8(const wchar_t* str, int num_chars);
+GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
// if the variable is present. If a file already exists at this location, this
@@ -351,11 +351,11 @@ class TestPropertyKeyIs {
// Returns true iff the test name of test property matches on key_.
bool operator()(const TestProperty& test_property) const {
- return String(test_property.key()).Compare(key_) == 0;
+ return test_property.key() == key_;
}
private:
- String key_;
+ std::string key_;
};
// Class UnitTestOptions.
@@ -373,12 +373,12 @@ class GTEST_API_ UnitTestOptions {
// Functions for processing the gtest_output flag.
// Returns the output format, or "" for normal printed output.
- static String GetOutputFormat();
+ static std::string GetOutputFormat();
// Returns the absolute path of the requested output file, or the
// default (test_detail.xml in the original working directory) if
// none was explicitly specified.
- static String GetAbsolutePathToOutputFile();
+ static std::string GetAbsolutePathToOutputFile();
// Functions for processing the gtest_filter flag.
@@ -391,8 +391,8 @@ class GTEST_API_ UnitTestOptions {
// Returns true iff the user-specified filter matches the test case
// name and the test name.
- static bool FilterMatchesTest(const String &test_case_name,
- const String &test_name);
+ static bool FilterMatchesTest(const std::string &test_case_name,
+ const std::string &test_name);
#if GTEST_OS_WINDOWS
// Function for supporting the gtest_catch_exception flag.
@@ -405,7 +405,7 @@ class GTEST_API_ UnitTestOptions {
// Returns true if "name" matches the ':' separated list of glob-style
// filters in "filter".
- static bool MatchesFilter(const String& name, const char* filter);
+ static bool MatchesFilter(const std::string& name, const char* filter);
};
// Returns the current application's name, removing directory path if that
@@ -418,13 +418,13 @@ class OsStackTraceGetterInterface {
OsStackTraceGetterInterface() {}
virtual ~OsStackTraceGetterInterface() {}
- // Returns the current OS stack trace as a String. Parameters:
+ // Returns the current OS stack trace as an std::string. Parameters:
//
// max_depth - the maximum number of stack frames to be included
// in the trace.
// skip_count - the number of top frames to be skipped; doesn't count
// against max_depth.
- virtual String CurrentStackTrace(int max_depth, int skip_count) = 0;
+ virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;
// UponLeavingGTest() should be called immediately before Google Test calls
// user code. It saves some information about the current stack that
@@ -440,7 +440,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
public:
OsStackTraceGetter() : caller_frame_(NULL) {}
- virtual String CurrentStackTrace(int max_depth, int skip_count)
+ virtual string CurrentStackTrace(int max_depth, int skip_count)
GTEST_LOCK_EXCLUDED_(mutex_);
virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
@@ -465,7 +465,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
struct TraceInfo {
const char* file;
int line;
- String message;
+ std::string message;
};
// This is the default global test part result reporter used in UnitTestImpl.
@@ -610,7 +610,7 @@ class GTEST_API_ UnitTestImpl {
// getter, and returns it.
OsStackTraceGetterInterface* os_stack_trace_getter();
- // Returns the current OS stack trace as a String.
+ // Returns the current OS stack trace as an std::string.
//
// The maximum number of stack frames to be included is specified by
// the gtest_stack_trace_depth flag. The skip_count parameter
@@ -620,7 +620,7 @@ class GTEST_API_ UnitTestImpl {
// For example, if Foo() calls Bar(), which in turn calls
// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
- String CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
+ std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
// Finds and returns a TestCase with the given name. If one doesn't
// exist, creates one and returns it.
@@ -953,7 +953,7 @@ GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
// Returns the message describing the last system error, regardless of the
// platform.
-GTEST_API_ String GetLastErrnoDescription();
+GTEST_API_ std::string GetLastErrnoDescription();
# if GTEST_OS_WINDOWS
// Provides leak-safe Windows kernel handle ownership.