diff options
author | Jonny007-MKD <me@jonny007-mkd.de> | 2018-09-13 13:57:27 +0200 |
---|---|---|
committer | Jonny007-MKD <me@jonny007-mkd.de> | 2018-09-13 13:57:27 +0200 |
commit | 8c849c584c65a187ae472af466cb7cdaa98685d6 (patch) | |
tree | 1af67e5ff2ae8efa60dccf8b070be29ab9473e5d | |
parent | 0354ccb049ea2b9e4696adb8b5a013287daf0c33 (diff) | |
download | googletest-8c849c584c65a187ae472af466cb7cdaa98685d6.tar.gz googletest-8c849c584c65a187ae472af466cb7cdaa98685d6.tar.bz2 googletest-8c849c584c65a187ae472af466cb7cdaa98685d6.zip |
Try to fix gcc and clang issues
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 2 | ||||
-rw-r--r-- | googletest/test/gtest_unittest.cc | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index b968fb1d..da3ebd2b 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -1192,7 +1192,7 @@ class NativeArray { class AdditionalMessage { public: - AdditionalMessage(const std::string& message) : value(message) {} + AdditionalMessage(const char* message) : value(message) {} AdditionalMessage& operator=(const std::string& message) { value = message; return *this; } operator bool() const { return ::testing::internal::AlwaysTrue(); } diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index de194491..2c970830 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -3748,6 +3748,19 @@ TEST(ExpectTest, ASSERT_EQ_0) { " 0\n 5.6"); } +TEST(AssertionTest, AdditionalMessage) { + ::testing::internal::AdditionalMessage m = "servus"; + EXPECT_EQ(m.get(), "servus"); + + const char* cc = "hello"; + m = cc; + EXPECT_EQ(m.get(), cc); + + std::string s = "hi"; + m = s; + EXPECT_EQ(m.get(), s); +} + // Tests ASSERT_NE. TEST(AssertionTest, ASSERT_NE) { ASSERT_NE(6, 7); |