Added new test to autovariable

This commit is contained in:
Gianluca Scacco 2009-03-28 21:54:12 +01:00
parent c88a362893
commit f5104d6d0a
1 changed files with 9 additions and 0 deletions

View File

@ -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)