add some more CheckClass::noMemset tests
This commit is contained in:
parent
14c07e988e
commit
ac7f1f874e
|
@ -2933,6 +2933,28 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkNoMemset("class Fred\n"
|
||||
"{\n"
|
||||
" static std::string b;\n"
|
||||
"};\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" Fred fred;\n"
|
||||
" memset(&fred, 0, sizeof(Fred));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkNoMemset("class Fred\n"
|
||||
"{\n"
|
||||
" std::string * b; \n"
|
||||
"};\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" Fred fred;\n"
|
||||
" memset(&fred, 0, sizeof(Fred));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkNoMemset("class Fred\n"
|
||||
"{\n"
|
||||
" std::string b; \n"
|
||||
|
@ -2944,6 +2966,17 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:8]: (error) Using 'memset' on class that contains a 'std::string'\n", errout.str());
|
||||
|
||||
checkNoMemset("class Fred\n"
|
||||
"{\n"
|
||||
" mutable std::string b; \n"
|
||||
"};\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" Fred fred;\n"
|
||||
" memset(&fred, 0, sizeof(Fred));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:8]: (error) Using 'memset' on class that contains a 'std::string'\n", errout.str());
|
||||
|
||||
checkNoMemset("class Fred\n"
|
||||
"{\n"
|
||||
"};\n"
|
||||
|
|
Loading…
Reference in New Issue