testunusedvar: move UB testcase to testuninitvar

This commit is contained in:
Daniel Marjamäki 2021-05-14 11:23:51 +02:00
parent ffac1d1b00
commit 56bc5536aa
2 changed files with 9 additions and 10 deletions

View File

@ -1480,6 +1480,15 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
// Passing array to function
checkUninitVar("void f(int i);\n"
"void foo()\n"
"{\n"
" int a[10];\n"
" f(a[0]);\n"
"}");
TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Uninitialized variable: a\n", "", errout.str());
// Ticket #2320
checkUninitVar("void foo() {\n"
" char a[2];\n"

View File

@ -2111,16 +2111,6 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
// f() can not write a (not supported yet)
functionVariableUsage("void f(int i) { }\n"
"void foo()\n"
"{\n"
" int a[10];\n"
" f(a[0]);\n"
"}");
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is not assigned a value.\n",
"", errout.str());
// f() can not write a (not supported yet)
functionVariableUsage("void f(const int & i) { }\n"
"void foo()\n"