diff options
author | jgm <jgm@google.com> | 2012-11-15 15:47:38 (GMT) |
---|---|---|
committer | jgm <jgm@google.com> | 2012-11-15 15:47:38 (GMT) |
commit | 87fdda2cf24d953f3cbec1e0c266b2db9928f406 (patch) | |
tree | 640cd727bab672105c57f563091dc58b7a81a1be /include/gtest/gtest-test-part.h | |
parent | 78bf6d5724e733cce313228856e18d5c372b4fb3 (diff) | |
download | googletest-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/gtest-test-part.h')
-rw-r--r-- | include/gtest/gtest-test-part.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/gtest/gtest-test-part.h b/include/gtest/gtest-test-part.h index 4615147..77eb844 100644 --- a/include/gtest/gtest-test-part.h +++ b/include/gtest/gtest-test-part.h @@ -62,7 +62,7 @@ class GTEST_API_ TestPartResult { int a_line_number, const char* a_message) : type_(a_type), - file_name_(a_file_name), + file_name_(a_file_name == NULL ? "" : a_file_name), line_number_(a_line_number), summary_(ExtractSummary(a_message)), message_(a_message) { @@ -73,7 +73,9 @@ class GTEST_API_ TestPartResult { // Gets the name of the source file where the test part took place, or // NULL if it's unknown. - const char* file_name() const { return file_name_.c_str(); } + const char* file_name() const { + return file_name_.empty() ? NULL : file_name_.c_str(); + } // Gets the line in the source file where the test part took place, // or -1 if it's unknown. @@ -102,16 +104,16 @@ class GTEST_API_ TestPartResult { // Gets the summary of the failure message by omitting the stack // trace in it. - static internal::String ExtractSummary(const char* message); + static std::string ExtractSummary(const char* message); // The name of the source file where the test part took place, or - // NULL if the source file is unknown. - internal::String file_name_; + // "" if the source file is unknown. + std::string file_name_; // The line in the source file where the test part took place, or -1 // if the line number is unknown. int line_number_; - internal::String summary_; // The test failure summary. - internal::String message_; // The test failure message. + std::string summary_; // The test failure summary. + std::string message_; // The test failure message. }; // Prints a TestPartResult object. |