From 8075cd8b9d93d6424246b589fe64285c1835bfd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 28 Apr 2009 20:50:10 +0200 Subject: [PATCH] added todo test case for detecting unmodified containers in the operator= function --- test/testconstructors.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 49ff6b5a2..178893396 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -73,6 +73,8 @@ private: TEST_CASE(initvar_private_constructor); // BUG 2354171 - private constructor TEST_CASE(initvar_destructor); // No variables need to be initialized in a destructor + + TEST_CASE(operatorEqSTL); } @@ -336,6 +338,25 @@ private: "};\n"); ASSERT_EQUALS(std::string(""), errout.str()); } + + void operatorEqSTL() + { + check("class Fred\n" + "{\n" + "private:\n" + " std::vector ints;\n" + "public:\n" + " Fred();\n" + " void operator=(const Fred &f);\n" + "};\n" + "\n" + "Fred::Fred()\n" + "{ }\n" + "\n" + "void Fred::operator=(const Fred &f)\n" + "{ }"); + TODO_ASSERT_EQUALS(std::string("[test.cpp:14] (style) Fred::ints is not modified in operator=\n"), errout.str()); + } }; REGISTER_TEST(TestConstructors)