Try to fix gcc and clang issues

This commit is contained in:
Jonny007-MKD 2018-09-13 13:57:27 +02:00
parent 0354ccb049
commit 8c849c584c
2 changed files with 14 additions and 1 deletions

View File

@ -1192,7 +1192,7 @@ class NativeArray {
class AdditionalMessage class AdditionalMessage
{ {
public: public:
AdditionalMessage(const std::string& message) : value(message) {} AdditionalMessage(const char* message) : value(message) {}
AdditionalMessage& operator=(const std::string& message) { value = message; return *this; } AdditionalMessage& operator=(const std::string& message) { value = message; return *this; }
operator bool() const { return ::testing::internal::AlwaysTrue(); } operator bool() const { return ::testing::internal::AlwaysTrue(); }

View File

@ -3748,6 +3748,19 @@ TEST(ExpectTest, ASSERT_EQ_0) {
" 0\n 5.6"); " 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. // Tests ASSERT_NE.
TEST(AssertionTest, ASSERT_NE) { TEST(AssertionTest, ASSERT_NE) {
ASSERT_NE(6, 7); ASSERT_NE(6, 7);