diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-06-22 23:30:47 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-06-22 23:30:47 +0000 |
commit | 81476f2f9070186027e7337854bbcf693b85c6c6 (patch) | |
tree | f99c2e7f0217f1ab375ea173ed5a320d29c2b6be | |
parent | 90c90f9250f19c3f3a5c2c0887c1d9e414afe41b (diff) | |
download | googletest-81476f2f9070186027e7337854bbcf693b85c6c6.tar.gz googletest-81476f2f9070186027e7337854bbcf693b85c6c6.tar.bz2 googletest-81476f2f9070186027e7337854bbcf693b85c6c6.zip |
Makes gmock-spec-builders_test.cc and gmock-internal-utils_test.cc work where both ::string and ::std::string are defined.
-rw-r--r-- | test/gmock-internal-utils_test.cc | 11 | ||||
-rw-r--r-- | test/gmock-spec-builders_test.cc | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/test/gmock-internal-utils_test.cc b/test/gmock-internal-utils_test.cc index 9ab15af2..20289288 100644 --- a/test/gmock-internal-utils_test.cc +++ b/test/gmock-internal-utils_test.cc @@ -501,7 +501,16 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) { class LogIsVisibleTest : public ::testing::Test { 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_; } string original_verbose_; diff --git a/test/gmock-spec-builders_test.cc b/test/gmock-spec-builders_test.cc index 058d343c..614e4ab5 100644 --- a/test/gmock-spec-builders_test.cc +++ b/test/gmock-spec-builders_test.cc @@ -1628,7 +1628,16 @@ class LogTestHelper { class GMockLogTest : public ::testing::Test { 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_; } LogTestHelper helper_; |