summaryrefslogtreecommitdiffstats
path: root/include/gtest/internal/gtest-filepath.h
diff options
context:
space:
mode:
authorjgm <jgm@google.com>2012-11-15 15:47:38 (GMT)
committerjgm <jgm@google.com>2012-11-15 15:47:38 (GMT)
commit87fdda2cf24d953f3cbec1e0c266b2db9928f406 (patch)
tree640cd727bab672105c57f563091dc58b7a81a1be /include/gtest/internal/gtest-filepath.h
parent78bf6d5724e733cce313228856e18d5c372b4fb3 (diff)
downloadgoogletest-87fdda2cf24d953f3cbec1e0c266b2db9928f406.zip
googletest-87fdda2cf24d953f3cbec1e0c266b2db9928f406.tar.gz
googletest-87fdda2cf24d953f3cbec1e0c266b2db9928f406.tar.bz2
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.
Diffstat (limited to 'include/gtest/internal/gtest-filepath.h')
-rw-r--r--include/gtest/internal/gtest-filepath.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/include/gtest/internal/gtest-filepath.h b/include/gtest/internal/gtest-filepath.h
index b36b3cf..7a13b4b 100644
--- a/include/gtest/internal/gtest-filepath.h
+++ b/include/gtest/internal/gtest-filepath.h
@@ -61,11 +61,7 @@ class GTEST_API_ FilePath {
FilePath() : pathname_("") { }
FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
- explicit FilePath(const char* pathname) : pathname_(pathname) {
- Normalize();
- }
-
- explicit FilePath(const String& pathname) : pathname_(pathname) {
+ explicit FilePath(const std::string& pathname) : pathname_(pathname) {
Normalize();
}
@@ -78,7 +74,7 @@ class GTEST_API_ FilePath {
pathname_ = rhs.pathname_;
}
- String ToString() const { return pathname_; }
+ const std::string& string() const { return pathname_; }
const char* c_str() const { return pathname_.c_str(); }
// Returns the current working directory, or "" if unsuccessful.
@@ -111,8 +107,8 @@ class GTEST_API_ FilePath {
const FilePath& base_name,
const char* extension);
- // Returns true iff the path is NULL or "".
- bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
+ // Returns true iff the path is "".
+ bool IsEmpty() const { return pathname_.empty(); }
// If input name has a trailing separator character, removes it and returns
// the name, otherwise return the name string unmodified.
@@ -201,7 +197,7 @@ class GTEST_API_ FilePath {
// separators. Returns NULL if no path separator was found.
const char* FindLastPathSeparator() const;
- String pathname_;
+ std::string pathname_;
}; // class FilePath
} // namespace internal