Added new test to autovariable
This commit is contained in:
parent
c88a362893
commit
f5104d6d0a
|
@ -64,6 +64,7 @@ private:
|
|||
{
|
||||
TEST_CASE(testautovar);
|
||||
TEST_CASE(testautovararray);
|
||||
TEST_CASE(testautovarreturn);
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,6 +85,14 @@ private:
|
|||
"arr[0]=#");
|
||||
ASSERT_EQUALS(std::string("[test.cpp:3]: (error) Wrong assignement of an auto-variable to an effective parameter of a function\n"), errout.str());
|
||||
}
|
||||
void testautovarreturn()
|
||||
{
|
||||
check("int* func1()\n"
|
||||
"{\n"
|
||||
" int num=2;"
|
||||
"return #");
|
||||
ASSERT_EQUALS(std::string("[test.cpp:3]: (error) Return of the address of an auto-variable\n"), errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestAutoVariables)
|
||||
|
|
Loading…
Reference in New Issue