Commit 81476f2f authored by zhanyong.wan's avatar zhanyong.wan
Browse files

Makes gmock-spec-builders_test.cc and gmock-internal-utils_test.cc work where...

Makes gmock-spec-builders_test.cc and gmock-internal-utils_test.cc work where both ::string  and ::std::string are defined.
parent 90c90f92
...@@ -501,7 +501,16 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) { ...@@ -501,7 +501,16 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) {
class LogIsVisibleTest : public ::testing::Test { class LogIsVisibleTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { original_verbose_ = GMOCK_FLAG(verbose); } virtual void SetUp() {
// The code needs to work when both ::string and ::std::string are
// defined and the flag is implemented as a
// testing::internal::String. In this case, without the call to
// c_str(), the compiler will complain that it cannot figure out
// whether the String flag should be converted to a ::string or an
// ::std::string before being assigned to original_verbose_.
original_verbose_ = GMOCK_FLAG(verbose).c_str();
}
virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; } virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; }
string original_verbose_; string original_verbose_;
......
...@@ -1628,7 +1628,16 @@ class LogTestHelper { ...@@ -1628,7 +1628,16 @@ class LogTestHelper {
class GMockLogTest : public ::testing::Test { class GMockLogTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { original_verbose_ = GMOCK_FLAG(verbose); } virtual void SetUp() {
// The code needs to work when both ::string and ::std::string are
// defined and the flag is implemented as a
// testing::internal::String. In this case, without the call to
// c_str(), the compiler will complain that it cannot figure out
// whether the String flag should be converted to a ::string or an
// ::std::string before being assigned to original_verbose_.
original_verbose_ = GMOCK_FLAG(verbose).c_str();
}
virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; } virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; }
LogTestHelper helper_; LogTestHelper helper_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment